File: e0.hs

package info (click to toggle)
haskell-quickcheck-simple 0.1.1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 68 kB
  • sloc: haskell: 173; makefile: 4
file content (68 lines) | stat: -rw-r--r-- 1,116 bytes parent folder | download | duplicates (3)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

import Test.QuickCheck.Simple
import System.IO.Error

boolTQ :: Test
boolTQ = boolTest "true" True

boolTV :: Test
boolTV = boolTest' "true-verbose" "verbose true" True

boolFQ :: Test
boolFQ = boolTest "false" False

boolFV :: Test
boolFV = boolTest' "false-verbose" "verbose false error message" False

eqTQ :: Test
eqTQ = eqTest "eq" 1 (1 :: Int)

eqTV :: Test
eqTV = eqTest' (==) show "eq-verbose" 1 (1 :: Int)

eqFQ :: Test
eqFQ = eqTest "neq" 2 (1 :: Int)

eqFV :: Test
eqFV = eqTest' (==) show "neq-verbose" 2 (1 :: Int)

qcT :: Test
qcT = qcTest "qc-true" (\x -> (x :: Int) == x)

qcF :: Test
qcF = qcTest "qc-false" (\x -> (x :: Int) == x + 1)

successTests :: [Test]
successTests =
  [ boolTQ
  , boolTV
  , eqTQ
  , eqTV
  , qcT
  ]

allTests :: [Test]
allTests =
  [ boolTQ
  , boolTV
  , boolFQ
  , boolFV
  , eqTQ
  , eqTV
  , eqFQ
  , eqFV
  , qcT
  , qcF
  ]

putLine :: IO ()
putLine = putStrLn "\n------------------------------\n"

main :: IO ()
main = do
  verboseMain successTests
  putLine
  _ <- tryIOError $ defaultMain allTests
  putLine
  _ <- tryIOError $ verboseMain allTests
  return ()