Document the Semigroup for Map
[packages/containers.git] / tests / intset-strictness.hs
1 module Main (main) where
2
3 import Prelude hiding (foldl)
4
5 import Test.ChasingBottoms.IsBottom
6 import Test.Framework (Test, defaultMain, testGroup)
7 import Test.Framework.Providers.QuickCheck2 (testProperty)
8
9 import Data.IntSet
10
11 ------------------------------------------------------------------------
12 -- * Properties
13
14 ------------------------------------------------------------------------
15 -- ** Lazy module
16
17 pFoldlAccLazy :: Int -> Bool
18 pFoldlAccLazy k =
19 isn'tBottom $ foldl (\_ x -> x) (bottom :: Int) (singleton k)
20
21 ------------------------------------------------------------------------
22 -- * Test list
23
24 tests :: [Test]
25 tests =
26 [
27 -- Basic interface
28 testGroup "IntSet"
29 [ testProperty "foldl is lazy in accumulator" pFoldlAccLazy
30 ]
31 ]
32
33 ------------------------------------------------------------------------
34 -- * Test harness
35
36 main :: IO ()
37 main = defaultMain tests
38
39 ------------------------------------------------------------------------
40 -- * Utilities
41
42 isn'tBottom :: a -> Bool
43 isn'tBottom = not . isBottom