]> git.localhorst.tv Git - blank.git/blob - tst/test.cpp
test missing option arguments
[blank.git] / tst / test.cpp
1 #include <cstring>
2 #include <cppunit/extensions/TestFactoryRegistry.h>
3 #include <cppunit/ui/text/TestRunner.h>
4
5 using CppUnit::TestFactoryRegistry;
6 using CppUnit::TextUi::TestRunner;
7
8
9 int main(int argc, char **argv) {
10
11         bool headless = false;
12         if (argc > 1 && std::strcmp(argv[1], "--headless") == 0) {
13                 headless = true;
14         }
15
16         TestRunner runner;
17         {
18                 TestFactoryRegistry &registry = TestFactoryRegistry::getRegistry();
19                 runner.addTest(registry.makeTest());
20         }
21         if (!headless) {
22                 TestFactoryRegistry &registry = TestFactoryRegistry::getRegistry("headed");
23                 runner.addTest(registry.makeTest());
24         }
25
26         if (runner.run()) {
27                 return 0;
28         } else {
29                 return 1;
30         }
31 }