assertEquals

Asserts that the values are equal.

  1. void assertEquals(T expected, U actual, lazy string msg = null, string file = __FILE__, size_t line = __LINE__)
  2. void assertEquals(T expected, U actual, lazy string msg = null, string file = __FILE__, size_t line = __LINE__)
  3. void assertEquals(T expected, U actual, lazy string msg = null, string file = __FILE__, size_t line = __LINE__)
    void
    assertEquals
    (
    T
    U
    )
    (
    ,,
    lazy string msg = null
    ,
    string file = __FILE__
    ,
    size_t line = __LINE__
    )
    if (
    !isSomeString!T &&
    !isFloatingPoint!T
    &&
    !isFloatingPoint!U
    )

Throws

AssertException otherwise

Examples

1 assertEquals(42, 42);
2 
3 auto exception = expectThrows!AssertException(assertEquals(42, 24));
4 
5 assertEquals("expected: <42> but was: <24>", exception.msg);
1 Object foo = new Object();
2 Object bar = null;
3 
4 assertEquals(foo, foo);
5 assertEquals(bar, bar);
6 
7 auto exception = expectThrows!AssertException(assertEquals(foo, bar));
8 
9 assertEquals("expected: <object.Object> but was: <null>", exception.msg);

Meta