diff options
author | Griffin Smith <grfn@gws.fyi> | 2021-11-06T16·15-0400 |
---|---|---|
committer | grfn <grfn@gws.fyi> | 2021-11-06T17·34+0000 |
commit | 580e37ff64b47f46cbafe39e448847320295f591 (patch) | |
tree | 558756464c48b657974a769cbdc72d05fdd82f78 /users/grfn/xanthous/test/Xanthous | |
parent | e0bec49b39313751c44c0b36026828cedfa5ae8d (diff) |
refactor(gs/xanthous): Use a Word for the level number r/3010
Using a signed Int here is a little silly, since we can never have negative levels. Change-Id: Ibe03be5014226e07dfa6f78d8360301bc1b7c9b1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3803 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'users/grfn/xanthous/test/Xanthous')
-rw-r--r-- | users/grfn/xanthous/test/Xanthous/Data/LevelsSpec.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/users/grfn/xanthous/test/Xanthous/Data/LevelsSpec.hs b/users/grfn/xanthous/test/Xanthous/Data/LevelsSpec.hs index 4e46946a93b0..a7528331627d 100644 --- a/users/grfn/xanthous/test/Xanthous/Data/LevelsSpec.hs +++ b/users/grfn/xanthous/test/Xanthous/Data/LevelsSpec.hs @@ -33,13 +33,13 @@ test = testGroup "Xanthous.Data.Levels" === pos levels + 1 , testProperty "maintains the invariant" $ \(levels :: Levels Int) genned -> let levels' = runIdentity . nextLevel (Identity genned) $ levels - in between 0 (length levels') $ pos levels' + in between 0 (toEnum $ length levels') $ pos 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 + let levels' = seek (toEnum $ length levels - 1) levels levels'' = runIdentity . nextLevel (Identity genned) $ levels' in counterexample (show levels'') $ extract levels'' === genned @@ -52,7 +52,7 @@ test = testGroup "Xanthous.Data.Levels" , testProperty "maintains the invariant" $ \(levels :: Levels Int) -> case prevLevel levels of Nothing -> property Discard - Just levels' -> property $ between 0 (length levels') $ pos levels' + Just levels' -> property $ between 0 (toEnum $ length levels') $ pos levels' , testProperty "extract is total" $ \(levels :: Levels Int) -> case prevLevel levels of Nothing -> property Discard |