]>
git.saurik.com Git - wxWidgets.git/blob - tests/testprec.h
2 #include "wx/cppunit.h"
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
10 // thrown when assert fails in debug build
11 class TestAssertFailure
{ };
13 // macro to use for the functions which are supposed to fail an assertion
15 // some old cppunit versions don't define CPPUNIT_ASSERT_THROW so roll our
17 #define WX_ASSERT_FAILS_WITH_ASSERT(cond) \
19 bool throwsAssert = false; \
21 catch ( const TestAssertFailure& ) { throwsAssert = true; } \
22 if ( !throwsAssert ) \
23 CPPUNIT_FAIL("expected assertion not generated"); \
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))