]>
Commit | Line | Data |
---|---|---|
8899b155 RN |
1 | #include "wx/wxprec.h" |
2 | #include "wx/cppunit.h" | |
8da7a00a VZ |
3 | |
4 | // define wxHAVE_U_ESCAPE if the compiler supports \uxxxx character constants | |
5 | #if (defined(__VISUALC__) && (__VISUALC__ >= 1300)) || \ | |
6 | (defined(__GNUC__) && (__GNUC__ >= 3)) | |
7 | #define wxHAVE_U_ESCAPE | |
8 | #endif | |
0468a58a VZ |
9 | |
10 | // thrown when assert fails in debug build | |
11 | class TestAssertFailure { }; | |
12 | ||
13 | // macro to use for the functions which are supposed to fail an assertion | |
14 | #ifdef __WXDEBUG__ | |
15 | // some old cppunit versions don't define CPPUNIT_ASSERT_THROW so roll our | |
16 | // own | |
17 | #define WX_ASSERT_FAILS_WITH_ASSERT(cond) \ | |
18 | { \ | |
19 | bool throwsAssert = false; \ | |
20 | try { cond ; } \ | |
21 | catch ( const TestAssertFailure& ) { throwsAssert = true; } \ | |
22 | if ( !throwsAssert ) \ | |
23 | CPPUNIT_FAIL("expected assertion not generated"); \ | |
24 | } | |
25 | #else | |
26 | // there are no assertions in non-debug build so just check that it fails | |
27 | #define WX_ASSERT_FAILS_WITH_ASSERT(cond) CPPUNIT_ASSERT(!(cond)) | |
28 | #endif | |
29 |