fixed: compile issue
[opensg.git] / Tools / unittest-cpp / UnitTestRunner.cpp
blob70556e96c77a9f10dbcd744ada388ed555c2dce8
2 #include <UnitTest++.h>
3 #include <TestReporterStdout.h>
5 #include <OSGConfig.h>
6 #include <OSGBaseInitFunctions.h>
8 struct TestNameEquals
10 TestNameEquals(const std::string &testName)
11 : _testName(testName)
15 bool operator()(const UnitTest::Test * const test) const
17 return (_testName == test->m_details.testName);
20 std::string _testName;
23 int main(int argc, char *argv[])
25 OSG::osgInit(argc, argv);
27 int retVal = -1;
29 if(argc > 1)
31 TestNameEquals pred(argv[1]);
32 UnitTest::TestReporterStdout rep;
33 UnitTest::TestRunner runner(rep);
35 retVal = runner.RunTestsIf(
36 UnitTest::Test::GetTestList(), NULL, pred, 0);
38 else
40 retVal = UnitTest::RunAllTests();
43 OSG::osgExit();
45 return retVal;