shouldEqual

Used to assert that one value is equal to another value.

void
shouldEqual
(
T
U
)
(
auto ref T value
,
auto ref U expected
,
in string message = null
,
in string file = __FILE__
,
in size_t line = __LINE__
)

Parameters

value
Type: T

The value.

expected
Type: U

The expected value.

message
Type: string

The exception message.

file
Type: string

The file name that the assert failed in. Should be left as default.

line
Type: size_t

The file line that the assert failed in. Should be left as default.

Throws

If values are not equal, will throw an UnitTestException with expected and actual values.

Examples

// Will throw an exception like "checkit.exception.UnitTestException@example.d(6): <3> expected to equal <5>."
int z = 3;
z.shouldEqual(5);

Meta