File: Simple.hs

package info (click to toggle)
haskell-quickcheck 2.14.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 424 kB
  • sloc: haskell: 4,919; sh: 32; makefile: 5
file content (46 lines) | stat: -rw-r--r-- 1,274 bytes parent folder | download | duplicates (4)
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.