Revision: 4933
Author: [email protected]
Date: Thu Jun 24 01:57:24 2010
Log: Make SampleRateCalculator test resilient to float precision issues.

Tested with kSamplingIntervalMs values 2 and 4.

Review URL: http://codereview.chromium.org/2811021
http://code.google.com/p/v8/source/detail?r=4933

Modified:
 /branches/bleeding_edge/test/cctest/test-profile-generator.cc

=======================================
--- /branches/bleeding_edge/test/cctest/test-profile-generator.cc Tue Jun 8 04:27:00 2010 +++ /branches/bleeding_edge/test/cctest/test-profile-generator.cc Thu Jun 24 01:57:24 2010
@@ -653,7 +653,7 @@
   time += SampleRateCalculator::kWallTimeQueryIntervalMs * 0.75;
   calc2.UpdateMeasurements(time);
   // (1.0 + 2.0 + 2.0) / 3
-  CHECK_EQ(kSamplingIntervalMs * 1.66666, calc2.ticks_per_ms());
+  CHECK_EQ(kSamplingIntervalMs * 5.0, round(calc2.ticks_per_ms() * 3.0));

   SampleRateCalculator calc3;
   time = 0.0;
@@ -667,7 +667,7 @@
   time += SampleRateCalculator::kWallTimeQueryIntervalMs * 1.5;
   calc3.UpdateMeasurements(time);
   // (1.0 + 0.5 + 0.5) / 3
-  CHECK_EQ(kSamplingIntervalMs * 0.66666, calc3.ticks_per_ms());
+  CHECK_EQ(kSamplingIntervalMs * 2.0, round(calc3.ticks_per_ms() * 3.0));
 }


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to