about summary refs log tree commit diff
path: root/test/Xanthous/GameSpec.hs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-11-30T20·00-0500
committerGriffin Smith <root@gws.fyi>2019-11-30T20·00-0500
commit97a5c61f28ba98728bab390e0ea745edfbea7103 (patch)
tree25304c30990cffb5756f44c79542edf9dd2e5ac6 /test/Xanthous/GameSpec.hs
parent310ea90985adcb6d9efe2ab05c67a235c2fb0ea2 (diff)
Fix an injectivity issue with saving the game
Fix an injectivity issue with JSON-encoding the entity map that was
causing the game saving to not properly round-trip. As part of this,
there's a refactor to the internals of the entity map to use sets
instead of vectors, which should also get us a nice perf boost.
Diffstat (limited to 'test/Xanthous/GameSpec.hs')
-rw-r--r--test/Xanthous/GameSpec.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/Xanthous/GameSpec.hs b/test/Xanthous/GameSpec.hs
index 75e9f6215a..2fa8527d0e 100644
--- a/test/Xanthous/GameSpec.hs
+++ b/test/Xanthous/GameSpec.hs
@@ -46,6 +46,8 @@ test
     ]
   , testGroup "Saving the game"
     [ testProperty "forms a prism" $ isPrism saved
+    , testProperty "round-trips" $ \gs ->
+        loadGame (saveGame gs) === Just gs
     , testProperty "preserves the character ID" $ \gs ->
         let Just gs' = loadGame $ saveGame gs
         in gs' ^. character === gs ^. character