freer-simple/tests/Tests.hs
Tomas Janousek e5f8304db9 Use NoImplicitPrelude in tests
And rearrange a few things somewhat, including rewriting the loop tests
almost entirely.

Addresses #5
2017-03-15 14:19:35 +01:00

52 lines
1.5 KiB
Haskell

{-# LANGUAGE NoImplicitPrelude #-}
module Main where
import Prelude ((+))
import Control.Applicative ((<$>), (<*>), pure)
import Data.Eq ((==))
import Data.Function (($))
import Data.Int (Int)
import System.IO (IO)
import Test.Tasty (TestTree, testGroup, defaultMain)
import Test.Tasty.QuickCheck (testProperty)
import Control.Monad.Freer (run)
import qualified Tests.Coroutine (tests)
import qualified Tests.Exception (tests)
import qualified Tests.Fresh (tests)
import qualified Tests.NonDet (tests)
import qualified Tests.Reader (tests)
import qualified Tests.State (tests)
import qualified Tests.Loop (tests)
--------------------------------------------------------------------------------
-- Pure Tests --
--------------------------------------------------------------------------------
addInEff :: Int -> Int -> Int
addInEff x y = run ((+) <$> pure x <*> pure y)
pureTests :: TestTree
pureTests = testGroup "Pure Eff tests"
[ testProperty "Pure run just works: (+)"
(\x y -> addInEff x y == x + y)
]
--------------------------------------------------------------------------------
-- Runner --
--------------------------------------------------------------------------------
main :: IO ()
main = defaultMain $ testGroup "Tests"
[ pureTests
, Tests.Coroutine.tests
, Tests.Exception.tests
, Tests.Fresh.tests
, Tests.NonDet.tests
, Tests.Reader.tests
, Tests.State.tests
, Tests.Loop.tests
]