commit4a167a9458d747edc5e22ab1b31fcf18174c1c0aparent918a241c6a13aa8e1f49f2b25cfe07c0d7ad7aecAuthor:Jared Tobin <jared@jtobin.io>Date:Thu, 21 May 2020 20:29:13 +0400 Increase error tolerance. It's desirable that these tests, which should be loose sanity checks, not fail too often. I'm comfortable using three standard errors rather than two.Diffstat:

M | test/Spec.hs | | | 20 | +++++++++++--------- |

1 file changed, 11 insertions(+), 9 deletions(-)diff --git a/test/Spec.hs b/test/Spec.hs@@ -117,21 +117,23 @@ testSamples xs = describe "sampled trace over exp(1)" $ do let meanStdErr = stdErr xs varStdErr = stdErr (fmap (\x -> pred x ** 2.0) xs) - it "has the expected mean" $ do - mean xs `shouldSatisfy` (< 1 + 2 * meanStdErr) - mean xs `shouldSatisfy` (> 1 - 2 * meanStdErr) + context "within three standard errors" $ do + it "has the expected mean" $ do + mean xs `shouldSatisfy` (< 1 + 3 * meanStdErr) + mean xs `shouldSatisfy` (> 1 - 3 * meanStdErr) - it "has the expected variance" $ do - variance xs `shouldSatisfy` (< 1 + 2 * varStdErr) - variance xs `shouldSatisfy` (> 1 - 2 * varStdErr) + it "has the expected variance" $ do + variance xs `shouldSatisfy` (< 1 + 3 * varStdErr) + variance xs `shouldSatisfy` (> 1 - 3 * varStdErr) testTunables :: [Double] -> SpecWith () testTunables ts = describe "sampled tunables over exp(1)" $ do let meanStdErr = stdErr ts - it "has the expected third moment (i.e. 6)" $ do - mean ts `shouldSatisfy` (< 6 + 2 * meanStdErr) - mean ts `shouldSatisfy` (> 6 - 2 * meanStdErr) + context "within three standard errors" $ + it "has the expected third moment" $ do + mean ts `shouldSatisfy` (< 6 + 3 * meanStdErr) + mean ts `shouldSatisfy` (> 6 - 3 * meanStdErr) main :: IO () main = do