-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathExample.hs
28 lines (22 loc) · 912 Bytes
/
Example.hs
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
------------------------------------------------------------------------------
-- | An example testing module for cabal-test-quickcheck. The `test-module` of
-- a test-suite must export a 'tests' definition.
module Example (tests) where
import Distribution.TestSuite.QuickCheck
------------------------------------------------------------------------------
-- | The root definition of the tests. Must be of type 'IO [Test]'.
tests :: IO [Test]
tests = return
[ testProperty "Succeeds" True
, testProperty "Fails" False
, mayFail
]
------------------------------------------------------------------------------
-- | A list of tests can be grouped together into a single test.
mayFail :: Test
mayFail = testGroup "May fail"
[ testProperty "Maybe fails" neqNegation
, testProperty "Probably fails" (not . neqNegation)
]
neqNegation :: Int -> Bool
neqNegation x = x /= -x