Show
Ignore:
Timestamp:
07/31/09 08:38:18 (15 years ago)
Author:
vbarta
Message:

custom test location for harness tests (extended UnitTest?++), configurable tolerance - all tests pass (most of the time)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/mepdf_test.cpp

    r448 r456  
    1313const double epsilon = 0.00001; 
    1414 
    15 namespace UnitTest 
    16 { 
    17  
    18 inline void CheckClose(TestResults &results, const itpp::vec &expected, 
    19                        const itpp::vec &actual, double tolerance, 
    20                        TestDetails const& details) { 
    21     if (!AreClose(expected, actual, tolerance)) {  
    22         MemoryOutStream stream; 
    23         stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual; 
    24  
    25         results.OnTestFailure(details, stream.GetText()); 
    26     } 
    27 } 
    28  
    29 inline void CheckClose(TestResults &results, const itpp::mat &expected, 
    30                        const itpp::mat &actual, double tolerance, 
    31                        TestDetails const& details) { 
    32     if (!AreClose(expected, actual, tolerance)) {  
    33         MemoryOutStream stream; 
    34         stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual; 
    35  
    36         results.OnTestFailure(details, stream.GetText()); 
    37     } 
    38 } 
    39  
    40 } 
    41  
    4215TEST(test_mepdf) { 
    43     RV::clear_all(); 
    44     UIFile in("mepdf.cfg"); 
    45     Array<mpdf_harness *> input; 
    46     UI::get(input, in, "data"); 
    47     int sz = input.size(); 
    48     CHECK(sz > 0); 
    49     for (int i = 0; i < sz; ++i) { 
    50         input(i)->test(); 
    51     } 
     16    mpdf_harness::test_config("mepdf.cfg"); 
    5217} 
    5318