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

1 int[] expected = [0, 1];
2 
3 assertRangeEquals(expected, [0, 1]);
4 
5 AssertException exception;
6 
7 exception = expectThrows!AssertException(assertRangeEquals(expected, [0]));
8 assertEquals("length mismatch at index 1; expected: <1> but was: empty", exception.msg);
9 exception = expectThrows!AssertException(assertRangeEquals(expected, [0, 1, 2]));
10 assertEquals("length mismatch at index 2; expected: empty but was: <2>", exception.msg);
11 exception = expectThrows!AssertException(assertArrayEquals("bar", "baz"));
12 assertEquals("mismatch at index 2; expected: <r> but was: <z>", exception.msg);

Meta