Skip to content

Commit

Permalink
Revert "use require.InEpsilonf"
Browse files Browse the repository at this point in the history
This reverts commit 96bf2ea.
  • Loading branch information
feitian124 committed Oct 5, 2021
1 parent 96bf2ea commit b39f8d0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions statistics/sample_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ func SubTestWeightedSampling() func(*testing.T) {
require.Nil(t, rs.Close())
}
expFrequency := float64(sampleNum) * float64(loopCnt) / float64(rowNum)
delta := 0.5
for _, cnt := range itemCnt {
require.InEpsilonf(t, expFrequency, float64(cnt), 0.5, "The frequency %v is exceed the Chernoff Bound", cnt)
if float64(cnt) < expFrequency/(1+delta) || float64(cnt) > expFrequency*(1+delta) {
require.Truef(t, false, "The frequency %v is exceed the Chernoff Bound", cnt)
}
}
}
}
Expand Down Expand Up @@ -136,8 +139,11 @@ func SubTestDistributedWeightedSampling() func(*testing.T) {
}
}
expFrequency := float64(sampleNum) * float64(loopCnt) / float64(rowNum)
delta := 0.5
for _, cnt := range itemCnt {
require.InEpsilonf(t, expFrequency, float64(cnt), 0.5, "The frequency %v is exceed the Chernoff Bound", cnt)
if float64(cnt) < expFrequency/(1+delta) || float64(cnt) > expFrequency*(1+delta) {
require.Truef(t, false, "the frequency %v is exceed the Chernoff Bound", cnt)
}
}
}
}
Expand Down

0 comments on commit b39f8d0

Please sign in to comment.