1module Test.TypeRep.CMap where
3import Prelude hiding (lookup)
5import Data.Functor.Identity (Identity (..))
9import Data.TypeRep.CMap
11-- Simple test for 'lookup', 'insert' and 'size' functions.
12spec_insertLookup :: Spec
14 describe "Lookup Test" $ do
15 it "returns the inserted element" $
16 lookup (insert (Identity 'a') empty) `shouldBe` Just (Identity 'a')
17 it "returns the second inserted value of the same type" $
18 lookup (insert (Identity 'b') $ insert (Identity 'a') empty) `shouldBe` Just (Identity 'b')
20 describe "Size Test" $ do
22 size empty `shouldBe` 0
23 it "is of size 1 when 1 element inserted" $
24 size (insert (Identity 'a') empty) `shouldBe` 1
25 it "doesn't increase size when element of the same type is added" $
26 size (insert (Identity 'b') $ insert (Identity 'a') empty) `shouldBe` 1
27 it "returns 10 when 10 different types are inserted" $
28 size mapOf10 `shouldBe` 10
31mapOf10 :: TypeRepMap Identity
32mapOf10 = insert (Identity True)
33 $ insert (Identity [True, False])
34 $ insert (Identity $ Just True)
35 $ insert (Identity $ Just ())
36 $ insert (Identity [()])
37 $ insert (Identity ())
38 $ insert (Identity "aaa")
39 $ insert (Identity $ Just 'a')
40 $ insert (Identity 'a')
41 $ insert (Identity (11 :: Int)) empty
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list