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/enorm_test.cpp

    r454 r456  
    22#include "stat/exp_family.h" 
    33#include "epdf_harness.h" 
    4 #include "mat_checks.h" 
    5 #include "test_util.h" 
    64#include "UnitTest++.h" 
    75 
     
    97 
    108const double epsilon = 0.00001; 
    11  
    12 namespace UnitTest 
    13 { 
    14  
    15 inline void CheckClose(TestResults &results, const itpp::vec &expected, 
    16                        const itpp::vec &actual, double tolerance, 
    17                        TestDetails const& details) { 
    18     if (!AreClose(expected, actual, tolerance)) {  
    19         MemoryOutStream stream; 
    20         stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual; 
    21  
    22         results.OnTestFailure(details, stream.GetText()); 
    23     } 
    24 } 
    25  
    26 inline void CheckClose(TestResults &results, const itpp::mat &expected, 
    27                        const itpp::mat &actual, double tolerance, 
    28                        TestDetails const& details) { 
    29     if (!AreClose(expected, actual, tolerance)) {  
    30         MemoryOutStream stream; 
    31         stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual; 
    32  
    33         results.OnTestFailure(details, stream.GetText()); 
    34     } 
    35 } 
    36  
    37 } 
    389 
    3910template<> 
     
    5021 
    5122TEST(test_enorm) { 
    52     RV::clear_all(); 
    53     UIFile in("enorm.cfg"); 
    54     Array<epdf_harness *> input; 
    55     UI::get(input, in, "data"); 
    56     int sz = input.size(); 
    57     CHECK(sz > 0); 
    58     for (int i = 0; i < sz; ++i) { 
    59         input(i)->test(); 
    60     } 
     23    epdf_harness::test_config("enorm.cfg"); 
    6124}