1 module Repr.String.Test where
4 import Test.Tasty.HUnit
6 import Language.LOL.Symantic.Repr
7 import qualified Expr.Lambda.Test as Lambda.Test
8 import qualified Expr.Bool.Test as Bool.Test
11 tests = testGroup "String" $
12 let (==>) expr expected =
15 string_from_expr expr in
17 [ Bool.Test.e1 ==> "True & False"
18 , Bool.Test.e2 ==> "True & False | True & True"
19 , Bool.Test.e3 ==> "(True | False) & (True | True)"
20 , Bool.Test.e4 ==> "True & !False"
21 , Bool.Test.e5 ==> "True & !x"
22 , Bool.Test.e6 ==> "(x | y) & !(x & y)"
23 , Bool.Test.e7 ==> "((x | y) & !(x & y) | z) & !(((x | y) & !(x & y)) & z)"
24 , Bool.Test.e8 ==> "(x | (y | True) & !(y & True)) & !(x & ((y | True) & !(y & True)))"
27 [ Lambda.Test.e1 ==> "\\x0 -> (\\x1 -> (x0 | x1) & !(x0 & x1))"
28 , Lambda.Test.e2 ==> "\\x0 -> (\\x1 -> x0 & !x1 | !x0 & x1)"
29 , Lambda.Test.e3 ==> "let x0 = True in x0 & x0"
30 , Lambda.Test.e4 ==> "let x0 = \\x1 -> x1 & x1 in x0 True"
31 , Lambda.Test.e5 ==> "\\x0 -> (\\x1 -> x0 & x1)"
32 , Lambda.Test.e6 ==> "(let x0 = True in x0) & False"
33 , Lambda.Test.e7 ==> "\\x0 -> x0 True & True"
34 , Lambda.Test.e8 ==> "\\x0 -> x0 (True & True)"
37 [ If.e1 ==> "if True then False else True"
38 , If.e2 ==> "if True & True then False else True"