assertArrayEquals

Asserts that the static arrays are equal.

  1. void assertArrayEquals(T[] expected, U[] actual, string msg, string file, size_t line)
  2. void assertArrayEquals(T[l1] expected, U[l2] actual, string msg, string file, size_t line)
    @safe pure
    void
    assertArrayEquals
    (
    T
    U
    size_t l1
    size_t l2
    )
    (
    auto ref const T[l1] expected
    ,
    auto ref const U[l2] actual
    ,
    lazy string msg = null
    ,
    string file = __FILE__
    ,
    size_t line = __LINE__
    )
  3. void assertArrayEquals(T[V] expected, U[V] actual, string msg, string file, size_t line)

Throws

AssertException otherwise

Examples

int[4] expected = [1, 2, 3, 4];

assertArrayEquals(expected, [1, 2, 3, 4]);

AssertException exception;

exception = expectThrows!AssertException(assertArrayEquals(expected, [1, 2]));
assertEquals(`length mismatch; expected: <4> but was: <2>`, exception.msg);
exception = expectThrows!AssertException(assertArrayEquals(expected, [1, 2, 5, 4]));
assertEquals(`mismatch at index 2; expected: <3> but was: <5>`, exception.msg);

Meta