-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.cpp
More file actions
58 lines (48 loc) · 1.66 KB
/
test.cpp
File metadata and controls
58 lines (48 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
////////////////////////////////////////////////////////////////////////
//
// test.cpp: Test harness for all the unit tests.
//
// Copyright (c) Simon Frankau 2018
//
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif
#include <cmath>
#include <memory>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/CompilerOutputter.h>
#include <cppunit/TestCase.h>
#include <cppunit/extensions/HelperMacros.h>
CppUnit::Test *suite()
{
CppUnit::TestFactoryRegistry ®istry =
CppUnit::TestFactoryRegistry::getRegistry();
registry.registerFactory(
&CppUnit::TestFactoryRegistry::getRegistry("GeomTestCase"));
registry.registerFactory(
&CppUnit::TestFactoryRegistry::getRegistry("WeightingTestCase"));
registry.registerFactory(
&CppUnit::TestFactoryRegistry::getRegistry("TransfersTestCase"));
return registry.makeTest();
}
int main(int argc, char* argv[])
{
glutInit(&argc, argv);
// if command line contains "-selftest" then this is the post build check
// => the output must be in the compiler error format.
bool selfTest = (argc > 1) && (std::string("-selftest") == argv[1]);
CppUnit::TextUi::TestRunner runner;
runner.addTest(suite());
if (selfTest) {
// Change the default outputter to a compiler error format
// outputter The test runner owns the new outputter.
runner.setOutputter(CppUnit::CompilerOutputter::defaultOutputter(
&runner.result(),
std::cerr));
}
bool wasSucessful = runner.run("");
return wasSucessful ? 0 : 1;
}