diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-05-14 14:57:44 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2014-05-14 14:57:44 +0200 |
commit | ef1b3e124ebe002d028a1fcf00a13d88a5e1202f (patch) | |
tree | f76ec4ba276c18bde301526f10483cba8c1bfe34 /test/test.cc | |
parent | 0ff825e0e6fe5fc7238e3964d24779a07cb53518 (diff) |
Added missing unit test files.
Diffstat (limited to 'test/test.cc')
-rw-r--r-- | test/test.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/test.cc b/test/test.cc new file mode 100644 index 0000000..211cce6 --- /dev/null +++ b/test/test.cc @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ + +//#include <cppunit/CompilerOutputter.h> +#include <cppunit/XmlOutputter.h> +#include <cppunit/extensions/TestFactoryRegistry.h> +#include <cppunit/ui/text/TestRunner.h> + +#include <fstream> + +int main(int argc, char* argv[]) +{ + // Get the top level suite from the registry + CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); + + // Adds the test to the list of test to run + CppUnit::TextUi::TestRunner runner; + runner.addTest( suite ); + + // Change the default outputter to a compiler error format outputter + // runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), std::cerr)); + + std::ofstream myfile; + myfile.open("result_"OUTPUT".xml"); + runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), myfile)); + + // Run the tests. + bool wasSucessful = runner.run(); + + myfile.close(); + + // Return error code 1 if the one of test failed. + return wasSucessful ? 0 : 1; +} |