From 580e37ff64b47f46cbafe39e448847320295f591 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 6 Nov 2021 12:15:01 -0400 Subject: refactor(gs/xanthous): Use a Word for the level number 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 Tested-by: BuildkiteCI --- users/grfn/xanthous/test/Xanthous/Data/LevelsSpec.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'users/grfn/xanthous/test/Xanthous') 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 -- cgit 1.4.1