Skip to content

Property1[T: T]

[Source]

A property that consumes 1 argument of type T.

A property is defined by a Generator, returned by the gen() method and a property method that consumes the generators output and verifies a custom property with the help of a PropertyHelper.

A property is verified if no failed assertion on PropertyHelper has been reported for all the samples it consumed.

The property execution can be customized by returning a custom PropertyParams from the [params()]*ponycheck-Property1.md#params) method.

The gen() method is called exactly once to instantiate the generator. The generator produces PropertyParams.num_samples samples and each is passed to the property method for verification.

If the property did not verify, the given sample is shrunken, if the generator supports shrinking. The smallest shrunken sample will then be reported to the user.

A Property1 can be run with Ponytest. To that end it needs to be wrapped into a Property1UnitTest.

trait ref Property1[T: T]

Public Functions

name

[Source]

The name of the property used for reporting during execution.

fun box name()
: String val

Returns


params

[Source]

Returns parameters to customize execution of this Property.

fun box params()
: PropertyParams val

Returns


gen

[Source]

The Generator used to produce samples to verify.

fun box gen()
: Generator[T] box

Returns


property

[Source]

A method verifying that a certain property holds for all given arg1 with the help of PropertyHelper h.

fun ref property(
  arg1: T,
  h: PropertyHelper val)
: None val ?

Parameters

Returns