summaryrefslogtreecommitdiff
path: root/test/common
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2007-05-02 12:15:40 +0000
committerChris Wilson <chris+github@qwirx.com>2007-05-02 12:15:40 +0000
commitd5b75f603a0c4df8fcdd78b6930b744bd95c9ba6 (patch)
tree1a033c8ffe87ef1fd63e77754a98971b29fcd1cc /test/common
parent55ce748d246a63f0f57b2b132ef9c8f4ee748309 (diff)
Fix running common tests in release mode, by not doing things that
crash in release mode, but assert in debug mode. (refs #3)
Diffstat (limited to 'test/common')
-rw-r--r--test/common/testcommon.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/test/common/testcommon.cpp b/test/common/testcommon.cpp
index 19c83d2d..0477509a 100644
--- a/test/common/testcommon.cpp
+++ b/test/common/testcommon.cpp
@@ -296,25 +296,37 @@ int test(int argc, const char *argv[])
Timers::Cleanup();
// Check that using timer methods without initialisation
- // throws an exception
- TEST_CHECK_THROWS(Timers::Add(*(Timer*)NULL),
- CommonException, AssertFailed);
- TEST_CHECK_THROWS(Timers::Remove(*(Timer*)NULL),
- CommonException, AssertFailed);
+ // throws an assertion failure. Can only do this in debug mode
+ #ifndef NDEBUG
+ TEST_CHECK_THROWS(Timers::Add(*(Timer*)NULL),
+ CommonException, AssertFailed);
+ TEST_CHECK_THROWS(Timers::Remove(*(Timer*)NULL),
+ CommonException, AssertFailed);
+ #endif
+
// TEST_CHECK_THROWS(Timers::Signal(), CommonException, AssertFailed);
- TEST_CHECK_THROWS(Timers::Cleanup(), CommonException, AssertFailed);
+ #ifndef NDEBUG
+ TEST_CHECK_THROWS(Timers::Cleanup(), CommonException,
+ AssertFailed);
+ #endif
// Check that we can initialise the timers
Timers::Init();
// Check that double initialisation throws an exception
- TEST_CHECK_THROWS(Timers::Init(), CommonException, AssertFailed);
+ #ifndef NDEBUG
+ TEST_CHECK_THROWS(Timers::Init(), CommonException,
+ AssertFailed);
+ #endif
// Check that we can clean up the timers
Timers::Cleanup();
// Check that double cleanup throws an exception
- TEST_CHECK_THROWS(Timers::Cleanup(), CommonException, AssertFailed);
+ #ifndef NDEBUG
+ TEST_CHECK_THROWS(Timers::Cleanup(), CommonException,
+ AssertFailed);
+ #endif
Timers::Init();