assertOp

Useful template to generate an assert check function

template assertOp(string op)
void
assertOp
(
T1
T2
)
(
T1 lhs
,
T2 rhs
,
string file = __FILE__
,
size_t line = __LINE__
)

Examples

1 alias assertEqual = assertOp!"==";
2 alias assertNotEqual = assertOp!"!=";
3 alias assertGreaterThan = assertOp!">";
4 alias assertGreaterThanOrEqual = assertOp!">=";
5 
6 assertEqual(1, 1);
7 assertNotEqual(1, 2);
8 assertGreaterThan(2, 1);
9 assertGreaterThanOrEqual(2, 2);

Meta