Table of Contents

Class TestCase

Namespace
Hegel
Assembly
Hegel.dll

One run of the test body: draw values from generators, make assumptions, add notes. The engine chooses what each draw returns, records the draws of a failing run and shrinks them to the smallest failing test case, which is printed as the C# that rebuilds it.

public sealed class TestCase
Inheritance
TestCase
Inherited Members

Methods

Assume(bool)

Reject this test case unless condition holds; the engine tries another.

public void Assume(bool condition)

Parameters

condition bool

Clone()

A second handle on this test case, for drawing from another thread.

public TestCase Clone()

Returns

TestCase

DrawAndPrint<T>(Generator<T>, Printer)

Draw a value from generator, printing it to printer: how a generator draws its parts.

public T DrawAndPrint<T>(Generator<T> generator, Printer printer)

Parameters

generator Generator<T>
printer Printer

Returns

T

Type Parameters

T

DrawSilent<T>(Generator<T>)

Draw a value from generator without printing it; the generator need not be printable.

public T DrawSilent<T>(Generator<T> generator)

Parameters

generator Generator<T>

Returns

T

Type Parameters

T

Draw<T>(Generator<T>, string?)

Draw a value from generator, printed in the failure report as var label_1 = ...; (draw_1 without a label). The generator must be printable.

public T Draw<T>(Generator<T> generator, string? label = null)

Parameters

generator Generator<T>
label string

Returns

T

Type Parameters

T

Event(string)

Count an occurrence of label in the run's statistics.

public void Event(string label)

Parameters

label string

EventValue(string, double)

Record value under label in the run's statistics.

public void EventValue(string label, double value)

Parameters

label string
value double

Note(string)

Add message to the test case's printed output.

public void Note(string message)

Parameters

message string

Reject()

Reject this test case; the engine tries another.

public void Reject()

Repeat(Action)

Run body a number of times the engine chooses, each in its own block of the output. Nothing after the call runs: it ends the test case.

public void Repeat(Action body)

Parameters

body Action

SetWorker(int)

Mark this handle as belonging to the concurrent worker worker.

public void SetWorker(int worker)

Parameters

worker int

Target(double, string)

Guide the engine towards test cases that maximise value.

public void Target(double value, string label = "")

Parameters

value double
label string