about summary refs log tree commit diff
path: root/users/grfn/xanthous/test
diff options
context:
space:
mode:
Diffstat (limited to 'users/grfn/xanthous/test')
-rw-r--r--users/grfn/xanthous/test/Spec.hs2
-rw-r--r--users/grfn/xanthous/test/Xanthous/Entities/RawTypesSpec.hs28
2 files changed, 30 insertions, 0 deletions
diff --git a/users/grfn/xanthous/test/Spec.hs b/users/grfn/xanthous/test/Spec.hs
index c8b0ef0079f7..80826053866a 100644
--- a/users/grfn/xanthous/test/Spec.hs
+++ b/users/grfn/xanthous/test/Spec.hs
@@ -10,6 +10,7 @@ import qualified Xanthous.Data.MemoSpec
 import qualified Xanthous.Data.NestedMapSpec
 import qualified Xanthous.DataSpec
 import qualified Xanthous.Entities.RawsSpec
+import qualified Xanthous.Entities.RawTypesSpec
 import qualified Xanthous.Entities.CharacterSpec
 import qualified Xanthous.GameSpec
 import qualified Xanthous.Game.StateSpec
@@ -39,6 +40,7 @@ test = testGroup "Xanthous"
   , Xanthous.DataSpec.test
   , Xanthous.Entities.RawsSpec.test
   , Xanthous.Entities.CharacterSpec.test
+  , Xanthous.Entities.RawTypesSpec.test
   , Xanthous.GameSpec.test
   , Xanthous.Game.StateSpec.test
   , Xanthous.Game.PromptSpec.test
diff --git a/users/grfn/xanthous/test/Xanthous/Entities/RawTypesSpec.hs b/users/grfn/xanthous/test/Xanthous/Entities/RawTypesSpec.hs
new file mode 100644
index 000000000000..f5feb8a506db
--- /dev/null
+++ b/users/grfn/xanthous/test/Xanthous/Entities/RawTypesSpec.hs
@@ -0,0 +1,28 @@
+--------------------------------------------------------------------------------
+module Xanthous.Entities.RawTypesSpec (main, test) where
+--------------------------------------------------------------------------------
+import           Test.Prelude
+--------------------------------------------------------------------------------
+import           Xanthous.Entities.RawTypes
+--------------------------------------------------------------------------------
+
+main :: IO ()
+main = defaultMain test
+
+test :: TestTree
+test = testGroup "Xanthous.Entities.RawTypesSpec"
+  [ testGroup "CreatureGenerateParams"
+    [ testBatch $ monoid @CreatureGenerateParams mempty
+    , testGroup "canGenerate"
+      [ testProperty "no bounds" $ \level ->
+          let gps = CreatureGenerateParams Nothing Nothing
+          in canGenerate level gps
+      , testProperty "min bound" $ \level minB ->
+          let gps = CreatureGenerateParams (Just minB) Nothing
+          in canGenerate level gps === (level >= minB)
+      , testProperty "max bound" $ \level maxB ->
+          let gps = CreatureGenerateParams Nothing (Just maxB)
+          in canGenerate level gps === (level <= maxB)
+      ]
+    ]
+  ]