on 284ca80 help sign in
41 lines 1.5 kB history raw
1module Test.TypeRep.Vector where
3import Prelude hiding (lookup)
5import Data.Functor.Identity (Identity (..))
7import Test.Tasty.Hspec
9import Data.TypeRep.Vector
11-- Simple test for 'lookup', 'insert' and 'size' functions.
12spec_insertLookup :: Spec
13spec_insertLookup = do
14 describe "Lookup Test" $ do
15 it "returns the inserted element" $
16 lookup (fromList [TF (Identity 'a')]) `shouldBe` Just (Identity 'a')
17 it "returns the second inserted value of the same type" $
18 lookup (fromList [TF (Identity 'b'), TF (Identity 'a')]) `shouldBe` Just (Identity 'b')
20-- describe "Size Test" $ do
21-- it "is empty" $
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
29--
30--
31-- mapOf10 :: TypeRepMap Identity
32-- mapOf10 = 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