]> Git — Sourcephile - haskell/symantic.git/blob - TFHOE/Type/Test.hs
init
[haskell/symantic.git] / TFHOE / Type / Test.hs
1 {-# LANGUAGE ScopedTypeVariables #-}
2 module Type.Test where
3
4 import Test.Tasty
5 import Test.Tasty.HUnit
6
7 import TFHOE.Raw
8 import TFHOE.Type
9
10 tests :: TestTree
11 tests = testGroup "Type" $
12 let (==>) raw expected =
13 testCase (show raw) $
14 type_from raw (Right . Exists_Type) @?=
15 Right (Exists_Type expected) in
16 [ Raw "->" [Raw "Bool" [], Raw "Bool" []]
17 ==> (Type_Fun_Next Type_Bool `Type_Fun` Type_Fun_Next Type_Bool
18 :: Type_Fun_Bool_End repr (repr Bool -> repr Bool))
19 , Raw "Bool" []
20 ==> (Type_Fun_Next Type_Bool
21 :: Type_Fun_Bool_End repr Bool)
22 , Raw "Int" []
23 ==> (Type_Fun_Next (Type_Bool_Next Type_Int)
24 :: Type_Fun_Bool_Int_End repr Int)
25 , Raw "->" [Raw "Bool" [], Raw "Int" []]
26 ==> (Type_Fun_Next Type_Bool `Type_Fun` Type_Fun_Next (Type_Bool_Next Type_Int)
27 :: Type_Fun_Bool_Int_End repr (repr Bool -> repr Int))
28 ]