about summary refs log tree commit diff
path: root/users/grfn/xanthous/test/Xanthous/Game
diff options
context:
space:
mode:
Diffstat (limited to 'users/grfn/xanthous/test/Xanthous/Game')
-rw-r--r--users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs b/users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs
new file mode 100644
index 000000000000..3267d8ef9e9c
--- /dev/null
+++ b/users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs
@@ -0,0 +1,25 @@
+--------------------------------------------------------------------------------
+module Xanthous.Game.StateSpec (main, test) where
+--------------------------------------------------------------------------------
+import           Test.Prelude
+--------------------------------------------------------------------------------
+import           Xanthous.Game.State
+import           Xanthous.Entities.Raws (raws, entityFromRaw)
+--------------------------------------------------------------------------------
+
+main :: IO ()
+main = defaultMain test
+
+test :: TestTree
+test = testGroup "Xanthous.Game.StateSpec"
+  [ testGroup "entityTypeName"
+    [ testCase "for a creature" $
+        let gormlakRaw = raws ^?! ix "gormlak"
+            creature = entityFromRaw gormlakRaw
+        in entityTypeName creature @?= "Creature"
+    , testCase "for an item" $
+        let stickRaw = raws ^?! ix "stick"
+            item = entityFromRaw stickRaw
+        in entityTypeName item @?= "Item"
+    ]
+  ]