Changeset 725 for library/tests
- Timestamp:
- 11/17/09 00:53:54 (16 years ago)
- Location:
- library/tests
- Files:
-
- 3 modified
-
epdf_harness.cpp (modified) (4 diffs)
-
testsuite/egiw.cfg (modified) (2 diffs)
-
testsuite/epdf_test.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
library/tests/epdf_harness.cpp
r722 r725 59 59 } 60 60 61 if ( R.rows() > 0 ) {61 if ( variance.length() > 0 ) { 62 62 check_sample_mean(); 63 } 64 if (R.rows()>0){ 63 65 check_covariance(); 64 66 } … … 114 116 vec yb = support.get_row ( 1 ); 115 117 116 int tc = 0; 117 Array<vec> actual ( CurrentContext::max_trial_count ); 118 do { 119 vec emu = num_mean2 ( hepdf.get(), xb, yb, nbins ( 0 ), nbins ( 1 ) ); 120 actual ( tc ) = emu; 121 ++tc; 122 } while ( ( tc < CurrentContext::max_trial_count ) && 123 !UnitTest::AreClose ( mean, actual ( tc - 1 ), tolerance ) ); 124 if ( ( tc == CurrentContext::max_trial_count ) && 125 ( !UnitTest::AreClose ( mean, actual ( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { 126 UnitTest::MemoryOutStream stream; 127 stream << CurrentContext::format_context ( __LINE__ ) << "expected " << mean << " +/- " << tolerance << " but was " << actual; 128 129 UnitTest::TestDetails details ( *UnitTest::CurrentTest::Details(), 0, false ); 130 131 UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); 132 } 118 vec actual; 119 actual = num_mean2 ( hepdf.get(), xb, yb, nbins ( 0 ), nbins ( 1 ) ); 120 121 CHECK_CLOSE(mean, actual, tolerance); 133 122 } 134 123 … … 137 126 vec yb = support.get_row ( 1 ); 138 127 139 int tc = 0; 140 Array<double> actual ( CurrentContext::max_trial_count ); 141 do { 142 double nc = normcoef ( hepdf.get(), xb, yb, nbins ( 0 ), nbins ( 1 ) ); 143 actual ( tc ) = nc; 144 ++tc; 145 } while ( ( tc < CurrentContext::max_trial_count ) && 146 !UnitTest::AreClose ( 1.0, actual ( tc - 1 ), tolerance ) ); 147 if ( ( tc == CurrentContext::max_trial_count ) && 148 ( !UnitTest::AreClose ( 1.0, actual ( CurrentContext::max_trial_count - 1 ), tolerance ) ) ) { 149 UnitTest::MemoryOutStream stream; 150 stream << CurrentContext::format_context ( __LINE__ ) << "expected " << mean << " +/- " << tolerance << " but was " << actual; 151 152 UnitTest::TestDetails details ( *UnitTest::CurrentTest::Details(), 0, false ); 153 154 UnitTest::CurrentTest::Results()->OnTestFailure ( details, stream.GetText() ); 155 } 128 double nc = normcoef ( hepdf.get(), xb, yb, nbins ( 0 ), nbins ( 1 ) ); 129 CHECK_CLOSE(1.0,nc,0.01); 156 130 } 157 131 … … 168 142 } while ( ( tc < CurrentContext::max_trial_count ) && 169 143 !UnitTest::AreClose ( mean, actual ( tc - 1 ), delta ) ); 144 170 145 if ( ( tc == CurrentContext::max_trial_count ) && 171 146 ( !UnitTest::AreClose ( mean, actual ( CurrentContext::max_trial_count - 1 ), delta ) ) ) { -
library/tests/testsuite/egiw.cfg
r717 r725 12 12 }; 13 13 }; 14 mean = [ 1.1, 0. 1];15 variance = [ 0.0 1, 8e-05];14 mean = [ 1.1, 0.2 ]; 15 variance = [ 0.02, 0.01333 ]; 16 16 support = ( "matrix", 2, 2, [ -2.0, 4.0, 0.01, 2.0 ] ); 17 17 nbins = [ 100, 200 ]; 18 tolerance = 0. 2;18 tolerance = 0.01; 19 19 }, 20 20 { … … 33 33 mean = [2.0, 1.14286]; 34 34 variance = [0.0285714, 0.0395795]; 35 support = ( "matrix", 2, 2, [ 0.0, 4.0, 0.01, 3.0 ] ); 36 nbins = [ 100, 200 ]; 37 tolerance = 0.01; 35 38 } ); 36 39 -
library/tests/testsuite/epdf_test.cpp
r723 r725 43 43 44 44 TEST ( ewishart_test ) { 45 mat wM = "1 .0 0.9; 0.9 1.0";45 mat wM = "10.0 0.9; 0.9 1.0"; 46 46 eWishartCh eW; 47 47 eW.set_parameters ( wM / 100, 100 ); … … 53 53 } 54 54 55 mat observed ( "0.978486 0.88637; 0.88637 0.992141" );56 55 mat actual = mea / 100; 57 CHECK_CLOSE ( observed, actual, 0.1 );56 CHECK_CLOSE ( wM, actual, 0.1 ); 58 57 } 59 58
