about summary refs log tree commit diff
path: root/users/grfn/xanthous/test/Xanthous/Entities/RawTypesSpec.hs
blob: f5feb8a506db417f244f3347608574f7341a3a3e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
      ]
    ]
  ]