Show
Ignore:
Timestamp:
08/06/09 13:38:17 (15 years ago)
Author:
vbarta
Message:

doubled tolerance computed from variance, repeating failing tests (at most) 3 times; epdf tests pass

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/mat_checks.h

    r477 r481  
    1616#include "../bdm/itpp_ext.h" 
    1717#include "UnitTest++.h" 
     18#include <string> 
    1819 
    1920namespace UnitTest { 
     
    5253} 
    5354 
    54 /*! CHECK_EQUAL_EX and CHECK_CLOSE_EX macros should be used only in 
    55   blocks having an instance of this class (which sets the globals for 
    56   error reporting). */ 
     55/*! CHECK_*_EX macros should be used only in blocks having an instance 
     56  of this class (which sets the globals for error reporting). */ 
    5757class CurrentContext { 
     58public: 
     59        // how many times to repeat a failing test before reporting 
     60        // failure 
     61        static const int max_trial_count = 3; 
     62 
    5863private: 
    5964        static const char *config_name; 
     
    6570        ~CurrentContext(); 
    6671 
     72        /* Should be called only in blocks having an instance of 
     73           CurrentContext. The argument, when not default, should be 
     74           __LINE__ (and it is included in the returned string). 
     75        */ 
     76        static std::string format_context( int ln = -1 ); 
     77 
    6778        template<typename Expected, typename Actual> 
    6879        static void CheckEqualEx ( UnitTest::TestResults& results, 
     
    7283                if ( ! ( expected == actual ) ) { 
    7384                        UnitTest::MemoryOutStream stream; 
    74                         stream << "error at " << config_name << '[' << index << "]: expected " << expected << " but was " << actual; 
     85                        stream << format_context() << "expected " << expected << " but was " << actual; 
    7586 
    7687                        results.OnTestFailure ( details, stream.GetText() ); 
     
    8697                if ( !UnitTest::AreClose ( expected, actual, tolerance ) ) { 
    8798                        UnitTest::MemoryOutStream stream; 
    88                         stream << "error at " << config_name << '[' << index << "]: expected " << expected << " +/- " << tolerance << " but was " << actual; 
     99                        stream << format_context() << "expected " << expected << " +/- " << tolerance << " but was " << actual; 
    89100 
    90101                        results.OnTestFailure ( details, stream.GetText() );