Show
Ignore:
Timestamp:
06/09/10 14:00:40 (14 years ago)
Author:
mido
Message:

astyle applied all over the library

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/mat_checks.h

    r727 r1064  
    3232                         const itpp::vec &actual, double tolerance, 
    3333                         TestDetails const &details ) { 
    34         if ( !AreClose ( expected, actual, tolerance ) ) { 
    35                 MemoryOutStream stream; 
    36                 stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual; 
     34    if ( !AreClose ( expected, actual, tolerance ) ) { 
     35        MemoryOutStream stream; 
     36        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual; 
    3737 
    38                 results.OnTestFailure ( details, stream.GetText() ); 
    39         } 
     38        results.OnTestFailure ( details, stream.GetText() ); 
     39    } 
    4040} 
    4141 
     
    4343                         const itpp::mat &actual, double tolerance, 
    4444                         TestDetails const &details ) { 
    45         if ( !AreClose ( expected, actual, tolerance ) ) { 
    46                 MemoryOutStream stream; 
    47                 stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual; 
     45    if ( !AreClose ( expected, actual, tolerance ) ) { 
     46        MemoryOutStream stream; 
     47        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual; 
    4848 
    49                 results.OnTestFailure ( details, stream.GetText() ); 
    50         } 
     49        results.OnTestFailure ( details, stream.GetText() ); 
     50    } 
    5151} 
    5252 
     
    5656  tests (currently 2). */ 
    5757inline itpp::vec make_close_tolerance ( const itpp::vec & variance, int nsamples ) { 
    58         // simplify overloading for Visual Studio 
    59         return 3 * ( sqrt ( variance ) / sqrt ( static_cast<double> ( nsamples ) ) ); 
     58    // simplify overloading for Visual Studio 
     59    return 3 * ( sqrt ( variance ) / sqrt ( static_cast<double> ( nsamples ) ) ); 
    6060} 
    6161 
     
    6464class CurrentContext { 
    6565public: 
    66         // how many times to repeat a failing test before reporting 
    67         // failure 
    68         static const int max_trial_count = 3; 
     66    // how many times to repeat a failing test before reporting 
     67    // failure 
     68    static const int max_trial_count = 3; 
    6969 
    7070private: 
    71         static const char *config_name; 
    72         static int index; 
     71    static const char *config_name; 
     72    static int index; 
    7373 
    7474public: 
    75         // the pointer must stay valid for the lifetime of the object 
    76         CurrentContext ( const char *name, int idx ); 
    77         ~CurrentContext(); 
     75    // the pointer must stay valid for the lifetime of the object 
     76    CurrentContext ( const char *name, int idx ); 
     77    ~CurrentContext(); 
    7878 
    79         /* Should be called only in blocks having an instance of 
    80            CurrentContext. The argument, when not default, should be 
    81            __LINE__ (and it is included in the returned string). 
    82         */ 
    83         static std::string format_context ( int ln = -1 ); 
     79    /* Should be called only in blocks having an instance of 
     80       CurrentContext. The argument, when not default, should be 
     81       __LINE__ (and it is included in the returned string). 
     82    */ 
     83    static std::string format_context ( int ln = -1 ); 
    8484 
    85         template<typename Expected, typename Actual> 
    86         static void CheckEqualEx ( UnitTest::TestResults& results, 
    87                                    Expected const& expected, 
    88                                    Actual const& actual, 
    89                                    UnitTest::TestDetails const& details ) { 
    90                 if ( ! ( expected == actual ) ) { 
    91                         UnitTest::MemoryOutStream stream; 
    92                         stream << format_context() << "expected " << expected << " but was " << actual; 
     85    template<typename Expected, typename Actual> 
     86    static void CheckEqualEx ( UnitTest::TestResults& results, 
     87                               Expected const& expected, 
     88                               Actual const& actual, 
     89                               UnitTest::TestDetails const& details ) { 
     90        if ( ! ( expected == actual ) ) { 
     91            UnitTest::MemoryOutStream stream; 
     92            stream << format_context() << "expected " << expected << " but was " << actual; 
    9393 
    94                         results.OnTestFailure ( details, stream.GetText() ); 
    95                 } 
    96         } 
     94            results.OnTestFailure ( details, stream.GetText() ); 
     95        } 
     96    } 
    9797 
    98         template<typename Expected, typename Actual, typename Tolerance> 
    99         static void CheckCloseEx ( UnitTest::TestResults& results, 
    100                                    Expected const& expected, 
    101                                    Actual const& actual, 
    102                                    Tolerance const& tolerance, 
    103                                    UnitTest::TestDetails const& details ) { 
    104                 if ( !UnitTest::AreClose ( expected, actual, tolerance ) ) { 
    105                         UnitTest::MemoryOutStream stream; 
    106                         stream << format_context() << "expected " << expected << " +/- " << tolerance << " but was " << actual; 
     98    template<typename Expected, typename Actual, typename Tolerance> 
     99    static void CheckCloseEx ( UnitTest::TestResults& results, 
     100                               Expected const& expected, 
     101                               Actual const& actual, 
     102                               Tolerance const& tolerance, 
     103                               UnitTest::TestDetails const& details ) { 
     104        if ( !UnitTest::AreClose ( expected, actual, tolerance ) ) { 
     105            UnitTest::MemoryOutStream stream; 
     106            stream << format_context() << "expected " << expected << " +/- " << tolerance << " but was " << actual; 
    107107 
    108                         results.OnTestFailure ( details, stream.GetText() ); 
    109                 } 
    110         } 
     108            results.OnTestFailure ( details, stream.GetText() ); 
     109        } 
     110    } 
    111111}; 
    112112