1x90TestRunner.cpp

Go to the documentation of this file.
00001 #include <cppunit/extensions/TestFactoryRegistry.h>
00002 #include <cppunit/ui/text/TestRunner.h>
00003 #include <string>
00004 #include <stdio.h>
00005 #include <iostream>
00006 
00007 using namespace std;
00008 
00009 // Global data used by tests:
00010 
00011 unsigned long ModuleBase;       // Where the TDC lives in VME space.
00012 
00013 //
00014 static void Usage()
00015 {
00016   cerr << "Usage: \n";
00017   cerr << "   tests base\n";
00018   cerr << " base - the base address of the module under test\n";
00019 
00020 }
00021 
00022 int main(int argc, char** argv)
00023 {
00024   if(argc != 2) {
00025     Usage();
00026     exit(-1);
00027   }
00028   char* base = argv[1];
00029   if(sscanf(base, "%lx", &ModuleBase) != 1) {
00030     cerr << "Failed to scan module base: " << base << endl;
00031     Usage();
00032     exit(-1);
00033   }
00034   cerr << "Module base is 0x" << hex << ModuleBase << dec << endl;
00035 
00036   CppUnit::TextUi::TestRunner   
00037                runner; // Control tests.
00038   CppUnit::TestFactoryRegistry& 
00039                registry(CppUnit::TestFactoryRegistry::getRegistry());
00040 
00041   runner.addTest(registry.makeTest());
00042 
00043   bool wasSucessful;
00044   try {
00045     wasSucessful = runner.run("",false);
00046   } 
00047   catch(string& rFailure) {
00048     cerr << "Caught a string exception from test suites.: \n";
00049     cerr << rFailure << endl;
00050     wasSucessful = false;
00051   }
00052   return !wasSucessful;
00053 }

Generated on Wed Sep 17 08:38:09 2008 for NSCL Device support. by  doxygen 1.5.1