]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/test_weighted_shuffle: enlarge epsilon 27181/head
authorKefu Chai <kchai@redhat.com>
Tue, 26 Mar 2019 05:30:53 +0000 (13:30 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 26 Mar 2019 05:30:55 +0000 (13:30 +0800)
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 <kchai@redhat.com>
src/test/test_weighted_shuffle.cc

index 7e881134a7f783a9688c886837371136c4d45d14..f920329c09ef7a1e5108219ff925db637c2b2f64 100644 (file)
@@ -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];