about summary refs log tree commit diff
path: root/test/Xanthous/Data/LevelsSpec.hs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2020-01-20T15·31-0500
committerGriffin Smith <root@gws.fyi>2020-01-20T15·31-0500
commit72edcff32307ffebda07d350634792cc86b268bb (patch)
tree46ea73be1b22c58bc07e8e9d6fc60f1f74c33a17 /test/Xanthous/Data/LevelsSpec.hs
parentd62aba218d1996b2c0541553c182313cfcc9843d (diff)
Put new levels at the right position in the list
New levels need to go at the *end* of the list of levels, not the
beginning - otherwise we jump to the proper position on the new level
but the current level stays the same (oops).
Diffstat (limited to 'test/Xanthous/Data/LevelsSpec.hs')
-rw-r--r--test/Xanthous/Data/LevelsSpec.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/Xanthous/Data/LevelsSpec.hs b/test/Xanthous/Data/LevelsSpec.hs
index 49d3719b1272..4e46946a93b0 100644
--- a/test/Xanthous/Data/LevelsSpec.hs
+++ b/test/Xanthous/Data/LevelsSpec.hs
@@ -37,6 +37,12 @@ test = testGroup "Xanthous.Data.Levels"
       , testProperty "extract is total" $ \(levels :: Levels Int) genned ->
           let levels' = runIdentity . nextLevel (Identity genned) $ levels
           in total $ extract levels'
+      , testProperty "uses the generated level as the next level"
+        $ \(levels :: Levels Int) genned ->
+          let levels' = seek (length levels - 1) levels
+              levels'' = runIdentity . nextLevel (Identity genned) $ levels'
+          in counterexample (show levels'')
+             $ extract levels'' === genned
       ]
     , testGroup "prevLevel"
       [ testProperty "seeks backwards" $ \(levels :: Levels Int) ->