sdp-quickcheck-0.2: SDP QuickCheck support
Copyright(c) Andrey Mulik 2019
LicenseBSD-style
Maintainerwork.a.mulik@gmail.com
Portabilitynon-portable (requires non-portable modules)
Safe HaskellNone
LanguageHaskell2010

Test.SDP.Gen

Description

Test.SDP.Gen provides newtypes for QuickCheck.

Synopsis

Common newtypes for QuickCheck

newtype Short a Source #

Short is newtype of short data structures [0, 100) in QuickCheck properties.

Short is the equivalent of the standard Arbitrary definition: arbitrary = fromList <$> arbitrary.

Constructors

Short a 

Instances

Instances details
Eq a => Eq (Short a) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

(==) :: Short a -> Short a -> Bool #

(/=) :: Short a -> Short a -> Bool #

Ord a => Ord (Short a) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

compare :: Short a -> Short a -> Ordering #

(<) :: Short a -> Short a -> Bool #

(<=) :: Short a -> Short a -> Bool #

(>) :: Short a -> Short a -> Bool #

(>=) :: Short a -> Short a -> Bool #

max :: Short a -> Short a -> Short a #

min :: Short a -> Short a -> Short a #

Read a => Read (Short a) Source # 
Instance details

Defined in Test.SDP.Gen

Show a => Show (Short a) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

showsPrec :: Int -> Short a -> ShowS #

show :: Short a -> String #

showList :: [Short a] -> ShowS #

(Linear l e, Arbitrary e) => Arbitrary (Short l) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

arbitrary :: Gen (Short l) #

shrink :: Short l -> [Short l] #

newtype Medium a Source #

Medium is newtype of medium data structures in QuickCheck properties. The Arbitrary Medium instance must create a random-sized structure from the range [100, 1024).

Medium is useful in testing as a compromise between speed and reliability: structures are too short for stress tests, but still human readable and enough fast for auto-testing.

Constructors

Medium a 

Instances

Instances details
Eq a => Eq (Medium a) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

(==) :: Medium a -> Medium a -> Bool #

(/=) :: Medium a -> Medium a -> Bool #

Ord a => Ord (Medium a) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

compare :: Medium a -> Medium a -> Ordering #

(<) :: Medium a -> Medium a -> Bool #

(<=) :: Medium a -> Medium a -> Bool #

(>) :: Medium a -> Medium a -> Bool #

(>=) :: Medium a -> Medium a -> Bool #

max :: Medium a -> Medium a -> Medium a #

min :: Medium a -> Medium a -> Medium a #

Read a => Read (Medium a) Source # 
Instance details

Defined in Test.SDP.Gen

Show a => Show (Medium a) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

showsPrec :: Int -> Medium a -> ShowS #

show :: Medium a -> String #

showList :: [Medium a] -> ShowS #

(Linear l e, Arbitrary e) => Arbitrary (Medium l) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

arbitrary :: Gen (Medium l) #

shrink :: Medium l -> [Medium l] #

newtype Long a Source #

Long is newtype of large data structures (>= 1024) in QuickCheck properties. Since Large can generate really huge numbers, the maximum length is limited by 16384 - [1024, 16384).

Long is primarily intended for benchmarks, although a large range of lengths makes them not very convenient for a pure comparison of several algorithms (but for this can be used vector[Of] and generate). Long works well with Unrolled and ByteList, since only the shortest of the allowed structures may fit in one standard chunk (1024 elements).

Constructors

Long a 

Instances

Instances details
Eq a => Eq (Long a) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

(==) :: Long a -> Long a -> Bool #

(/=) :: Long a -> Long a -> Bool #

Ord a => Ord (Long a) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

compare :: Long a -> Long a -> Ordering #

(<) :: Long a -> Long a -> Bool #

(<=) :: Long a -> Long a -> Bool #

(>) :: Long a -> Long a -> Bool #

(>=) :: Long a -> Long a -> Bool #

max :: Long a -> Long a -> Long a #

min :: Long a -> Long a -> Long a #

Read a => Read (Long a) Source # 
Instance details

Defined in Test.SDP.Gen

Show a => Show (Long a) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

showsPrec :: Int -> Long a -> ShowS #

show :: Long a -> String #

showList :: [Long a] -> ShowS #

(Linear l e, Arbitrary e) => Arbitrary (Long l) Source # 
Instance details

Defined in Test.SDP.Gen

Methods

arbitrary :: Gen (Long l) #

shrink :: Long l -> [Long l] #

Related functions

linearLargeA :: Linear l Int => Int -> Gen l Source #

linearLargeA is version of linearA, which generates Large Ints.

linearA :: (Linear l e, Arbitrary e) => Int -> Gen l Source #

linearA is overloaded vector.

orderA :: Ord e => Gen (e -> e -> Bool) Source #

orderA returns a simple comparator that can be used to test the behavior of higher-order functions (for example, when comparing the results of takeWhile for different structures).