smallcheck-1.2.1.1: A property-based testing library

Copyright | (c) Colin Runciman et al.
License | BSD3
Maintainer | Roman Cheplyaka <roma@ro-che.info>
Safe Haskell | Safe
Language | Haskell2010

Test.SmallCheck.Drivers

Description

You should only need this module if you wish to create your own way to run SmallCheck tests

Synopsis

- smallCheck :: Testable IO a => Depth -> a -> IO ()
- smallCheckM :: Testable m a => Depth -> a -> m (Maybe PropertyFailure)
- smallCheckWithHook :: Testable m a => Depth -> (TestQuality -> m ()) -> a -> m (Maybe PropertyFailure)
- test :: Testable m a => a -> Property m
- ppFailure :: PropertyFailure -> String
- data PropertyFailure
  - = NotExist
  - | AtLeastTwo [Argument] PropertySuccess [Argument] PropertySuccess
  - | CounterExample [Argument] PropertyFailure
  - | PropertyFalse (Maybe Reason)
- data PropertySuccess
  - = Exist [Argument] PropertySuccess
  - | ExistUnique [Argument] PropertySuccess
  - | PropertyTrue (Maybe Reason)
  - | Vacuously PropertyFailure
- type Argument = String
- type Reason = String
- data TestQuality
  - = GoodTest
  - | BadTest

# Documentation

smallCheck :: Testable IO a => Depth -> a -> IO () Source #

A simple driver that runs the test in the `IO` monad and prints the results.

Since: 1.0

smallCheckM :: Testable m a => Depth -> a -> m (Maybe PropertyFailure) Source #

Use this if:

- You need to run a test in a monad different from `IO`
- You need to analyse the results rather than just print them

Since: 1.0

smallCheckWithHook :: Testable m a => Depth -> (TestQuality -> m ()) -> a -> m (Maybe PropertyFailure) Source #

Like `smallCheckM`, but allows to specify a monadic hook that gets executed after each test is run.

Useful for applications that want to report progress information to the user.

Since: 1.0

test :: Testable m a => a -> Property m Source #

Since: 1.0

ppFailure :: PropertyFailure -> String Source #

Since: 1.0

data PropertyFailure Source #

Since: 1.0

Constructors

NotExist |
AtLeastTwo [Argument] PropertySuccess [Argument] PropertySuccess |
CounterExample [Argument] PropertyFailure |
PropertyFalse (Maybe Reason) | Since: 1.1

#### Instances

Instances details

Show PropertyFailure Source # |
Instance details Defined in Test.SmallCheck.Property.Result Methods showsPrec :: Int -> PropertyFailure -> ShowS Source # show :: PropertyFailure -> String Source # showList :: [PropertyFailure] -> ShowS Source #
Eq PropertyFailure Source # |
Instance details Defined in Test.SmallCheck.Property.Result Methods (==) :: PropertyFailure -> PropertyFailure -> Bool Source # (/=) :: PropertyFailure -> PropertyFailure -> Bool Source #

data PropertySuccess Source #

Since: 1.0

Constructors

Exist [Argument] PropertySuccess |
ExistUnique [Argument] PropertySuccess |
PropertyTrue (Maybe Reason) | Since: 1.1
Vacuously PropertyFailure |

#### Instances

Instances details

Show PropertySuccess Source # |
Instance details Defined in Test.SmallCheck.Property.Result Methods showsPrec :: Int -> PropertySuccess -> ShowS Source # show :: PropertySuccess -> String Source # showList :: [PropertySuccess] -> ShowS Source #
Eq PropertySuccess Source # |
Instance details Defined in Test.SmallCheck.Property.Result Methods (==) :: PropertySuccess -> PropertySuccess -> Bool Source # (/=) :: PropertySuccess -> PropertySuccess -> Bool Source #

type Argument = String Source #

Since: 1.0

type Reason = String Source #

An explanation for the test outcome.

Since: 1.1

data TestQuality Source #

Since: 1.0

Constructors

GoodTest |
BadTest |

#### Instances

Instances details

Enum TestQuality Source # |

Instance details

Defined in Test.SmallCheck.Property

Methods

succ :: TestQuality -> TestQuality Source #

pred :: TestQuality -> TestQuality Source #

toEnum :: Int -> TestQuality Source #

fromEnum :: TestQuality -> Int Source #

enumFrom :: TestQuality -> [TestQuality] Source #

enumFromThen :: TestQuality -> TestQuality -> [TestQuality] Source #

enumFromTo :: TestQuality -> TestQuality -> [TestQuality] Source #

enumFromThenTo :: TestQuality -> TestQuality -> TestQuality -> [TestQuality] Source #

Show TestQuality Source # |
Instance details Defined in Test.SmallCheck.Property Methods showsPrec :: Int -> TestQuality -> ShowS Source # show :: TestQuality -> String Source # showList :: [TestQuality] -> ShowS Source #
Eq TestQuality Source # |
Instance details Defined in Test.SmallCheck.Property Methods (==) :: TestQuality -> TestQuality -> Bool Source # (/=) :: TestQuality -> TestQuality -> Bool Source #
Ord TestQuality Source # |

Instance details

Defined in Test.SmallCheck.Property

Methods

compare :: TestQuality -> TestQuality -> Ordering Source #

(<) :: TestQuality -> TestQuality -> Bool Source #

(<=) :: TestQuality -> TestQuality -> Bool Source #

(>) :: TestQuality -> TestQuality -> Bool Source #

(>=) :: TestQuality -> TestQuality -> Bool Source #

max :: TestQuality -> TestQuality -> TestQuality Source #

min :: TestQuality -> TestQuality -> TestQuality Source #