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
Type: A

The value used during the assertion.

target
Type: B

The target value.

message
Type: string

The error message to display.

file
Type: string

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

line
Type: size_t

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

Throws

DUnitAssertError if the assertation fails.

Examples

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

Meta