diff options
author | Griffin Smith <root@gws.fyi> | 2019-10-06T16·50-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-10-06T16·50-0400 |
commit | de8052cef8a9f749cdb2312a4f5ae5f5a44cf1b8 (patch) | |
tree | 734d38ad7279b0188b46f67e0288c5efddab7f8e /test/Xanthous | |
parent | 262fc7fb41f14181ed34cecfcca9ef2d25102688 (diff) |
Allow eating edible items
Add menu support to the prompt system, and an "Eat" command that prompts for an item to eat and eats the item the character specifies, restoring an amount of hitpoints configurable via the item raw type.
Diffstat (limited to 'test/Xanthous')
-rw-r--r-- | test/Xanthous/UtilSpec.hs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Xanthous/UtilSpec.hs b/test/Xanthous/UtilSpec.hs new file mode 100644 index 000000000000..1cfca1ffca76 --- /dev/null +++ b/test/Xanthous/UtilSpec.hs @@ -0,0 +1,24 @@ +module Xanthous.UtilSpec (main, test) where + +import Test.Prelude +import Xanthous.Util + +main :: IO () +main = defaultMain test + +test :: TestTree +test = testGroup "Xanthous.Util" + [ testGroup "smallestNotIn" + [ testCase "examples" $ do + smallestNotIn [7 :: Word, 3, 7] @?= 0 + smallestNotIn [7 :: Word, 0, 1, 3, 7] @?= 2 + , testProperty "returns an element not in the list" $ \(xs :: [Word]) -> + smallestNotIn xs `notElem` xs + , testProperty "pred return is in the list" $ \(xs :: [Word]) -> + let res = smallestNotIn xs + in res /= 0 ==> pred res `elem` xs + , testProperty "ignores order" $ \(xs :: [Word]) -> + forAll (shuffle xs) $ \shuffledXs -> + smallestNotIn xs === smallestNotIn shuffledXs + ] + ] |