monus-weighted-search-0.2.0.0: Efficient search weighted by an ordered monoid with monus.
Copyright(c) Donnacha Oisín Kidney 2021
Maintainermail@doisinkidney.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

MonusWeightedSearch.Internal.TestHelpers

Description

Some utility functions for implementing Arbitrary etc.

Synopsis

Documentation

>>> import Test.QuickCheck

sumsTo :: Int -> Gen [Int] Source #

sumsTo n generates a list that sums to n.

n >= 0 ==> forAll (sumsTo n) (\xs -> sum xs === n)

percentageChance :: Word -> Gen Bool Source #

percentageChance n is True n% of the time, and False the rest of the time.

percentageChanceIO :: Word -> IO Bool Source #

percentageChanceIO n is True n% of the time, and False the rest of the time.