Changeset 722 for library/tests/stresssuite/stresssuite.cpp
- Timestamp:
- 11/13/09 16:11:31 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/stresssuite/stresssuite.cpp
r721 r722 5 5 #include "itpp_ext.h" 6 6 #include <string.h> 7 #include "../general_suite.h" 7 8 8 using std::cout; 9 using std::cerr; 10 using std::endl; 11 12 using namespace itpp; 13 14 Array<const char *> selected_tests; 15 16 bool is_selected_test ( const UnitTest::Test *test ) { 17 bdm_assert_debug ( test, "NULL test" ); 18 19 if ( !selected_tests.length() ) { 20 return true; 21 } 22 23 for ( int i = 0; i < selected_tests.length(); ++i ) { 24 const char *n = test->m_details.testName; 25 bdm_assert_debug ( n, "NULL test name" ); 26 const char *sname = selected_tests ( i ); 27 bdm_assert_debug ( sname, "NULL selected test name" ); 28 if ( !strcmp ( n, sname ) ) { 29 return true; 30 } 31 } 32 33 return false; 34 } 9 using namespace UnitTest; 35 10 36 11 int main ( int argc, char const *argv[] ) { 37 12 if ( argc > 1 ) { 38 if ( !strcmp ( argv[1], "print" ) ) { 39 UnitTest::Test* curTest = UnitTest::Test::GetTestList().GetHead(); 40 41 while ( curTest != 0 ) { 42 const char *n = curTest->m_details.testName; 43 printf ( "%s\n", n ); 44 curTest = curTest->next; 45 } 46 return 0; 47 } else { 48 selected_tests.set_length ( argc - 1 ); 49 const char **param = argv + 1; 50 int i = 0; 51 while ( *param ) { 52 selected_tests ( i ) = *param; 53 ++i; 54 ++param; 55 } 56 } 13 if ( !strcmp ( argv[1], "print" ) ) 14 print_test_list(); 15 else 16 pick_selected_tests ( argc, argv ); 57 17 } else { 58 cout << endl << "STRESSSUITE - a program covering all BDM stress tests." << endl << endl 59 << argv[0] << " ....................................... run all stress tests" << endl 60 << argv[0] << " particular_test_1 particular_test_2 ... run selected stress tests" << endl 18 cout << endl << "STRESSSUITE - a program covering all BDM stress tests." << endl << endl 19 << argv[0] << " ....................................... run all stress tests" << endl 20 << argv[0] << " particular_test_1 particular_test_2 ... run selected stress tests" << endl 61 21 << argv[0] << " print ................................. print all the implemented stress tests" << endl; 62 22 } 63 23 64 itpp::RNG_randomize(); 65 66 UnitTest::TestReporterStdout reporter; 67 UnitTest::TestRunner runner ( reporter ); 68 return runner.RunTestsIf ( UnitTest::Test::GetTestList(), 69 0, 70 is_selected_test, 71 0 ); 24 return run_selected_tests(); 72 25 }