Revision 05ac718f htools/Ganeti/HTools/QC.hs

b/htools/Ganeti/HTools/QC.hs
590 590

  
591 591
-- | Custom 'Qlang.Filter' generator (top-level), which enforces a
592 592
-- (sane) limit on the depth of the generated filters.
593
genFilter :: Gen Qlang.Filter
593
genFilter :: Gen (Qlang.Filter Qlang.FilterField)
594 594
genFilter = choose (0, 10) >>= genFilter'
595 595

  
596 596
-- | Custom generator for filters that correctly halves the state of
597 597
-- the generators at each recursive step, per the QuickCheck
598 598
-- documentation, in order not to run out of memory.
599
genFilter' :: Int -> Gen Qlang.Filter
599
genFilter' :: Int -> Gen (Qlang.Filter Qlang.FilterField)
600 600
genFilter' 0 =
601 601
  oneof [ return Qlang.EmptyFilter
602 602
        , Qlang.TrueFilter     <$> getName

Also available in: Unified diff