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

Location:
library/tests/stresssuite
Files:
9 modified

Legend:

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

    r721 r722  
    1111        ARX Ar; 
    1212        Ar.set_statistics ( 1, V0, -1.0 ); 
    13         Ar.set_constant(true); 
     13        Ar.set_constant ( true ); 
    1414        Ar.validate(); 
    1515 
  • library/tests/stresssuite/arx_stress.cpp

    r721 r722  
    2929        ARX Ar; 
    3030        Ar.set_statistics ( 1, V0, nu0 );               // Estimator 
    31         Ar.set_constant(false); 
     31        Ar.set_constant ( false ); 
    3232        Ar.validate(); 
    3333        const epdf& f_thr = Ar.posterior();          // refrence to posterior of the estimator 
     
    5252                Yt ( t ) = th * rgr + sqr * NorRNG(); 
    5353 
    54                 Ar.bayes ( vec_1(Yt(t)), rgr );             // Bayes rule 
     54                Ar.bayes ( vec_1 ( Yt ( t ) ), rgr );       // Bayes rule 
    5555 
    5656                // Build predictor 
  • library/tests/stresssuite/kalman_QR_stress.cpp

    r721 r722  
    7070        KF_QR.set_parameters ( &evolQR, &evolQR, 100 ); 
    7171        evolQR.condition ( "1 1 1" ); 
    72         egamma kfinit=egamma("10 10 10","1 1 1"); 
    73         KF_QR.set_statistics ( egamma("10 10 10","1 1 1"), &KF ); 
     72        egamma kfinit = egamma ( "10 10 10", "1 1 1" ); 
     73        KF_QR.set_statistics ( egamma ( "10 10 10", "1 1 1" ), &KF ); 
    7474        const epdf& mpost = KF_QR.posterior(); 
    7575        const epdf& mposttr = KFtr.posterior(); 
  • library/tests/stresssuite/kalman_stress.cpp

    r721 r722  
    6363        KF.set_parameters ( A, B, C, D, chmat ( Q ), chmat ( R ) ); 
    6464        KF.set_statistics ( mu0, chmat ( P0 ) ); //prediction! 
    65         KF.set_evalll(false); 
     65        KF.set_evalll ( false ); 
    6666        KF.validate(); 
    6767        const epdf& KFep = KF.posterior(); 
     
    7171        // FULL 
    7272        KalmanFull KF2; 
    73         KF2.set_parameters( A, B, C, D,  Q, R); 
    74         KF2.set_statistics( mu0, P0 ); 
    75         KF2.set_evalll(false); 
     73        KF2.set_parameters ( A, B, C, D,  Q, R ); 
     74        KF2.set_statistics ( mu0, P0 ); 
     75        KF2.set_evalll ( false ); 
    7676        KF2.validate(); 
    7777        mat Xt2 ( dimx, Ndat ); 
     
    8585        KFE.set_parameters ( fxu, hxu, Q, R ); 
    8686        KFE.set_statistics ( mu0, chmat ( P0 ) ); 
    87         KFE.set_evalll(false); 
     87        KFE.set_evalll ( false ); 
    8888        KFE.validate(); 
    8989        const epdf& KFEep = KFE.posterior(); 
     
    9898        tt.tic(); 
    9999        for ( int t = 1; t < Ndat; t++ ) { 
    100                 dt = Dt.get_col(t); 
    101                 KF.bayes ( dt.get(0,C.rows()-1), dt.get(C.rows(), dt.length()-1) ); 
     100                dt = Dt.get_col ( t ); 
     101                KF.bayes ( dt.get ( 0, C.rows() - 1 ), dt.get ( C.rows(), dt.length() - 1 ) ); 
    102102                Xt.set_col ( t, KFep.mean() ); 
    103103        } 
     
    106106        tt.tic(); 
    107107        for ( int t = 1; t < Ndat; t++ ) { 
    108                 dt = Dt.get_col(t); 
    109                 KF2.bayes ( dt.get(0,C.rows()-1), dt.get(C.rows(), dt.length()-1) ); 
     108                dt = Dt.get_col ( t ); 
     109                KF2.bayes ( dt.get ( 0, C.rows() - 1 ), dt.get ( C.rows(), dt.length() - 1 ) ); 
    110110                Xt2.set_col ( t, KF2.posterior().mean() ); 
    111111        } 
     
    114114        tt.tic(); 
    115115        for ( int t = 1; t < Ndat; t++ ) { 
    116                 dt = Dt.get_col(t); 
    117                 KFE.bayes ( dt.get(0,C.rows()-1), dt.get(C.rows(), dt.length()-1) ); 
     116                dt = Dt.get_col ( t ); 
     117                KFE.bayes ( dt.get ( 0, C.rows() - 1 ), dt.get ( C.rows(), dt.length() - 1 ) ); 
    118118                XtE.set_col ( t, KFEep.mean() ); 
    119119        } 
  • library/tests/stresssuite/mixtures_stress.cpp

    r721 r722  
    101101        // Add ones for constant coefficients 
    102102        mat Data = concat_vertical ( Smp, ones ( 1, Smp.cols() ) ); 
    103         Post.bayes ( Data , empty_vec); 
     103        Post.bayes ( Data , empty_vec ); 
    104104 
    105105        cout << "Posterior mixture:" << endl; 
  • library/tests/stresssuite/particle_stress.cpp

    r721 r722  
    3737 
    3838        ivec ind; 
    39         emp.resample(ind); 
     39        emp.resample ( ind ); 
    4040 
    4141        cout << ind << endl; 
  • library/tests/stresssuite/resample_stress.cpp

    r721 r722  
    3838 
    3939        ivec ind; 
    40         emp.resample(ind); 
     40        emp.resample ( ind ); 
    4141 
    4242        cout << ind << endl; 
  • library/tests/stresssuite/size_generator.cpp

    r717 r722  
    55using bdm::UI; 
    66 
    7 void size_generator::from_setting(const Setting &set) { 
    8         UI::get( sz, set, "size", UI::optional ); 
    9         UI::get( step, set, "step", UI::optional ); 
     7void size_generator::from_setting ( const Setting &set ) { 
     8        UI::get ( sz, set, "size", UI::optional ); 
     9        UI::get ( step, set, "step", UI::optional ); 
    1010} 
    1111 
  • 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}