]> Git — Sourcephile - comptalang.git/blob - cli/Hcompta/Trans/Bool/Const/Test.hs
Gather into Writeable instances.
[comptalang.git] / cli / Hcompta / Trans / Bool / Const / Test.hs
1 {-# LANGUAGE OverloadedStrings #-}
2 {-# OPTIONS_GHC -fno-warn-orphans #-}
3
4 module Trans.Bool.Const.Test where
5
6 import Data.Function (($))
7 import qualified Data.Text.Lazy as Text
8 import Data.Text.Lazy.Builder as Build
9 import Test.Tasty
10 import Test.Tasty.HUnit
11
12 import qualified Expr.Bool.Test as Bool
13 import qualified Repr.Text.Write.Test ()
14 import Hcompta.Repr
15 import Hcompta.Trans
16
17 tests :: TestTree
18 tests = testGroup "Const" $
19 let (==>) expr expected =
20 testCase (Text.unpack expected) $
21 Build.toLazyText (repr_text_write $ trans_bool_const expr) @?=
22 expected
23 in
24 [ Bool.e1 ==> "False"
25 , Bool.e2 ==> "True"
26 , Bool.e3 ==> "True"
27 , Bool.e4 ==> "True"
28 , Bool.e5 ==> "!x"
29 , Bool.e6 ==> "(x | y) & !(x & y)"
30 , Bool.e7 ==> "((x | y) & !(x & y) | z) & !(((x | y) & !(x & y)) & z)"
31 , Bool.e8 ==> "(x | !y) & !(x & !y)"
32 ]
33