Skip to content

Commit

Permalink
constrained-generators: fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximilianAlgehed committed Oct 29, 2024
1 parent f085f29 commit 9461512
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libs/constrained-generators/src/Constrained/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3354,14 +3354,18 @@ genFromFold (nub -> must) (simplifySpec -> size) elemS fn foldS =
let elemS' = mapSpec fn elemS
mustVal = adds @fn (map (sem fn) must)
foldS' = propagateSpecFun (theAddFn @fn) (HOLE :? Value mustVal :> Nil) foldS
sizeSpec' = propagateSpecFun (addFn @fn) (HOLE :? Value (sizeOf must) :> Nil) size
m <- getMode
when (isErrorLike sizeSpec') $ genError1 "Inconsistent size spec"
results0 <-
withMode Loose $
( withMode m $
-- TODO: this is not the best solution to this problem, we need
-- to use the size information in `genList` instead
suchThatWithTryT
1000
10
(genList (simplifySpec elemS') (simplifySpec foldS'))
(\xs -> (sizeOf must + sizeOf xs) `conformsToSpec` size)
(\xs -> sizeOf xs `conformsToSpec` sizeSpec')
)
results <-
explain
Expand Down

0 comments on commit 9461512

Please sign in to comment.