summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2013-11-21 12:45:29 -0400
committerJoey Hess <joey@kitenet.net>2013-11-21 12:45:29 -0400
commite9213e6d0d94e386462939dfadf7967394af009c (patch)
tree5194a9a0a844ed6da889e18a949dfc4f13552a43
parente38c59dfde89f15c61b4073dcd19b53dfe440e74 (diff)
downloadgit-repair-e9213e6d0d94e386462939dfadf7967394af009c.tar.gz
better Arbitrary instance for FileSelector
This ensures any file in the repo is chosen, not only one of the first 20.
-rw-r--r--Git/Destroyer.hs4
1 files 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)