More lenient double comparison for RunningStatistics.FullSimpleTest

The test was failing (in a flaky fashion, interestingly), comparing:
* 50.5 whose mantissa is:
1001010000000000000000000000000000000000000000000000
* with 50.500000000000036 whose mantissa is:
1001010000000000000000000000000000000000000000000101

since EXPECT_DOUBLE_EQ() only allows 4 ULPs difference.
We don't need this kind of precision.

Bug: webrtc:11134
Change-Id: I811178b0762dbcd61d4f2d3f047ea0b59847fa57
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165761
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Yves Gerey <yvesg@google.com>
Cr-Commit-Position: refs/heads/master@{#30230}
This commit is contained in:
Yves Gerey
2020-01-13 10:09:10 +01:00
committed by Commit Bot
parent 53cd9e2645
commit 54891af88d

View File

@ -62,7 +62,8 @@ TEST(RunningStatistics, FullSimpleTest) {
EXPECT_DOUBLE_EQ(*stats.GetMin(), 1.0);
EXPECT_DOUBLE_EQ(*stats.GetMax(), 100.0);
EXPECT_DOUBLE_EQ(*stats.GetMean(), 50.5);
// EXPECT_DOUBLE_EQ is too strict (max 4 ULP) for this one.
ASSERT_NEAR(*stats.GetMean(), 50.5, 1e-10);
}
TEST(RunningStatistics, VarianceAndDeviation) {