mirror of
https://github.com/lexi-lambda/freer-simple.git
synced 2024-12-25 07:02:20 +03:00
e5f8304db9
And rearrange a few things somewhat, including rewriting the loop tests almost entirely. Addresses #5
52 lines
1.5 KiB
Haskell
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
|
|
]
|