| 1 |
#include <cppunit/CompilerOutputter.h> |
| 2 |
#include <cppunit/extensions/TestFactoryRegistry.h> |
| 3 |
#include <cppunit/ui/text/TestRunner.h> |
| 4 |
#include "../util.h" // for NSISRT_* |
| 5 |
|
| 6 |
NSISRT_DEFINEGLOBALS(); |
| 7 |
|
| 8 |
int main(int argc, char* argv[]) |
| 9 |
{ |
| 10 |
if (!NSISRT_Initialize()) return 1; |
| 11 |
|
| 12 |
// Get the top level suite from the registry |
| 13 |
CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); |
| 14 |
|
| 15 |
// Adds the test to the list of test to run |
| 16 |
CppUnit::TextUi::TestRunner runner; |
| 17 |
runner.addTest( suite ); |
| 18 |
|
| 19 |
// Print system info |
| 20 |
std::ostream &outstream = std::cerr; |
| 21 |
#ifdef _UNICODE |
| 22 |
const char *defunicode = "Unicode "; |
| 23 |
#else |
| 24 |
const char *defunicode = "Ansi "; |
| 25 |
#endif |
| 26 |
#ifdef MAKENSIS |
| 27 |
const char *defmknsis = "MAKENSIS "; |
| 28 |
#else |
| 29 |
const char *defmknsis = ""; |
| 30 |
#endif |
| 31 |
outstream << "Running tests as " << defunicode << defmknsis |
| 32 |
<< (sizeof(void*) * 8) << "-bit (wchar_t=" << sizeof(wchar_t) |
| 33 |
<< " TCHAR=" << sizeof(TCHAR) << ")\n"; |
| 34 |
|
| 35 |
// Change the default outputter to a compiler error format outputter |
| 36 |
runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), outstream)); |
| 37 |
// Run the tests. |
| 38 |
bool wasSuccessful = runner.run(); |
| 39 |
|
| 40 |
// Return error code 1 if the one of test failed. |
| 41 |
return wasSuccessful ? 0 : 1; |
| 42 |
} |