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

    r440 r456  
    44#include "test_util.h" 
    55#include "UnitTest++.h" 
    6  
    7 const double epsilon = 0.00001; 
    8  
    9 namespace UnitTest 
    10 { 
    11  
    12 inline void CheckClose(TestResults &results, const itpp::vec &expected, 
    13                        const itpp::vec &actual, double tolerance, 
    14                        TestDetails const &details) { 
    15     if (!AreClose(expected, actual, tolerance)) {  
    16         MemoryOutStream stream; 
    17         stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual; 
    18  
    19         results.OnTestFailure(details, stream.GetText()); 
    20     } 
    21 } 
    22  
    23 inline void CheckClose(TestResults &results, const itpp::mat &expected, 
    24                        const itpp::mat &actual, double tolerance, 
    25                        TestDetails const &details) { 
    26     if (!AreClose(expected, actual, tolerance)) {  
    27         MemoryOutStream stream; 
    28         stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual; 
    29  
    30         results.OnTestFailure(details, stream.GetText()); 
    31     } 
    32 } 
    33  
    34 } 
    356 
    367namespace bdm { 
     
    4112} 
    4213 
    43 void egiw_harness::test() 
     14void egiw_harness::test(const char *config_name, int idx) 
    4415{ 
    45     epdf_harness::test(); 
     16    epdf_harness::test(config_name, idx); 
     17 
     18    CurrentContext cc(config_name, idx); 
    4619 
    4720    egiw *wide = dynamic_cast<egiw *>(get_epdf()); 
    4821    CHECK(wide); 
    4922 
    50     CHECK_CLOSE(lognc, wide->lognc(), epsilon); 
     23    CHECK_CLOSE_EX(lognc, wide->lognc(), get_tolerance()); 
    5124} 
    5225