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/testsuite/emix_test.cpp

    r721 r722  
    1313static void check_mean ( emix &distrib_obj, int nsamples, const vec &mean, double tolerance ); 
    1414 
    15 static void check_covariance ( emix &distrib_obj, int nsamples, const mat &R, double tolerance); 
     15static void check_covariance ( emix &distrib_obj, int nsamples, const mat &R, double tolerance ); 
    1616 
    1717TEST ( emix_test ) { 
     
    4646        pdf_ptr Ac = E1->condition ( y ); 
    4747 
    48         mlnorm<ldmat> *wacnd = dynamic_cast<mlnorm<ldmat> *>( Ac.get() ); 
    49         CHECK(wacnd); 
     48        mlnorm<ldmat> *wacnd = dynamic_cast<mlnorm<ldmat> *> ( Ac.get() ); 
     49        CHECK ( wacnd ); 
    5050        if ( wacnd ) { 
    5151                CHECK_CLOSE ( mat ( "-0.349953" ), wacnd->_A(), epsilon ); 
     
    8383 
    8484        mat observedR ( "0.740142 -0.259015; -0.259015 1.0302" ); 
    85         check_covariance ( M2, N, observedR, 2.0); 
     85        check_covariance ( M2, N, observedR, 2.0 ); 
    8686 
    8787        epdf_ptr Mg = M2.marginal ( y ); 
     
    9797static void check_mean ( emix &distrib_obj, int nsamples, const vec &mean, double tolerance ) { 
    9898        int tc = 0; 
    99         Array<vec> actual(CurrentContext::max_trial_count); 
     99        Array<vec> actual ( CurrentContext::max_trial_count ); 
    100100        do { 
    101101                mat smp = distrib_obj.sample_mat ( nsamples ); 
    102102                vec emu = sum ( smp, 2 ) / nsamples; 
    103                 actual( tc ) = emu; 
     103                actual ( tc ) = emu; 
    104104                ++tc; 
    105105        } while ( ( tc < CurrentContext::max_trial_count ) && 
    106                   !UnitTest::AreClose ( mean, actual( tc - 1 ), tolerance ) ); 
     106                  !UnitTest::AreClose ( mean, actual ( tc - 1 ), tolerance ) ); 
    107107        if ( ( tc == CurrentContext::max_trial_count ) && 
    108              ( !UnitTest::AreClose ( mean, actual( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { 
     108                ( !UnitTest::AreClose ( mean, actual ( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { 
    109109                UnitTest::MemoryOutStream stream; 
    110                 UnitTest::TestDetails details(*UnitTest::CurrentTest::Details(), __LINE__); 
     110                UnitTest::TestDetails details ( *UnitTest::CurrentTest::Details(), __LINE__ ); 
    111111                stream << "Expected " << mean << " +/- " << tolerance << " but was " << actual; 
    112112 
     
    115115} 
    116116 
    117 static void check_covariance ( emix &distrib_obj, int nsamples, const mat &R, double tolerance) { 
     117static void check_covariance ( emix &distrib_obj, int nsamples, const mat &R, double tolerance ) { 
    118118        int tc = 0; 
    119         Array<mat> actual(CurrentContext::max_trial_count); 
     119        Array<mat> actual ( CurrentContext::max_trial_count ); 
    120120        do { 
    121121                mat smp = distrib_obj.sample_mat ( nsamples ); 
    122122                vec emu = sum ( smp, 2 ) / nsamples; 
    123123                mat er = ( smp * smp.T() ) / nsamples - outer_product ( emu, emu ); 
    124                 actual( tc ) = er; 
     124                actual ( tc ) = er; 
    125125                ++tc; 
    126126        } while ( ( tc < CurrentContext::max_trial_count ) && 
    127                   !UnitTest::AreClose ( R, actual( tc - 1 ), tolerance ) ); 
     127                  !UnitTest::AreClose ( R, actual ( tc - 1 ), tolerance ) ); 
    128128        if ( ( tc == CurrentContext::max_trial_count ) && 
    129              ( !UnitTest::AreClose ( R, actual( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { 
     129                ( !UnitTest::AreClose ( R, actual ( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { 
    130130                UnitTest::MemoryOutStream stream; 
    131                 UnitTest::TestDetails details(*UnitTest::CurrentTest::Details(), __LINE__); 
     131                UnitTest::TestDetails details ( *UnitTest::CurrentTest::Details(), __LINE__ ); 
    132132                stream << "Expected " << R << " +/- " << tolerance << " but was " << actual; 
    133133 
    134134                UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); 
    135        } 
     135        } 
    136136}