Table of Contents

Class Settings

Namespace
Hegel
Assembly
Hegel.dll

How a test runs. A new Settings holds the engine's resolved defaults (the hegel.toml profile and the HEGEL_* environment variables), so what you read back is what the run uses; set properties with an object initializer or a with expression:

var settings = new Settings { TestCases = 500, Seed = 42 };
var ci = Settings.FromProfile("ci") with { Verbosity = Verbosity.Verbose };
public sealed record Settings : IEquatable<Settings>
Inheritance
Settings
Implements
Inherited Members

Constructors

Settings()

The engine's resolved default settings.

public Settings()

Properties

Backend

Where randomness comes from.

public Backend Backend { get; init; }

Property Value

Backend

Database

Where failures are saved and replayed from.

public Database Database { get; init; }

Property Value

Database

Derandomize

Whether to derive the seed from the test's identity, so every run draws the same way.

public bool Derandomize { get; init; }

Property Value

bool

Examples

Explicit test cases to run before the generated ones.

public IReadOnlyList<Example> Examples { get; init; }

Property Value

IReadOnlyList<Example>

InfrastructureNamespaces

Namespace prefixes whose frames are not the test's own, on top of this library's and the runtime's: a failure's origin is the first frame outside them.

public IReadOnlyList<string> InfrastructureNamespaces { get; init; }

Property Value

IReadOnlyList<string>

Name

The test's name: its database key, and what its seed derives from under Derandomize. Defaults to the calling file and method.

public string? Name { get; init; }

Property Value

string

NondeterminismStrictness

What to do when the test turns out to be nondeterministic.

public NondeterminismStrictness NondeterminismStrictness { get; init; }

Property Value

NondeterminismStrictness

Phases

The phases to run.

public Phase Phases { get; init; }

Property Value

Phase

PrintBlob

Whether a failure's report ends with the blob that reproduces it.

public bool PrintBlob { get; init; }

Property Value

bool

ReportMultipleFailures

Whether to keep looking for distinct failures after the first.

public bool ReportMultipleFailures { get; init; }

Property Value

bool

ReproduceFailure

Failure blobs to replay instead of generating test cases. When none of them reproduces a failure the run throws DidNotReproduceException.

public IReadOnlyList<string> ReproduceFailure { get; init; }

Property Value

IReadOnlyList<string>

Seed

The random seed, or null to let the engine choose one.

public ulong? Seed { get; init; }

Property Value

ulong?

ShowStatistics

Whether to print the run's statistics when it ends.

public bool ShowStatistics { get; init; }

Property Value

bool

StopOnFirstFailure

Whether to stop at the first failure without shrinking it.

public bool StopOnFirstFailure { get; init; }

Property Value

bool

SuppressHealthCheck

The health checks not to run.

public HealthCheck SuppressHealthCheck { get; init; }

Property Value

HealthCheck

TestCases

How many test cases to generate. Must be positive.

public long TestCases { get; init; }

Property Value

long

TestLocation

Where the test is defined. Defaults to the caller of Test(Action<TestCase>, Settings?, Reporter?, string, int, string).

public TestLocation? TestLocation { get; init; }

Property Value

TestLocation

UnboundedChoices

Whether a test case may draw without the engine's usual size limit.

public bool UnboundedChoices { get; init; }

Property Value

bool

Verbosity

How much to report.

public Verbosity Verbosity { get; init; }

Property Value

Verbosity

Methods

FromProfile(string)

The settings of the named hegel.toml profile, resolved as Settings() resolves the default.

public static Settings FromProfile(string name)

Parameters

name string

Returns

Settings

RegisterProfile(string, Settings)

Register settings as the profile name, for FromProfile(string) and SetDefaultProfile(string).

public static void RegisterProfile(string name, Settings settings)

Parameters

name string
settings Settings

Set(string, string)

These settings with the hegel.toml key key set to value, as the engine parses it. An unknown key or a malformed value throws ArgumentException here.

public Settings Set(string key, string value)

Parameters

key string
value string

Returns

Settings

SetDefaultProfile(string)

Make the profile name the one new Settings resolve from.

public static void SetDefaultProfile(string name)

Parameters

name string