Changeset 547 for library/tests

Show
Ignore:
Timestamp:
08/18/09 10:32:27 (15 years ago)
Author:
vbarta
Message:

added eprod test

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/epdf_test.cpp

    r523 r547  
    1414TEST ( test_enorm ) { 
    1515        epdf_harness::test_config ( "enorm.cfg" ); 
     16} 
     17 
     18// not using epdf_harness because eprod isn't configurable (yet?) 
     19TEST ( test_eprod ) { 
     20        RV a ( "{eprod_a }", "1" ); 
     21        RV b ( "{eprod_b }", "2" ); 
     22 
     23        egamma_ptr g0; 
     24        g0->set_parameters ( vec ( "2" ), vec ( "2" ) ); 
     25        g0->set_rv ( a ); 
     26 
     27        egamma_ptr g1; 
     28        g1->set_parameters ( vec ( "100000 10000" ), vec ( "10000 1000" ) ); 
     29        g1->set_rv ( b ); 
     30 
     31        Array<const epdf*> coms ( 2 ); 
     32        coms ( 0 ) = g0.get(); 
     33        coms ( 1 ) = g1.get(); 
     34 
     35        eprod p; 
     36        // set_parameters doesn't say so, but it actually requires 
     37        // pointers in the array to outlast the eprod instance... 
     38        p.set_parameters ( coms ); 
     39 
     40        CHECK_EQUAL ( vec ( "1 10 10" ), p.mean() ); 
     41        CHECK_EQUAL ( vec ( "0 0 0" ), p.variance() ); 
    1642} 
    1743