Changeset 2705
- Timestamp:
- 27/08/2010 10:20:30 (18 months ago)
- File:
-
- 1 edited
-
box/trunk/lib/common/Test.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/lib/common/Test.h
r2677 r2705 52 52 53 53 // NOTE: The 0- bit is to allow this to work with stuff which has negative constants for flags (eg ConnectionException) 54 #define TEST_CHECK_THROWS(statement, excepttype, subtype) \55 { \56 bool didthrow = false; \54 #define TEST_CHECK_THROWS(statement, excepttype, subtype) \ 55 { \ 56 bool didthrow = false; \ 57 57 HideExceptionMessageGuard hide; \ 58 try \59 { \60 statement; \61 } \62 catch(excepttype &e) \63 { \64 if(e.GetSubType() != ((unsigned int)excepttype::subtype) \65 && e.GetSubType() != (unsigned int)(0-excepttype::subtype)) \66 { \67 throw; \68 } \69 didthrow = true; \70 } \71 catch(...) \72 { \73 throw; \74 } \75 if(!didthrow) \76 { \77 TEST_FAIL_WITH_MESSAGE("Didn't throw exception " #excepttype "(" #subtype ")") \78 } \58 try \ 59 { \ 60 statement; \ 61 } \ 62 catch(excepttype &e) \ 63 { \ 64 if(e.GetSubType() != ((unsigned int)excepttype::subtype) \ 65 && e.GetSubType() != (unsigned int)(0-excepttype::subtype)) \ 66 { \ 67 throw; \ 68 } \ 69 didthrow = true; \ 70 } \ 71 catch(...) \ 72 { \ 73 throw; \ 74 } \ 75 if(!didthrow) \ 76 { \ 77 TEST_FAIL_WITH_MESSAGE("Didn't throw exception " #excepttype "(" #subtype ")") \ 78 } \ 79 79 } 80 80 … … 92 92 if(_exp_str != _found_str) \ 93 93 { \ 94 BOX_WARNING("Expected <" << _exp_str << "> but found <" <<\95 _ found_str << ">"); \94 printf("Expected <%s> but found <%s>\n", \ 95 _exp_str.c_str(), _found_str.c_str()); \ 96 96 \ 97 97 std::ostringstream _oss3; \ … … 127 127 } \ 128 128 } 129 130 129 131 130 // utility macro for testing a line
Note: See TracChangeset
for help on using the changeset viewer.
