assertEqual

Assert that two values are equal.

void
assertEqual
(
A
B
)
(,,
string message = "Failed asserting equal"
,
string file = __FILE__
,
size_t line = __LINE__
)

Parameters

value A

The value used during the assertion.

target B

The target value.

message string

The error message to display.

file string

The file name where the error occurred. The value is added automatically at the call site.

line size_t

The line where the error occurred. The value is added automatically at the call site.

Throws

DUnitAssertError if the assertation fails.

Examples

123.assertEqual(123);
"hello".assertEqual("hello");

// Assert a DUnitAssertError is thrown if assertEqual fails.
1.assertEqual(2).assertThrow!(DUnitAssertError)("Failed asserting equal");

Meta