diff options
author | Griffin Smith <root@gws.fyi> | 2019-10-05T20·18-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-10-05T20·25-0400 |
commit | 5c6ba40019ea23660cfab80864593b398567f223 (patch) | |
tree | 003487a59c9925f87ffc74a762b66872a9dc54c4 /test/Xanthous/GameSpec.hs | |
parent | 272ff5b3e606cd95aedaa4889ff38906c0e0bf03 (diff) |
Display multiple messages per turn
When tracking message history, save messages associated with the turn they were displayed on, which allows us to have the notion of the "current turn's" messages (provided via a MonoComonad instance).
Diffstat (limited to 'test/Xanthous/GameSpec.hs')
-rw-r--r-- | test/Xanthous/GameSpec.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/Xanthous/GameSpec.hs b/test/Xanthous/GameSpec.hs index 32faae03d7a9..af98c7f6ccd2 100644 --- a/test/Xanthous/GameSpec.hs +++ b/test/Xanthous/GameSpec.hs @@ -30,4 +30,16 @@ test = testGroup "Xanthous.Game" , testGroup "character" [ testProperty "lens laws" $ isLens character ] + , localOption (QuickCheckTests 10) + $ testGroup "MessageHistory" + [ testGroup "MonoComonad laws" + [ testProperty "oextend oextract ≡ id" + $ \(mh :: MessageHistory) -> oextend oextract mh === mh + , testProperty "oextract ∘ oextend f ≡ f" + $ \(mh :: MessageHistory) f -> (oextract . oextend f) mh === f mh + , testProperty "oextend f ∘ oextend g ≡ oextend (f . oextend g)" + $ \(mh :: MessageHistory) f g -> + (oextend f . oextend g) mh === oextend (f . oextend g) mh + ] + ] ] |