]> Git — Sourcephile - haskell/symantic.git/blob - TFHOE/Repr/String/Test.hs
init
[haskell/symantic.git] / TFHOE / Repr / String / Test.hs
1 module Repr.String.Test where
2
3 import Test.Tasty
4 import Test.Tasty.HUnit
5
6 import TFHOE.Repr
7 import qualified Expr.Fun.Test as Fun.Test
8 import qualified Expr.Bool.Test as Bool.Test
9
10 tests :: TestTree
11 tests = testGroup "String" $
12 let (==>) expr expected =
13 testCase expected $
14 string_repr expr @?=
15 expected
16 in
17 [ testGroup "Bool"
18 [ Bool.Test.e1 ==> "True & False"
19 , Bool.Test.e2 ==> "True & False | True & True"
20 , Bool.Test.e3 ==> "(True | False) & (True | True)"
21 , Bool.Test.e4 ==> "True & !False"
22 , Bool.Test.e5 ==> "True & !x"
23 , Bool.Test.e6 ==> "(x | y) & !(x & y)"
24 , Bool.Test.e7 ==> "((x | y) & !(x & y) | z) & !(((x | y) & !(x & y)) & z)"
25 , Bool.Test.e8 ==> "(x | (y | True) & !(y & True)) & !(x & ((y | True) & !(y & True)))"
26 ]
27 , testGroup "Fun"
28 [ Fun.Test.e1 ==> "\\x0 -> (\\x1 -> (x0 | x1) & !(x0 & x1))"
29 , Fun.Test.e2 ==> "\\x0 -> (\\x1 -> x0 & !x1 | !x0 & x1)"
30 , Fun.Test.e3 ==> "let x0 = True in x0 & x0"
31 , Fun.Test.e4 ==> "let x0 = \\x1 -> x1 & x1 in x0 True"
32 , Fun.Test.e5 ==> "\\x0 -> (\\x1 -> x0 & x1)"
33 , Fun.Test.e6 ==> "(let x0 = True in x0) & False"
34 , Fun.Test.e7 ==> "\\x0 -> x0 True & True"
35 , Fun.Test.e8 ==> "\\x0 -> x0 (True & True)"
36 ]
37 {-, testGroup "If"
38 [ If.e1 ==> "if True then False else True"
39 , If.e2 ==> "if True & True then False else True"
40 ]
41 -}]
42
43