{-# LANGUAGE NoMonomorphismRestriction #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
module Lib.Test where

import Test.Tasty

import Prelude hiding ((&&), not, (||), (==), id)

import Language.Symantic
import Language.Symantic.Lib

import qualified Lib.Applicative.Test as Applicative
import qualified Lib.Bool.Test as Bool
import qualified Lib.Foldable.Test as Foldable
import qualified Lib.Functor.Test as Functor
import qualified Lib.Map.Test as Map
import qualified Lib.MonoFunctor.Test as MonoFunctor
import qualified Lib.Num.Test as Num
import qualified Lib.Tuple2.Test as Tuple2

-- * Tests
tests :: TestTree
tests = testGroup "Lib" $
 [ Applicative.tests
 , Bool.tests
 , Foldable.tests
 , Functor.tests
 , Map.tests
 , MonoFunctor.tests
 , Num.tests
 , Tuple2.tests
 ]

-- * EDSL tests
te1 = lam $ \x -> lam $ \y -> (x || y) && not (x && y)
te2 = lam $ \x -> lam $ \y -> (x && not y) || (not x && y)
te3 = let_ (bool True) $ \x -> x && x
te4 = let_ (lam $ \x -> x && x) $ \f -> f `app` bool True
te5 = lam $ \x0 -> lam $ \x1 -> x0 && x1
te6 = let_ (bool True) id && bool False
te7 = lam $ \f -> (f  `app` bool True) && bool True
te8 = lam $ \f -> f `app` (bool True && bool True)