From 37b832ca965c7bf72b17b19d28c44ca269422c16 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 26 Mar 2019 13:30:53 +0800 Subject: [PATCH] test/test_weighted_shuffle: enlarge epsilon be more permissive to address the following failure: test_weighted_shuffle.cc:36: Failure The difference between float(w) / total_weight and float(f.front()) / samples is 0.010334432125091553, which exceeds epsilon, where float(w) / total_weight evaluates to 0.53763443231582642, float(f.front()) / samples evaluates to 0.52730000019073486, and epsilon evaluates to 0.0099999997764825821 Signed-off-by: Kefu Chai --- src/test/test_weighted_shuffle.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/test_weighted_shuffle.cc b/src/test/test_weighted_shuffle.cc index 7e881134a7f..f920329c09e 100644 --- a/src/test/test_weighted_shuffle.cc +++ b/src/test/test_weighted_shuffle.cc @@ -27,7 +27,7 @@ TEST(WeightedShuffle, Basic) { // verify that the probability that the nth choice is selected as the first // one is the nth weight divided by the sum of all weights const auto total_weight = std::accumulate(weights.begin(), weights.end(), 0); - constexpr float epsilon = 0.01; + constexpr float epsilon = 0.02; for (unsigned i = 0; i < choices.size(); i++) { const auto& f = frequency[choices[i]]; const auto& w = weights[i]; -- 2.39.5