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