← Back to team overview

nrtb-core team mailing list archive

[Branch ~fpstovall/nrtb/cpp_common] Rev 31: Revised the timer unit tests to run faster, 1.1 seconds vs. the earlier 6.5. There was no loss of...

 

------------------------------------------------------------
revno: 31
committer: fpstovall@xxxxxxxxx
branch nick: dev
timestamp: Thu 2011-07-21 05:54:03 -0400
message:
  Revised the timer unit tests to run faster, 1.1 seconds vs. the earlier 6.5. There was no loss of test accuracy.
modified:
  common/timer/timer_test.cpp


--
lp:~fpstovall/nrtb/cpp_common
https://code.launchpad.net/~fpstovall/nrtb/cpp_common

Your team NRTB Core is subscribed to branch lp:~fpstovall/nrtb/cpp_common.
To unsubscribe from this branch go to https://code.launchpad.net/~fpstovall/nrtb/cpp_common/+edit-subscription
=== modified file 'common/timer/timer_test.cpp'
--- common/timer/timer_test.cpp	2011-07-19 00:26:10 +0000
+++ common/timer/timer_test.cpp	2011-07-21 09:54:03 +0000
@@ -33,20 +33,20 @@
 	{
 	  overall.start();
 	  interval.start();
-	  cout << "sleep 1 second" << endl;
-	  sleep(1);
+	  cout << "sleep 0.1 second" << endl;
+	  usleep(1e5);
 	  cout << overall.interval() << " | " << interval.stop() << " (stop)" << endl;
 	  cout << "sleep 3 seconds" << endl;
-	  sleep(3);
+	  usleep(3e5);
 	  cout << overall.interval() << " | " << interval.stop() << " (start)" << endl;	
 	  interval.start();
 	  cout << "sleep 2 seconds" << endl;
-	  sleep(2);
+	  usleep(2e5);
 	  cout << overall.interval() << " | " << interval.stop() << " (reset)" << endl;
 	  interval.reset();
 	  interval.start();
 	  cout << "sleep 500000 useconds" << endl;
-	  usleep(500000);
+	  usleep(5e5);
 	  cout << overall.interval() << " | " << interval.stop() << endl;
 	  // test the advanced formationg function
 	  interval.start(109472.34);
@@ -55,7 +55,7 @@
 		  << interval.interval_as_HMS(true)
 		  << "\" or \"" << interval.interval_as_HMS() << "\"" << endl;
 	  cout << "Total run time: " << overall.stop() << " seconds." << endl;
-	  if ((overall.interval() < 6.5) or (overall.interval() > 6.503))
+	  if ((overall.interval() < 1.1) or (overall.interval() > 1.102))
 	  {
 		cerr << "Measured runtime " 
 		  << overall.interval()