]> Git — Sourcephile - haskell/symantic.git/blob - symantic-lib/Language/Symantic/Lib/Test.hs
Backtrack (try) the grammar only when necessary to get better error messages.
[haskell/symantic.git] / symantic-lib / Language / Symantic / Lib / Test.hs
1 {-# LANGUAGE NoMonomorphismRestriction #-}
2 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
3 module Lib.Test where
4
5 import Test.Tasty
6
7 import Language.Symantic.Lib
8
9 import qualified Lib.Applicative.Test as Applicative
10 import qualified Lib.Bool.Test as Bool
11 import qualified Lib.Foldable.Test as Foldable
12 import qualified Lib.Functor.Test as Functor
13 import qualified Lib.Map.Test as Map
14 import qualified Lib.MonoFunctor.Test as MonoFunctor
15 import qualified Lib.Num.Test as Num
16 import qualified Lib.Tuple2.Test as Tuple2
17
18 import Prelude hiding ((&&), not, (||), (==), id)
19
20 -- * Tests
21 tests :: TestTree
22 tests = testGroup "Lib" $
23 [ Applicative.tests
24 , Bool.tests
25 , Foldable.tests
26 , Functor.tests
27 , Map.tests
28 , MonoFunctor.tests
29 , Num.tests
30 , Tuple2.tests
31 ]
32
33 -- * EDSL tests
34 te1 = lam $ \x -> lam $ \y -> (x || y) && not (x && y)
35 te2 = lam $ \x -> lam $ \y -> (x && not y) || (not x && y)
36 te3 = let_ (bool True) $ \x -> x && x
37 te4 = let_ (lam $ \x -> x && x) $ \f -> f .$ bool True
38 te5 = lam $ \x0 -> lam $ \x1 -> x0 && x1
39 te6 = let_ (bool True) id && bool False
40 te7 = lam $ \f -> (f .$ bool True) && bool True
41 te8 = lam $ \f -> f .$ (bool True && bool True)