FsCheck


Prop Module

Namespace: FsCheck.FSharp

Assembly: FsCheck.dll

Combinators to build properties, which define the property to be tested, with some convenience methods to investigate the generated arguments and any found counter-examples.

Functions and values

Function or value Description

Prop.classify b name

Full Usage: Prop.classify b name

Parameters:
    b : bool
    name : string

Returns: 'Testable -> Property

Classify test cases. Test cases satisfying the condition are assigned the classification given.

b : bool
name : string
Returns: 'Testable -> Property

Prop.collect v

Full Usage: Prop.collect v

Parameters:
    v : 'CollectedValue

Returns: 'Testable -> Property

Collect data values. The argument of collect is evaluated in each test case, and the distribution of values is reported, using sprintf "%A".

v : 'CollectedValue
Returns: 'Testable -> Property

Prop.discard ()

Full Usage: Prop.discard ()

Parameters:
    () : unit

Returns: 'a

() : unit
Returns: 'a

Prop.filter condition assertion

Full Usage: Prop.filter condition assertion

Parameters:
    condition : bool
    assertion : 'Testable

Returns: Property

Conditional property combinator. Resulting property holds if the given property holds whenever the condition does. See also operator: 'assertion ==> property'

condition : bool
assertion : 'Testable
Returns: Property

Prop.forAll arb body

Full Usage: Prop.forAll arb body

Parameters:
    arb : Arbitrary<'Value>
    body : 'Value -> 'Testable

Returns: Property

Quantified property combinator. Provide a custom test data generator to a property.

arb : Arbitrary<'Value>
body : 'Value -> 'Testable
Returns: Property

Prop.given condition (iftrue, ifFalse)

Full Usage: Prop.given condition (iftrue, ifFalse)

Parameters:
    condition : bool
    iftrue : 'TestableIfTrue
    ifFalse : 'TestableIfFalse

Returns: Property

Depending on the condition, return the first testable if true and the second if false.

condition : bool
iftrue : 'TestableIfTrue
ifFalse : 'TestableIfFalse
Returns: Property

Prop.label l

Full Usage: Prop.label l

Parameters:
    l : string

Returns: 'Testable -> Property

Add the given label to the property. The labels of a failing sub-property are displayed when it fails.

l : string
Returns: 'Testable -> Property

Prop.ofTestable testable

Full Usage: Prop.ofTestable testable

Parameters:
    testable : 'Testable

Returns: Property

Turns a testable type into a property. Testables are unit, boolean, Lazy testables, Gen testables, functions from a type for which a generator is know to a testable, tuples up to 6 tuple containing testables, and lists containing testables.

testable : 'Testable
Returns: Property

Prop.throws p

Full Usage: Prop.throws p

Parameters:
    p : Lazy<'Testable>

Returns: Property

Expect exception 't when executing p. So, results in success if an exception of the given type is thrown, and a failure otherwise.

p : Lazy<'Testable>
Returns: Property

Prop.trivial b

Full Usage: Prop.trivial b

Parameters:
    b : bool

Returns: 'Testable -> Property

Count trivial cases. Test cases for which the condition is True are classified as trivial.

b : bool
Returns: 'Testable -> Property