[Box Backup-commit] COMMIT r1625 - box/chris/merge/test/common

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Wed May 2 13:15:40 BST 2007


Author: chris
Date: 2007-05-02 13:15:40 +0100 (Wed, 02 May 2007)
New Revision: 1625

Modified:
   box/chris/merge/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. (refs #3)


Modified: box/chris/merge/test/common/testcommon.cpp
===================================================================
--- box/chris/merge/test/common/testcommon.cpp	2007-05-02 10:24:45 UTC (rev 1624)
+++ box/chris/merge/test/common/testcommon.cpp	2007-05-02 12:15:40 UTC (rev 1625)
@@ -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();
 




More information about the Boxbackup-commit mailing list