Add comparison checks to testing framework
This commit is contained in:
parent
ea81ac987d
commit
bc18b03a53
1 changed files with 5 additions and 0 deletions
|
|
@ -46,4 +46,9 @@ void name ## _test_case ()
|
||||||
|
|
||||||
#define expect_different_ptr(expr1, expr2) if ((expr1) == (expr2)) fail(#expr1, " (", (void*)(expr1), ") == ", #expr2, " (", (void*)(expr2), ")")
|
#define expect_different_ptr(expr1, expr2) if ((expr1) == (expr2)) fail(#expr1, " (", (void*)(expr1), ") == ", #expr2, " (", (void*)(expr2), ")")
|
||||||
|
|
||||||
|
#define expect_less(expr1, expr2) if ((expr1) >= (expr2)) fail(#expr1, " (", (expr1), ") >= ", #expr2, " (", (expr2), ")")
|
||||||
|
#define expect_lequal(expr1, expr2) if ((expr2) > (expr2)) fail(#expr1, " (", (expr1), ") > ", #expr2, " (", (expr2), ")")
|
||||||
|
#define expect_greater(expr1, expr2) if ((expr1) <= (expr2)) fail(#expr1, " (", (expr1), ") <= ", #expr2, " (", (expr2), ")")
|
||||||
|
#define expect_gequal(expr1, expr2) if ((expr1) < (expr2)) fail(#expr1, " (", (expr1), ") < ", #expr2, " (", (expr2), ")")
|
||||||
|
|
||||||
#define expect_throw(expr, type) do { bool thrown = false; try { (void)(expr); } catch (type const &) { thrown = true; } if (!thrown) fail(#expr, " didn't throw ", #type); } while (false)
|
#define expect_throw(expr, type) do { bool thrown = false; try { (void)(expr); } catch (type const &) { thrown = true; } if (!thrown) fail(#expr, " didn't throw ", #type); } while (false)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue