assertRangeEquals

Asserts that the ranges are equal.

void
assertRangeEquals
(
R1
R2
)
(,,
lazy string msg = null
,
string file = __FILE__
,
size_t line = __LINE__
)
if (
isInputRange!R1 &&
isInputRange!R2
&&
is(typeof(expected.front == actual.front))
)

Throws

AssertException otherwise

Examples

string expected = "atum";

assertArrayEquals(expected, "atum");

AssertException exception;

exception = expectThrows!AssertException(assertRangeEquals(expected, "atu"));
assertEquals("length mismatch at index 3; expected: <m> but was: empty", exception.msg);
exception = expectThrows!AssertException(assertRangeEquals(expected, "atumm"));
assertEquals("length mismatch at index 4; expected: empty but was: <m>", exception.msg);
exception = expectThrows!AssertException(assertArrayEquals(expected, "arum"));
assertEquals("mismatch at index 1; expected: <t> but was: <r>", exception.msg);
int[] expected = [0, 1];

assertRangeEquals(expected, [0, 1]);

AssertException exception;

exception = expectThrows!AssertException(assertRangeEquals(expected, [0]));
assertEquals("length mismatch at index 1; expected: <1> but was: empty", exception.msg);
exception = expectThrows!AssertException(assertRangeEquals(expected, [0, 1, 2]));
assertEquals("length mismatch at index 2; expected: empty but was: <2>", exception.msg);
exception = expectThrows!AssertException(assertArrayEquals(expected, [0, 2]));
assertEquals("mismatch at index 1; expected: <1> but was: <2>", exception.msg);

Meta