Last active
August 29, 2015 14:16
-
-
Save bassosimone/a324fb9e89f6f486958b to your computer and use it in GitHub Desktop.
Possible abstract API for running libight tests in C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ight { | |
class GenericTest { | |
void begin(std::function<void()>); | |
void end(std::function<void()>); | |
}; | |
SharedPointer<GenericTest> make_test(Settings); | |
} | |
/// Usage | |
auto test = ight::make_test({ /* XXX: A factory for just selecting the test may be overkill */ | |
{"test_name", "ooni/dns_injection"}, | |
{"input_filepath", "/foo/bar"}, | |
{"nameserver", "8.8.8.8"}, | |
}); | |
test->begin([&test]() { | |
test->end([]() { | |
ight_break_loop(); | |
}) | |
}); | |
ight_loop(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment