diff options
Diffstat (limited to 'users/grfn/xanthous/test')
-rw-r--r-- | users/grfn/xanthous/test/Spec.hs | 2 | ||||
-rw-r--r-- | users/grfn/xanthous/test/Xanthous/Game/StateSpec.hs | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/users/grfn/xanthous/test/Spec.hs b/users/grfn/xanthous/test/Spec.hs index e71434863902..46e82c8c6c6b 100644 --- a/users/grfn/xanthous/test/Spec.hs +++ b/users/grfn/xanthous/test/Spec.hs @@ -11,6 +11,7 @@ import qualified Xanthous.Data.NestedMapSpec import qualified Xanthous.DataSpec import qualified Xanthous.Entities.RawsSpec import qualified Xanthous.GameSpec +import qualified Xanthous.Game.StateSpec import qualified Xanthous.Generators.Level.UtilSpec import qualified Xanthous.MessageSpec import qualified Xanthous.Messages.TemplateSpec @@ -36,6 +37,7 @@ test = testGroup "Xanthous" , Xanthous.DataSpec.test , Xanthous.Entities.RawsSpec.test , Xanthous.GameSpec.test + , Xanthous.Game.StateSpec.test , Xanthous.Generators.Level.UtilSpec.test , Xanthous.MessageSpec.test , Xanthous.Messages.TemplateSpec.test 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" + ] + ] |