From 4c49b96513b8f6b9a479efd26dbd8d87df5dcd23 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Thu, 6 Dec 2012 12:32:16 +0100 Subject: [PATCH] make genMaybe more Just There is a common conception that Just something is more worth than Nothing. So we're biasing our tests towards that. As such let's generate Nothing fewer times, and Just subgen more times. The values were copied from the "official" maybe generator. Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- htest/Test/Ganeti/TestCommon.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htest/Test/Ganeti/TestCommon.hs b/htest/Test/Ganeti/TestCommon.hs index 22f07e8c1..62990499f 100644 --- a/htest/Test/Ganeti/TestCommon.hs +++ b/htest/Test/Ganeti/TestCommon.hs @@ -147,7 +147,7 @@ genFQDN = do -- | Combinator that generates a 'Maybe' using a sub-combinator. genMaybe :: Gen a -> Gen (Maybe a) -genMaybe subgen = oneof [ pure Nothing, liftM Just subgen ] +genMaybe subgen = frequency [ (1, pure Nothing), (3, Just <$> subgen) ] -- | Defines a tag type. newtype TagChar = TagChar { tagGetChar :: Char } -- GitLab