assertOp

Asserts that the condition (lhs op rhs) is satisfied.

template assertOp(string op)
void
assertOp
(
T
U
)
(
T lhs
,
U rhs
,
lazy string msg = null
,
string file = __FILE__
,
size_t line = __LINE__
)

Throws

AssertException otherwise

Examples

1 assertLessThan(2, 3);
2 
3 auto exception = expectThrows!AssertException(assertGreaterThanOrEqual(2, 3));
4 
5 assertEquals("condition (2 >= 3) not satisfied", exception.msg);
1 assertIn("foo", ["foo": "bar"]);
2 
3 auto exception = expectThrows!AssertException(assertNotIn("foo", ["foo": "bar"]));
4 
5 assertEquals(`condition ("foo" !in ["foo":"bar"]) not satisfied`, exception.msg);

See Also

Meta