- Timestamp:
- 08/06/09 07:49:38 (15 years ago)
- Location:
- library/tests
- Files:
-
- 9 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/additive_generator.cpp
r477 r480 7 7 void additive_generator::from_setting ( const Setting &set ) { 8 8 int sz; 9 UI::get ( sz, set, "size" );9 UI::get ( sz, set, "size", UI::compulsory ); 10 10 11 11 mat a0 = randu ( sz, sz ); … … 14 14 v2 = outer_product ( v, v ); 15 15 16 if ( set.exists ( "lambda" ) ) { 17 UI::get ( lambda, set, "lambda" ); 18 } 16 UI::get ( lambda, set, "lambda", UI::optional ); 19 17 } 20 18 -
library/tests/epdf_harness.cpp
r477 r480 20 20 UIFile in ( config_file_name ); 21 21 Array<epdf_harness *> input; 22 UI::get ( input, in, "data" );22 UI::get ( input, in, "data", UI::compulsory ); 23 23 int sz = input.size(); 24 24 CHECK ( sz > 0 ); … … 33 33 UI::get ( variance, set, "variance", UI::compulsory ); 34 34 35 UI::get (support, set, "support", UI::optional ); 36 UI::get (nbins, set, "nbins", UI::optional ); 37 UI::get (nsamples, set, "nsamples", UI::optional ); 38 UI::get (R, set, "R", UI::optional ); 35 39 36 UI::get ( support, set, "support" ); 37 UI::get ( nbins, set, "nbins" ); 38 UI::get ( nsamples, set, "nsamples" ); 39 UI::get ( R, set, "R" ); 40 mrv = UI::build<RV> (set, "marginal_rv", UI::optional ); 40 41 41 RV* rv = UI::build<RV> ( set, "marginal_rv" ); 42 if ( rv ) 43 mrv = shared_ptr<RV> ( rv ); 44 45 UI::get ( tolerance, set, "tolerance" ); 42 UI::get ( tolerance, set, "tolerance", UI::optional ); 46 43 } 47 44 -
library/tests/mpdf_harness.cpp
r477 r480 18 18 UIFile in ( config_file_name ); 19 19 Array<mpdf_harness *> input; 20 UI::get ( input, in, "data" );20 UI::get ( input, in, "data", UI::compulsory ); 21 21 int sz = input.size(); 22 22 CHECK ( sz > 0 ); … … 31 31 UI::get ( mean, set, "mean", UI::compulsory ); 32 32 33 34 UI::get ( nsamples, set, "nsamples" ); 35 UI::get ( R, set, "R" ); 36 UI::get ( tolerance, set, "tolerance" ); 33 UI::get ( nsamples, set, "nsamples", UI::optional ); 34 UI::get ( R, set, "R", UI::optional ); 35 UI::get ( tolerance, set, "tolerance", UI::optional ); 37 36 } 38 37 … … 45 44 mat er = ( smp * smp.T() ) / n - outer_product ( emu, emu ); 46 45 CHECK_CLOSE_EX ( mean, emu, tolerance ); 47 CHECK_CLOSE_EX ( R, er, tolerance ); 46 47 if ( R.rows() > 0 ) { 48 CHECK_CLOSE_EX ( R, er, tolerance ); 49 } 48 50 } 49 51 -
library/tests/size_generator.cpp
r477 r480 5 5 using bdm::UI; 6 6 7 void size_generator::from_setting ( const Setting &set ) { 8 if ( set.exists ( "size" ) ) { 9 UI::get ( sz, set, "size" ); 10 } 11 12 if ( set.exists ( "step" ) ) { 13 UI::get ( step, set, "step" ); 14 } 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 ); 15 10 } 16 11 -
library/tests/square_mat_point.cpp
r477 r480 5 5 6 6 void square_mat_point::from_setting ( const Setting &set ) { 7 UI::get ( matrix, set, "matrix" );8 UI::get ( vector, set, "vector" );9 UI::get ( scalar, set, "scalar" );7 UI::get ( matrix, set, "matrix", UI::compulsory ); 8 UI::get ( vector, set, "vector", UI::compulsory ); 9 UI::get ( scalar, set, "scalar", UI::compulsory ); 10 10 } 11 11 -
library/tests/square_mat_prep.cpp
r477 r480 65 65 66 66 UIFile gspec ( generator_file_name ); 67 auto_ptr<generator> gen ( UI::build<generator> ( gspec, "generator" ) );67 auto_ptr<generator> gen ( UI::build<generator> ( gspec, "generator", UI::compulsory ) ); 68 68 for ( int i = 0; i < agenda_length; ++i ) { 69 69 mat m = gen->next(); -
library/tests/square_mat_stress.cpp
r477 r480 176 176 UIFile fag ( agenda_file_name ); 177 177 Array<square_mat_point *> mag; 178 UI::get ( mag, fag, "agenda" );178 UI::get ( mag, fag, "agenda", UI::compulsory ); 179 179 int sz = mag.size(); 180 180 CHECK ( sz > 0 ); -
library/tests/test_user_info.cpp
r471 r480 163 163 Transport::from_setting ( set ); 164 164 165 UI::get ( electricLights, set, "electricLights" ); 165 int elights; 166 if ( UI::get ( elights, set, "electricLights", UI::optional ) ) { 167 electricLights = !!elights; 168 } 166 169 167 170 UI::get ( matr, set, "matr" ); … … 189 192 TEST ( test_load ) { 190 193 UIFile in ( "test_user_info_input.cfg" ); 191 auto_ptr<Transport> pepikovo ( UI::build<Transport> ( in, "pepikovo" ) );194 auto_ptr<Transport> pepikovo ( UI::build<Transport> ( in, "pepikovo", UI::compulsory ) ); 192 195 CHECK_EQUAL ( string ( "A car made in 1998 by audi, having 25000 kilometers on the clock.The names of passengers are as follows: Karlos Novak -1_CygWin_Matlab_Aimsun Karlosik Novacek " ), pepikovo->to_string() ); 193 196 194 auto_ptr<Transport> jardovo ( UI::build<Transport> ( in, "jardovo" ) );197 auto_ptr<Transport> jardovo ( UI::build<Transport> ( in, "jardovo", UI::compulsory ) ); 195 198 CHECK_EQUAL ( string ( "A car made in 1992 by liaz, having 1555000 kilometers on the clock." ), jardovo->to_string() ); 196 199 197 auto_ptr<Transport> ondrejovo ( UI::build<Transport> ( in, "ondrejovo" ) );200 auto_ptr<Transport> ondrejovo ( UI::build<Transport> ( in, "ondrejovo", UI::compulsory ) ); 198 201 CHECK_EQUAL ( string ( "a bike made in 1996 by author with electric lights included" ), ondrejovo->to_string() ); 199 202 200 auto_ptr<Transport> elisky ( UI::build<Transport> ( in, "elisky" ) );203 auto_ptr<Transport> elisky ( UI::build<Transport> ( in, "elisky", UI::compulsory ) ); 201 204 CHECK_EQUAL ( string ( "A car made in 1992 by liaz, having 1555000 kilometers on the clock." ), elisky->to_string() ); 202 205 203 auto_ptr<Transport> kati ( UI::build<Transport> ( in, "kati" ) );206 auto_ptr<Transport> kati ( UI::build<Transport> ( in, "kati", UI::compulsory ) ); 204 207 CHECK_EQUAL ( string ( "A car made in 1980 by vecernicek, having 250000 kilometers on the clock." ), kati->to_string() ); 205 208 } … … 207 210 TEST ( test_save ) { 208 211 UIFile in ( "test_user_info_input.cfg" ); 209 auto_ptr<Transport> pepikovo ( UI::build<Transport> ( in, "pepikovo" ) );212 auto_ptr<Transport> pepikovo ( UI::build<Transport> ( in, "pepikovo", UI::compulsory ) ); 210 213 211 214 Car audi ( 1968, "zyl", 200 ); -
library/tests/test_user_info_input.cfg
r386 r480 25 25 year = 1996; 26 26 manufacturer = "author"; 27 electricLights = true;27 electricLights = 1; 28 28 matr = ( 2, 2, [ 1.0, 0.0, 0.0, 1.0 ] ); 29 29 };