assertEquals

Asserts that the floating-point values are approximately 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__)
    void
    assertEquals
    (
    T
    U
    )
    (
    ,,
    lazy string msg = null
    ,
    string file = __FILE__
    ,
    size_t line = __LINE__
    )
    if (
    isFloatingPoint!T ||
    isFloatingPoint!U
    )
  3. void assertEquals(T expected, U actual, lazy string msg = null, string file = __FILE__, size_t line = __LINE__)

Throws

AssertException otherwise

Examples

1 assertEquals(1, 1.01);
2 
3 auto exception = expectThrows!AssertException(assertEquals(1, 1.1));
4 
5 assertEquals("expected: <1> but was: <1.1>", exception.msg);

Meta