LEVIATHAN vd52e79c4 · d52e79c486

Standard Library

class ContractOperand

One reported operand of a violated predicate: its source text and its value.

since 0.1.0-alpha.1linuxwindowswasm

Examples

use io::console;

ContractOperand o = ContractOperand("cents", "-5");
console.writeln(o.text + " = " + o.value);
cents = -5

Constructors

new

new(string text, string value)

Creates an operand record.

Parameters

text
The operand's source text.
value
The operand's formatted value.

Examples

use io::console;

ContractOperand o = ContractOperand("name", "\"bob\"");
console.writeln(o.value);
"bob"

Fields

text

string text

The operand as written in the predicate.

value

string value

The operand's value, formatted: strings in double quotes, characters in single quotes.

See also

  • ContractViolation — A violated contract: a failed pre, post, assert or invariant.