]> Git — Sourcephile - haskell/symantic.git/blob - symantic-lib/Language/Symantic/Lib/Map/Test.hs
Add replicate.
[haskell/symantic.git] / symantic-lib / Language / Symantic / Lib / Map / Test.hs
1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 module Lib.Map.Test where
3
4 import Test.Tasty
5
6 import Data.Map.Strict (Map)
7 import Data.Proxy (Proxy(..))
8 import Data.Text as Text
9 import Prelude hiding (zipWith)
10 import qualified Data.Map.Strict as Map
11
12 import Language.Symantic.Lib
13 import Compiling.Test
14
15 type SS =
16 [ Proxy (->)
17 , Proxy []
18 , Proxy Int
19 , Proxy Integer
20 , Proxy Map
21 , Proxy Char
22 , Proxy (,)
23 , Proxy Num
24 , Proxy Monoid
25 ]
26 (==>) = test_readTerm @() @SS
27
28 tests :: TestTree
29 tests = testGroup "Map"
30 [ "Map.fromList (zipWith (,) [1, 2, 3] ['a', 'b', 'c'])" ==> Right
31 ( tyMap tyInteger tyChar
32 , Map.fromList [(1, 'a'), (2, 'b'), (3, 'c')]
33 , "Map.fromList (zipWith (\\x0 -> (\\x1 -> (x0, x1))) (1 : 2 : 3 : []) ('a' : 'b' : 'c' : []))" )
34 , Text.concat
35 [ "Map.foldrWithKey"
36 , " (\\(k:Integer) (v:Char) (acc:(Integer,[Char])) ->"
37 , " (k + fst acc, v : snd acc))"
38 , " (0, [])"
39 , " (Map.fromList (zipWith (,) [1, 2, 3] ['a', 'b', 'c']))"
40 ] ==> Right
41 ( tyInteger `tyTuple2` tyString
42 , (6, "abc")
43 , "Map.foldrWithKey (\\x0 -> (\\x1 -> (\\x2 -> (x0 + fst x2, x1 : snd x2)))) (0, []) (Map.fromList (zipWith (\\x0 -> (\\x1 -> (x0, x1))) (1 : 2 : 3 : []) ('a' : 'b' : 'c' : [])))" )
44 ]