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

1 import std.exception : assertNotThrown;
2 import dchip.util : assertErrorsWith;
3 
4 int iteration = 10;
5 int WARN_GJK_ITERATIONS = 10;
6 
7 cpAssertHard(iteration < WARN_GJK_ITERATIONS, "iteration < WARN_GJK_ITERATIONS")
8     .assertErrorsWith(`Error: Requirement failed. Failed condition: "iteration < WARN_GJK_ITERATIONS".`);
9 
10 assertNotThrown!DChipError(cpAssertHard(iteration == WARN_GJK_ITERATIONS,
11                                        "iteration == WARN_GJK_ITERATIONS"));

Meta