From 82feef9f070b5ac8a3973e61a03c751fb55743d8 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 17 Nov 2012 18:07:29 +0000 Subject: Use more efficient direct reset of Timers instead of assignment. --- test/common/testcommon.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'test/common') diff --git a/test/common/testcommon.cpp b/test/common/testcommon.cpp index 53ee7588..f47a0dba 100644 --- a/test/common/testcommon.cpp +++ b/test/common/testcommon.cpp @@ -352,12 +352,14 @@ int test(int argc, const char *argv[]) TEST_THAT(t1.HasExpired()); TEST_THAT(t2.HasExpired()); TEST_THAT(!t3.HasExpired()); - + + // Try both ways of resetting an existing timer. t1 = Timer(1000, "t1a"); - t2 = Timer(2000, "t2a"); + t2.Reset(2000); TEST_THAT(!t0.HasExpired()); TEST_THAT(!t1.HasExpired()); TEST_THAT(!t2.HasExpired()); + TEST_THAT(!t3.HasExpired()); safe_sleep(1); TEST_THAT(!t0.HasExpired()); @@ -365,6 +367,12 @@ int test(int argc, const char *argv[]) TEST_THAT(!t2.HasExpired()); TEST_THAT(t3.HasExpired()); + safe_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. -- cgit v1.2.3