Browse Source

Start looking at testing.

tags/0.1.0.0
Thomas Kerber 1 year ago
parent
commit
4d4ec0b2a3
Signed by: tk <tk@drwx.org> GPG Key ID: 8489B911F9ED617B
3 changed files with 35 additions and 0 deletions
  1. +18
    -0
      tests/ExecTests.hs
  2. +6
    -0
      tests/Spec.hs
  3. +11
    -0
      yggdrasil.cabal

+ 18
- 0
tests/ExecTests.hs View File

@@ -0,0 +1,18 @@
{-# LANGUAGE ScopedTypeVariables #-}

module ExecTests (spec) where

import System.Random
import Test.Hspec
import Test.Hspec.QuickCheck
import Yggdrasil.ExecutionModel
import Yggdrasil.SimpleState

run' :: RandomGen g => g -> Action SimpleState b -> (Maybe b, g)
run' = run

spec :: Spec
spec = do
describe "action" $ do
prop "obeys return" $ \i (x::String) ->
fst (run' (mkStdGen i) (return x)) == Just x

+ 6
- 0
tests/Spec.hs View File

@@ -0,0 +1,6 @@
import Test.Hspec

import qualified ExecTests

main :: IO ()
main = hspec ExecTests.spec

+ 11
- 0
yggdrasil.cabal View File

@@ -23,3 +23,14 @@ library
build-depends: random, base >=4.11 && <4.12
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall -Werror

test-suite spec
type: exitcode-stdio-1.0
other-extensions: ScopedTypeVariables
default-language: Haskell2010
hs-source-dirs: tests
ghc-options: -Wall -Werror
main-is: Spec.hs
other-modules: ExecTests
build-depends: random, base, hspec, QuickCheck, yggdrasil

Loading…
Cancel
Save