assertEquals

Asserts that the floating-point values are approximately equal.

  1. void assertEquals(T expected, U actual, string msg, string file, size_t line)
  2. void assertEquals(T expected, U actual, string msg, string file, size_t line)
    @safe
    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, string msg, string file, size_t line)

Throws

AssertException otherwise

Examples

assertEquals(1, 1.01);

auto exception = expectThrows!AssertException(assertEquals(1, 1.1));

assertEquals("expected: <1> but was: <1.1>", exception.msg);

Meta