Back to index

nordugrid-arc-nox  1.1.0~rc6
Test.cpp
Go to the documentation of this file.
00001 // -*- indent-tabs-mode: nil -*-
00002 
00003 #include <cppunit/CompilerOutputter.h>
00004 #include <cppunit/extensions/TestFactoryRegistry.h>
00005 #include <cppunit/ui/text/TestRunner.h>
00006 
00007 #include <arc/Logger.h>
00008 
00009 static Arc::Logger logger(Arc::Logger::getRootLogger(), "libarcdatatest");
00010 
00011 int main(int argc, char **argv) {
00012 
00013   Arc::LogStream logcerr(std::cerr);
00014 
00015   if (argc > 1 && strcmp(argv[1], "-v") == 0) {
00016     // set logging
00017     Arc::Logger::getRootLogger().addDestination(logcerr);
00018     Arc::Logger::getRootLogger().setThreshold(Arc::VERBOSE);
00019   }
00020 
00021   CppUnit::TextUi::TestRunner runner;
00022   runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
00023 
00024   runner.setOutputter(CppUnit::CompilerOutputter::defaultOutputter
00025                       (&runner.result(), std::cerr));
00026 
00027   bool wasSuccessful = runner.run();
00028 
00029   return wasSuccessful ? 0 : 1;
00030 }