From efda9be7c8782936fab05b6059c43d1c30effe1f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 21 Nov 2013 14:04:08 -0400 Subject: better FileSelector distribution --- Git/Destroyer.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Git/Destroyer.hs b/Git/Destroyer.hs index a208576..f175515 100644 --- a/Git/Destroyer.hs +++ b/Git/Destroyer.hs @@ -61,7 +61,14 @@ data FileSelector = FileSelector Int deriving (Read, Show) instance Arbitrary FileSelector where - arbitrary = FileSelector <$> nonNegative arbitraryBoundedIntegral + arbitrary = FileSelector <$> oneof + -- An early file in the git tree, tends to be the most + -- interesting when there are lots of files. + [ nonNegative arbitrarySizedIntegral + -- Totally random choice from any of the files in + -- the git tree, to ensure good coverage. + , nonNegative arbitraryBoundedIntegral + ] selectFile :: [FilePath] -> FileSelector -> FilePath selectFile sortedfs (FileSelector n) = sortedfs !! (n `mod` length sortedfs) -- cgit v1.2.3