Skip to content

Instantly share code, notes, and snippets.

@bassosimone
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bassosimone/a324fb9e89f6f486958b to your computer and use it in GitHub Desktop.
Save bassosimone/a324fb9e89f6f486958b to your computer and use it in GitHub Desktop.
Possible abstract API for running libight tests in C++
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