1. Bryan O'Sullivan
  2. statistics

Commits

Aleksey Khudyakov  committed 8b9acb4

Better error reporting for test case

  • Participants
  • Parent commits c1c8057
  • Branches default

Comments (0)

Files changed (1)

File tests/Tests/Distribution.hs

View file
 -- CDF for discrete distribution uses <= for comparison
 cdfDiscreteIsCorrect :: (DiscreteDistr d) => T d -> d -> Property
 cdfDiscreteIsCorrect _ d
-  = printTestCase (unlines $ map show badN)
+  = printTestCase (unlines badN)
   $ null badN  
   where
     -- We are checking that:
     -- Apporixmate equality is tricky here. Scale is set by maximum
     -- value of CDF and probability. Case when all proabilities are
     -- zero should be trated specially.
-    badN = [ (i,p,p1,dp, (p1-p-dp) / max p1 dp)
+    badN = [ printf "N=%3i    p[i]=%g\tp[i+1]=%g\tdP=%g\trelerr=%g" i p p1 dp ((p1-p-dp) / max p1 dp)
            | i <- [0 .. 100]
            , let p      = cumulative d $ fromIntegral i - 1e-6
                  p1     = cumulative d $ fromIntegral i