Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

mainUnitTest.cpp

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <stdexcept>
00003 
00004 #include <cppunit/TestResult.h>
00005 #include <cppunit/TestResultCollector.h>
00006 #include <cppunit/TestRunner.h>
00007 #include <cppunit/BriefTestProgressListener.h>
00008 
00009 #include <cppunit/extensions/HelperMacros.h>
00010 #include <cppunit/extensions/TestFactoryRegistry.h>
00011 
00012 #include "Link/TeamCity/TeamCity.h"
00013 
00014 #include "Basis/CmdOptions.h"
00015 
00016 #include "Core/Array/Test/TestMakeRandom.h"
00017 #include "Core/Array/Test/TestEquals.h"
00018 
00019 #include "Core/Feature/Test/TestFunctions.h"
00020 #include "Core/Feature/Test/TestRandomTree.h"
00021 #include "Core/Feature/Test/TestMakeRandomTree.h"
00022 
00023 #include "Core/Histogram/Test/TestEntropy.h"
00024 
00025 
00026 // since we are not using libraries:
00027 #include "Link/ImpalaLib.cpp"
00028 //#include "Link/Svm/LinkSvm.cpp"
00029 
00030 using namespace CPPUNIT_NS;
00031 using namespace Impala::Link;
00032 
00033 int main(int argc, char **argv) 
00034 {
00035     // Setup logging and parse cmd line 
00036     Impala::CmdOptions& options = Impala::CmdOptions::GetInstance();
00037     options.Initialise(true, false, true);
00038     if (! options.ParseArgs(argc, argv, ""))
00039         return 1;
00040 
00041     ILOG_VAR(Impala.Test.mainUnitTest);
00042 
00043     // Create the event manager and test controller
00044     TestResult controller;
00045     
00046     // Add a listener that collects test results
00047     TestResultCollector resultCollector;
00048     controller.addListener(&resultCollector);
00049 
00050     // Add a test progress listener
00051     TestListener *listener = 0;
00052     if (TeamCity::TeamCityUsed())
00053         if (TeamCity::UnderTeamCity() || options.GetBool("verb"))
00054             listener = TeamCity::GetTestListener();
00055     if (listener == 0)
00056         listener = new BriefTestProgressListener();
00057     controller.addListener(listener);
00058 
00059     // Create the test runner and provide it with the top test object
00060     TestRunner runner;
00061     runner.addTest(TestFactoryRegistry::getRegistry().makeTest());
00062 
00063     // Run all tests
00064 
00065 #ifdef NO_DIALOGONCRASH
00066 #ifdef WIN32
00067     DWORD oldMode = ::SetErrorMode(SEM_NOGPFAULTERRORBOX);
00068     ::SetErrorMode(oldMode | SEM_NOGPFAULTERRORBOX);
00069 #endif
00070 #endif
00071 
00072     runner.run(controller);
00073     
00074     // Finish work
00075     delete listener;
00076     return resultCollector.wasSuccessful() ? 0 : 1;
00077 }

Generated on Fri Mar 19 09:30:40 2010 for ImpalaSrc by  doxygen 1.5.1