cpAssertHard

Throw a DChipError if condition is false.

void
cpAssertHard
(
string file = __FILE__
size_t line = __LINE__
E
Args...
)
(
lazy E condition
,
lazy string expr
,
lazy Args args
)

Examples

import std.exception : assertNotThrown;
import dchip.util : assertErrorsWith;

int iteration = 10;
int WARN_GJK_ITERATIONS = 10;

cpAssertHard(iteration < WARN_GJK_ITERATIONS, "iteration < WARN_GJK_ITERATIONS")
    .assertErrorsWith(`Error: Requirement failed. Failed condition: "iteration < WARN_GJK_ITERATIONS".`);

assertNotThrown!DChipError(cpAssertHard(iteration == WARN_GJK_ITERATIONS,
                                       "iteration == WARN_GJK_ITERATIONS"));

Meta