commit 8e6988762e1bd59ba77eb6e778b2517588b7c425
parent a56d5903fa9265a374583fffddc95473dcbb9d4a
Author: Jared Tobin <jared@jtobin.io>
Date: Tue, 10 Sep 2019 14:07:23 -0230
tests: add property test
Tests that tail inverts feis over a 32-bit input space.
Diffstat:
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/test/Ob.hs b/test/Ob.hs
@@ -2,6 +2,7 @@ module Main where
import qualified Ob.Tests.Small as S
import qualified Ob.Tests.Med as M
+import qualified Ob.Tests.Property as P
import Test.Hspec
main :: IO ()
@@ -9,3 +10,4 @@ main =
hspec $ do
context "small input space" S.tests
context "medium input space" M.tests
+ context "32-bit input space" P.tests
diff --git a/test/Ob/Tests/Property.hs b/test/Ob/Tests/Property.hs
@@ -0,0 +1,16 @@
+
+module Ob.Tests.Property (
+ tests
+ ) where
+
+import Test.Hspec
+import Test.Hspec.Core.QuickCheck (modifyMaxSuccess)
+import Test.QuickCheck
+import qualified Urbit.Ob.Ob as Ob
+
+tests :: Spec
+tests =
+ describe "tail" $
+ modifyMaxSuccess (const 1000) $
+ it "inverts feis" $
+ property $ \x -> Ob.tail (Ob.feis x) == x
diff --git a/urbit-hob.cabal b/urbit-hob.cabal
@@ -71,11 +71,14 @@ Test-suite ob
other-modules:
Ob.Tests.Small
Ob.Tests.Med
+ Ob.Tests.Property
default-language: Haskell2010
ghc-options:
-rtsopts
build-depends:
base
, hspec
+ , hspec-core
+ , QuickCheck
, urbit-hob