Make SampleRateCalculator test resilient to float precision issues.

Tested with kSamplingIntervalMs values 2 and 4.

Review URL: http://codereview.chromium.org/2811021

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4933 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 251b1c5f
......@@ -653,7 +653,7 @@ TEST(SampleRateCalculator) {
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 @@ TEST(SampleRateCalculator) {
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));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment