Skip to content

Commit

Permalink
found another bug!
Browse files Browse the repository at this point in the history
[no ci]
  • Loading branch information
MaximilianAlgehed committed May 7, 2024
1 parent b4b1e9c commit 1a1c35e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libs/constrained-generators/src/Constrained/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2773,6 +2773,10 @@ guardSumSpec s@(SumSpec sa sb)

data SumSpec fn a b = SumSpec (Specification fn a) (Specification fn b)

instance (Arbitrary (Specification fn a), Arbitrary (Specification fn b)) => Arbitrary (SumSpec fn a b) where
arbitrary = SumSpec <$> arbitrary <*> arbitrary
shrink (SumSpec a b) = uncurry SumSpec <$> shrink (a, b)

instance (HasSpec fn a, HasSpec fn b) => Semigroup (SumSpec fn a b) where
SumSpec sa sb <> SumSpec sa' sb' = SumSpec (sa <> sa') (sb <> sb')

Expand Down
4 changes: 4 additions & 0 deletions libs/constrained-generators/src/Constrained/Properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
module Constrained.Properties where

import Data.Map (Map)
import Data.Set (Set)
import Data.Typeable
import Constrained.Base
import Constrained.List
Expand Down Expand Up @@ -151,6 +152,9 @@ instance (fn ~ BaseFn) => QC.Arbitrary (TestableFn fn) where
arbitrary = QC.elements [ TestableFn $ addFn @fn @Int
, TestableFn $ negateFn @fn @Int
, TestableFn $ sizeOfFn @fn @(Map Int Int)
, TestableFn $ memberFn @fn @(Set Int)
, TestableFn $ notFn @fn
, TestableFn $ disjointFn @fn @(Set Int)
]

prop_mapSpec ::
Expand Down

0 comments on commit 1a1c35e

Please sign in to comment.