Skip to content

Commit 3b9124c

Browse files
authored
fix:Fix the random prop_sampleM test failure (#186)
by using a 99.99% confidence interval on a Bernoulli distribution. Since quickCheck already runs 100 tests, this aims for 1/10000, which corresponds to z-score of 3.89. Should fix the random CI failure in the prop_sampleM test.
1 parent 4c6dfb9 commit 3b9124c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/Monad.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ prop_sampleM df = monadic' $ do
2222
let finalRowCount = D.nRows finalDf
2323
let realRate = roundToTwoPlaces $ fromIntegral finalRowCount / fromIntegral rowCount
2424
let diff = abs $ expectedRate - realRate
25-
assert (diff <= 0.11)
25+
-- calculates the 99.99% confidence interval (quickcheck runs 100 tests, aim for 1/10000)
26+
let tolerance = 3.89 * sqrt (expectedRate * (1 - expectedRate) / fromIntegral rowCount)
27+
assert (diff <= tolerance)
2628

2729
tests = [prop_sampleM]

0 commit comments

Comments
 (0)