FsCheck


Prop

Namespace: FsCheck

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 valueDescription
classify b name
Signature: b:bool -> name:string -> 'Testable -> Property
Type parameters: 'Testable

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

collect v
Signature: v:'CollectedValue -> 'Testable -> Property
Type parameters: 'CollectedValue, 'Testable

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

discard ()
Signature: unit -> '?73784
Type parameters: '?73784

CompiledName: Discard

forAll arb body
Signature: arb:Arbitrary<'Value> -> body:('Value -> 'Testable) -> Property
Type parameters: 'Value, 'Testable

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

forAllAction1 arb body
Signature: arb:Arbitrary<'Value> -> body:Action<'Value> -> Property
Type parameters: 'Value

CompiledName: ForAll

forAllAction1Def body
Signature: body:Action<'Value> -> Property
Type parameters: 'Value

CompiledName: ForAll

forAllAction2 (arb1, arb2) body
Signature: (arb1:Arbitrary<'V1> * arb2:Arbitrary<'V2>) -> body:Action<'V1,'V2> -> Property
Type parameters: 'V1, 'V2

CompiledName: ForAll

forAllAction2Def body
Signature: body:Action<'V1,'V2> -> Property
Type parameters: 'V1, 'V2

CompiledName: ForAll

forAllAction3 (arb1, arb2, arb3) body
Signature: (arb1:Arbitrary<'V1> * arb2:Arbitrary<'V2> * arb3:Arbitrary<'V3>) -> body:Action<'V1,'V2,'V3> -> Property
Type parameters: 'V1, 'V2, 'V3

CompiledName: ForAll

forAllAction3Def body
Signature: body:Action<'V1,'V2,'V3> -> Property
Type parameters: 'V1, 'V2, 'V3

CompiledName: ForAll

forAllFunc1Bool arb body
Signature: arb:Arbitrary<'Value> -> body:Func<'Value,bool> -> Property
Type parameters: 'Value

CompiledName: ForAll

forAllFunc1BoolDef body
Signature: body:Func<'Value,bool> -> Property
Type parameters: 'Value

CompiledName: ForAll

forAllFunc1Prop arb body
Signature: arb:Arbitrary<'Value> -> body:Func<'Value,Property> -> Property
Type parameters: 'Value

CompiledName: ForAll

forAllFunc1PropDef body
Signature: body:Func<'Value,Property> -> Property
Type parameters: 'Value

CompiledName: ForAll

forAllFunc2Bool (arb1, arb2) body
Signature: (arb1:Arbitrary<'V1> * arb2:Arbitrary<'V2>) -> body:Func<'V1,'V2,bool> -> Property
Type parameters: 'V1, 'V2

CompiledName: ForAll

forAllFunc2BoolDef body
Signature: body:Func<'V1,'V2,bool> -> Property
Type parameters: 'V1, 'V2

CompiledName: ForAll

forAllFunc2Prop (arb1, arb2) body
Signature: (arb1:Arbitrary<'V1> * arb2:Arbitrary<'V2>) -> body:Func<'V1,'V2,Property> -> Property
Type parameters: 'V1, 'V2

CompiledName: ForAll

forAllFunc2PropDef body
Signature: body:Func<'V1,'V2,Property> -> Property
Type parameters: 'V1, 'V2

CompiledName: ForAll

forAllFunc3Bool (arb1, arb2, arb3) body
Signature: (arb1:Arbitrary<'V1> * arb2:Arbitrary<'V2> * arb3:Arbitrary<'V3>) -> body:Func<'V1,'V2,'V3,bool> -> Property
Type parameters: 'V1, 'V2, 'V3

CompiledName: ForAll

forAllFunc3BoolDef body
Signature: body:Func<'V1,'V2,'V3,bool> -> Property
Type parameters: 'V1, 'V2, 'V3

CompiledName: ForAll

forAllFunc3Prop (arb1, arb2, arb3) body
Signature: (arb1:Arbitrary<'V1> * arb2:Arbitrary<'V2> * arb3:Arbitrary<'V3>) -> body:Func<'V1,'V2,'V3,Property> -> Property
Type parameters: 'V1, 'V2, 'V3

CompiledName: ForAll

forAllFunc3PropDef body
Signature: body:Func<'V1,'V2,'V3,Property> -> Property
Type parameters: 'V1, 'V2, 'V3

CompiledName: ForAll

given condition (iftrue, ifFalse)
Signature: condition:bool -> (iftrue:'TestableIfTrue * ifFalse:'TestableIfFalse) -> Property
Type parameters: 'TestableIfTrue, 'TestableIfFalse

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

label l
Signature: l:string -> 'Testable -> Property
Type parameters: 'Testable

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

ofTestable testable
Signature: testable:'Testable -> Property
Type parameters: 'Testable

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.

throws p
Signature: p:Lazy<'Testable> -> Property
Type parameters: 'Exception, 'Testable

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

trivial b
Signature: b:bool -> 'Testable -> Property
Type parameters: 'Testable

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

within time lazyProperty
Signature: time:int -> lazyProperty:Lazy<'Testable> -> Property
Type parameters: 'Testable

Fails the property if it does not complete within t milliseconds. Note that the called property gets a cancel signal, but whether it responds to that is up to the property; the execution may not actually stop.

Fork me on GitHub