[Box Backup-commit] COMMIT r1641 - box/chris/general/test/common
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Wed, 09 May 2007 11:33:48 +0100
Author: chris
Date: 2007-05-09 11:33:48 +0100 (Wed, 09 May 2007)
New Revision: 1641
Modified:
box/chris/general/test/common/testcommon.cpp
Log:
Fix running common tests in release mode, by not doing things that
crash in release mode, but assert in debug mode. (merges [1625])
Modified: box/chris/general/test/common/testcommon.cpp
===================================================================
--- box/chris/general/test/common/testcommon.cpp 2007-05-09 10:33:04 UTC (rev 1640)
+++ box/chris/general/test/common/testcommon.cpp 2007-05-09 10:33:48 UTC (rev 1641)
@@ -296,25 +296,37 @@
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();