diff --git a/test/test.hs b/test/test.hs index 6fa7112..c46f87f 100644 --- a/test/test.hs +++ b/test/test.hs @@ -97,9 +97,12 @@ propertyTests = , testGroup "'changeDepth' tests" changeDepthTests ] +propTrue = PropertyTrue Nothing +propFalse = PropertyFalse Nothing + simplePropertyTests = [ testCase "Forall/no" $ check (\x -> (x^2 :: Integer) >= 2) - @?= Just (CounterExample ["0"] PropertyFalse) + @?= Just (CounterExample ["0"] propFalse) , testCase "Forall/yes" $ check (\x -> (x^2 :: Integer) >= 0) @?= Nothing @@ -114,7 +117,7 @@ simplePropertyTests = @?= Just NotExist , testCase "ExistsUnique/isn't unique" $ check (existsUnique $ \x -> (x^2 :: Integer) > 0) - @?= Just (AtLeastTwo ["1"] PropertyTrue ["-1"] PropertyTrue) + @?= Just (AtLeastTwo ["1"] propTrue ["-1"] propTrue) , testCase "ExistsUnique/yes" $ check (existsUnique $ \x -> (x^2 :: Integer) < 0) @?= Just NotExist @@ -122,7 +125,7 @@ simplePropertyTests = combinedPropertyTests = [ testCase "Forall+Forall/no" $ check (\x y -> x /= (y+2 :: Integer)) - @?= Just (CounterExample ["0","-2"] PropertyFalse) + @?= Just (CounterExample ["0","-2"] propFalse) , testCase "Forall+Exists/no" $ check (\x -> x > 0 ==> exists $ \y -> x == (y^2 :: Integer)) @?= Just (CounterExample ["2"] NotExist) @@ -146,7 +149,7 @@ combinedPropertyTests = @?= Just NotExist , testCase "ExistsUnique (two vars)/isn't unique" $ check (existsUnique $ \x y -> abs x == (abs y :: Integer)) - @?= Just (AtLeastTwo ["0","0"] PropertyTrue ["1","1"] PropertyTrue) + @?= Just (AtLeastTwo ["0","0"] propTrue ["1","1"] propTrue) , testCase "ExistsUnique+ExistsUnique/yes" $ check (existsUnique $ \x -> existsUnique $ \y -> abs x == (abs y :: Integer)) @@ -155,7 +158,7 @@ combinedPropertyTests = freshContexts = [ testCase "==>" $ check (existsUnique $ \x -> (\y -> x * y >= 0) ==> (\y -> x * y == (0 :: Integer))) - @?= Just (AtLeastTwo ["0"] PropertyTrue ["1"] (Vacuously (CounterExample ["-1"] PropertyFalse))) + @?= Just (AtLeastTwo ["0"] propTrue ["1"] (Vacuously (CounterExample ["-1"] propFalse))) , testCase "test" $ check (exists $ \x -> test $ \y -> x == (y :: Bool)) @?= Nothing , testCase "monadic" $ check (exists $ \x -> monadic . return $ \y -> x == (y :: Bool)) @@ -166,7 +169,7 @@ overTests = [ testCase "over+Forall/yes" $ check (over odds odd) @?= Nothing , testCase "over+Forall/no" $ check (over odds (<3)) - @?= Just (CounterExample ["3"] PropertyFalse) + @?= Just (CounterExample ["3"] propFalse) , testCase "over+Exists/yes" $ check (exists $ over odds (>3)) @?= Nothing , testCase "over+Exists/no" $ check (exists $ over odds even) @@ -174,7 +177,7 @@ overTests = , testCase "over+Exists/no" $ check (exists $ over odds even) @?= Just NotExist , testCase "ExistsUnique+ExistsUnique/isn't unique" $ check (existsUnique $ over series $ \x -> over series $ \y -> abs x == (abs y :: Integer)) - @?= Just (AtLeastTwo ["0","0"] PropertyTrue ["1","1"] PropertyTrue) + @?= Just (AtLeastTwo ["0","0"] propTrue ["1","1"] propTrue) ] where odds :: Monad m => Series m Integer