Skip to content

Commit

Permalink
[ test ] Support filtration and transformations during distr checks
Browse files Browse the repository at this point in the history
  • Loading branch information
buzden committed Jan 27, 2025
1 parent d74b558 commit 90520e8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/lib/distribution/_common/DistrCheckCommon.idr
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ find (x::xs) = case force xs of
[] => Just x
xs => if all isOk x then Just x else assert_total $ find xs

verdict : Vect n (CoverageTest a) -> Gen em a -> Maybe $ Vect n SignificantBounds
verdict conds = find . mapMaybe sequence .
checkCoverageConditions conds . unGenTryN 10000000 someStdGen
verdict : (a -> Maybe b) -> Vect n (CoverageTest b) -> Gen em a -> Maybe $ Vect n SignificantBounds
verdict f conds = find . mapMaybe sequence . checkCoverageConditions conds . mapMaybe f . unGenTryN 10000000 someStdGen

Show SignificantBounds where show = interpolate

export
printVerdict' : HasIO m => (a -> Maybe b) -> Gen em a -> Vect n (CoverageTest b) -> m ()
printVerdict' mapper = putStrLn .: show .: flip (verdict mapper)

export %inline
printVerdict : HasIO m => Gen em a -> Vect n (CoverageTest a) -> m ()
printVerdict = putStrLn .: show .: flip verdict
printVerdict = printVerdict' Just

0 comments on commit 90520e8

Please sign in to comment.