1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
{-# LANGUAGE ScopedTypeVariables, TemplateHaskell #-}
module Main where
--------------------------------------------------------------------------
-- imports
import Test.QuickCheck
--------------------------------------------------------------------------
-- example 1
allEqual x y z = x == y && y == z
allEqual' x y z = 2*x == y + z
prop_SimonThompson x y (z :: Int) =
allEqual x y z == allEqual' x y z
--------------------------------------------------------------------------
-- example 2
prop_ReverseReverse :: Eq a => [a] -> Bool
prop_ReverseReverse xs =
reverse (reverse xs) == xs
prop_Reverse xs =
reverse xs == xs
--------------------------------------------------------------------------
-- example 3
prop_Error (x,y) =
2*x <= 5*y
--------------------------------------------------------------------------
-- main
return []
prop_conj = counterexample "Simon Thompson" $(monomorphic 'prop_SimonThompson) .&&.
counterexample "reverse" $(monomorphic 'prop_Reverse)
prop_disj = counterexample "reverse" $(monomorphic 'prop_Reverse) .||.
counterexample "Simon Thompson" $(monomorphic 'prop_SimonThompson)
return []
main = $quickCheckAll
--------------------------------------------------------------------------
-- the end.
|