Salome HOME
Merge branch 'BR_LAND_COVER_MAP' of ssh://git.salome-platform.org/modules/hydro into...
[modules/hydro.git] / src / HYDRO_tests / test_HYDROData_Main.cxx
index 66fcdafc3fee9f735325afc6ae630f190ed154f7..151bb2b561eaefb87d4793b2e15ae7fc9cc2a2d1 100644 (file)
 #include <cppunit/CompilerOutputter.h>
 #include <cppunit/TestResult.h>
 #include <cppunit/TestResultCollector.h>
-#include <cppunit/TestRunner.h>
-#include <cppunit/TextTestProgressListener.h>
 #include <stdexcept>
 #include <TestViewer.h>
+#include <TestLib_Listener.h>
+#include <TestLib_Runner.h>
 #include <OCCViewer_ViewWindow.h>
 #include <SUIT_Session.h>
 #include <QApplication>
 #include <QColor>
-
-std::ostream& operator<<( std::ostream& theStream, const QString& theText )
-{
-  theStream << theText.toStdString();
-  return theStream;
-}
-
-std::ostream& operator<<( std::ostream& theStream, const QColor& theColor )
-{
-  theStream << "[" << theColor.red() << ", " << theColor.green() << ", " << theColor.blue() << "]";
-  return theStream;
-}
 #include <time.h>
 
 int main( int argc, char* argv[] )
 {
-  srand( time( 0 ) );
+  srand( 0 );
 
   QApplication anApp( argc, argv );
   SUIT_Session aSession;
@@ -63,18 +51,20 @@ int main( int argc, char* argv[] )
   controller.addListener( &result );        
 
   // Add a listener that print dots as test run.
-  CppUnit::TextTestProgressListener progress;
+  TestLib_Listener progress;
   controller.addListener( &progress );      
 
   CppUnit::TestFactoryRegistry& registry = 
     CppUnit::TestFactoryRegistry::getRegistry();
   // Add the top suite to the test runner
-  CppUnit::TestRunner runner;
+  TestLib_Runner runner;
+  QString aPath = qgetenv( "HYDRO_SRC_DIR" ) + "/src/tests.cfg";
+  runner.Load( aPath.toStdString() );
   runner.addTest( registry.makeTest() );   
   try
   {
-    std::cout << "Running "  <<  testPath;
-    runner.run( controller, testPath );
+    std::cout << "Running tests "  << testPath << "..." << std::endl;
+    runner.Run( controller );
 
     std::cerr << std::endl;