From e9213e6d0d94e386462939dfadf7967394af009c Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 21 Nov 2013 12:45:29 -0400 Subject: better Arbitrary instance for FileSelector This ensures any file in the repo is chosen, not only one of the first 20. --- Git/Destroyer.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Git/Destroyer.hs b/Git/Destroyer.hs index aae1e9e..a208576 100644 --- a/Git/Destroyer.hs +++ b/Git/Destroyer.hs @@ -47,7 +47,7 @@ instance Arbitrary DamageAction where , AppendGarbage <$> garbage , PrependGarbage <$> garbage , CorruptByte - <$> nonNegative arbitrarySizedIntegral + <$> nonNegative arbitraryBoundedIntegral <*> arbitrary , ScrambleFileMode <$> nonNegative arbitrarySizedIntegral ] @@ -61,7 +61,7 @@ data FileSelector = FileSelector Int deriving (Read, Show) instance Arbitrary FileSelector where - arbitrary = FileSelector <$> nonNegative arbitrarySizedIntegral + arbitrary = FileSelector <$> nonNegative arbitraryBoundedIntegral selectFile :: [FilePath] -> FileSelector -> FilePath selectFile sortedfs (FileSelector n) = sortedfs !! (n `mod` length sortedfs) -- cgit v1.2.3