Changeset 562 for library/tests

Show
Ignore:
Timestamp:
08/19/09 09:56:59 (15 years ago)
Author:
vbarta
Message:

more merger tests

Location:
library/tests
Files:
2 added
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/merger_test.cpp

    r529 r562  
    88using namespace bdm; 
    99 
    10 TEST ( test_merger_basic ) { 
     10TEST ( test_merger_base ) { 
    1111        RV x ( "{xmerger }", "1" ); 
    1212 
     
    137137        CHECK_CLOSE(exp_m2, m2, epsilon); 
    138138} 
     139 
     140TEST ( test_merger_base_sources ) { 
     141        UIFile in ( "merger.cfg" ); 
     142 
     143        shared_ptr<merger_base> mb = 
     144                UI::build<merger_base> ( in, "Merger", UI::compulsory ); 
     145 
     146        mpdf_array sources; 
     147        UI::get ( sources, in, "Sources", UI::compulsory ); 
     148        mb->set_sources ( sources ); 
     149 
     150        shared_ptr<rectangular_support> support =  
     151                UI::build<rectangular_support> ( in, "Support", UI::compulsory ); 
     152        mb->set_support( *support ); 
     153 
     154        mb->merge(); 
     155        vec m = mb->mean(); 
     156        CHECK_EQUAL ( 2, m.size() ); 
     157} 
     158 
     159TEST ( test_merger_base_sources_error ) { 
     160        UIFile in ( "merger_error.cfg" ); 
     161 
     162        mpdf_array sources; 
     163        try { 
     164                UI::get ( sources, in, "Sources", UI::compulsory ); 
     165                CHECK ( false ); 
     166        } catch ( UISettingException &exc ) { 
     167                CHECK ( exc.what() ); 
     168        } 
     169}