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

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Mon Nov 13 15:15:23 GMT 2006


Author: chris
Date: 2006-11-13 15:15:23 +0000 (Mon, 13 Nov 2006)
New Revision: 1145

Modified:
   box/chris/merge/test/common/testcommon.cpp
Log:
Added tests for timers with zero interval, which should never expire 
(refs #9)


Modified: box/chris/merge/test/common/testcommon.cpp
===================================================================
--- box/chris/merge/test/common/testcommon.cpp	2006-11-13 15:13:58 UTC (rev 1144)
+++ box/chris/merge/test/common/testcommon.cpp	2006-11-13 15:15:23 UTC (rev 1145)
@@ -244,34 +244,43 @@
 
 	Timers::Init();
 
+	Timer t0(0); // should never expire
 	Timer t1(1);
 	Timer t2(2);
 	Timer t3(3);
 	
+	TEST_THAT(!t0.HasExpired());
 	TEST_THAT(!t1.HasExpired());
 	TEST_THAT(!t2.HasExpired());
 	TEST_THAT(!t3.HasExpired());
 	
 	sleep(1);
+	TEST_THAT(!t0.HasExpired());
 	TEST_THAT(t1.HasExpired());
 	TEST_THAT(!t2.HasExpired());
 	TEST_THAT(!t3.HasExpired());
 	
 	sleep(1);
+	TEST_THAT(!t0.HasExpired());
 	TEST_THAT(t1.HasExpired());
 	TEST_THAT(t2.HasExpired());
 	TEST_THAT(!t3.HasExpired());
 	
 	t1 = Timer(1);
 	t2 = Timer(2);
+	TEST_THAT(!t0.HasExpired());
 	TEST_THAT(!t1.HasExpired());
 	TEST_THAT(!t2.HasExpired());
 	
 	sleep(1);
+	TEST_THAT(!t0.HasExpired());
 	TEST_THAT(t1.HasExpired());
 	TEST_THAT(!t2.HasExpired());
 	TEST_THAT(t3.HasExpired());
 
+	// Leave timers initialised for rest of test.
+	// Test main() will cleanup after test finishes.
+
 	static char *testfilelines[] =
 	{
 		"First line",




More information about the Boxbackup-commit mailing list