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