Changeset 2220

Show
Ignore:
Timestamp:
06/08/2008 19:25:48 (5 months ago)
Author:
chris
Message:

Fix conflict with local variables called "line".

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • box/trunk/test/bbackupd/testbbackupd.cpp

    r2216 r2220  
    8282 
    8383// utility macro for comparing two strings in a line 
    84 #define TEST_EQUAL(expected, found, line) \ 
     84#define TEST_EQUAL(_expected, _found, _line) \ 
    8585{ \ 
    8686        std::ostringstream _oss1; \ 
    87         _oss1 << expected; \ 
    88         std::string exp_str = _oss1.str(); \ 
     87        _oss1 << _expected; \ 
     88        std::string _exp_str = _oss1.str(); \ 
    8989        \ 
    9090        std::ostringstream _oss2; \ 
    91         _oss2 << found; \ 
    92         std::string found_str = _oss2.str(); \ 
     91        _oss2 << _found; \ 
     92        std::string _found_str = _oss2.str(); \ 
    9393        \ 
    94         if(exp_str != found_str) \ 
     94        if(_exp_str != _found_str) \ 
    9595        { \ 
    96                 std::string _line = line; \ 
     96                std::string _line_str = _line; \ 
    9797                printf("Expected <%s> but found <%s> in <%s>\n", \ 
    98                         exp_str.c_str(), found_str.c_str(), _line.c_str()); \ 
    99                 TEST_FAIL_WITH_MESSAGE(#found " != " #expected " in " line); \ 
     98                        _exp_str.c_str(), _found_str.c_str(), _line_str.c_str()); \ 
     99                \ 
     100                std::ostringstream _oss3; \ 
     101                _oss3 << #_found << " != " << #_expected << " in " << _line; \ 
     102                \ 
     103                TEST_FAIL_WITH_MESSAGE(_oss3.str().c_str()); \ 
    100104        } \ 
    101105} 
    102106 
    103107// utility macro for testing a line 
    104 #define TEST_LINE(condition, line) \ 
    105         TEST_THAT(condition); \ 
    106         if (!(condition)) \ 
     108#define TEST_LINE(_condition, _line) \ 
     109        TEST_THAT(_condition); \ 
     110        if (!(_condition)) \ 
    107111        { \ 
    108                 printf("Test failed on <%s>\n", line.c_str()); \ 
     112                printf("Test failed on <%s>\n", _line.c_str()); \ 
    109113        } 
    110114