Show
Ignore:
Timestamp:
11/13/09 16:11:31 (15 years ago)
Author:
mido
Message:

astyler run over all test sources
general_suite added
cleanup of \test directory finished

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/stresssuite/stresssuite.cpp

    r721 r722  
    55#include "itpp_ext.h" 
    66#include <string.h> 
     7#include "../general_suite.h" 
    78 
    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 } 
     9using namespace UnitTest; 
    3510 
    3611int main ( int argc, char const *argv[] ) { 
    3712        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 ); 
    5717        } 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 
    6121                     << argv[0] << " print ................................. print all the implemented stress tests" << endl; 
    6222        } 
    6323 
    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(); 
    7225}