summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-03-01 19:30:06 -0500
committerJakob Kaivo <jkk@ung.org>2019-03-01 19:30:06 -0500
commit4db28a13a8bbc2eabe69f2b86eda392f3bd72274 (patch)
treeca2f587612cd14d645c79db240d652bf614953eb
parentd5270660952c2cd0456a83a09d55d721798b6e6e (diff)
add min, max, and defined tests
-rw-r--r--test.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/test.h b/test.h
index 3bbf59a..357a26c 100644
--- a/test.h
+++ b/test.h
@@ -13,6 +13,9 @@ void test_void_imp(const char*);
void test_bool_imp(const char *, int, int);
#define test_false(expression) test_bool_imp(#expression, expression, 0)
#define test_true(expression) test_bool_imp(#expression, expression, 1)
+#define test_min(expression, min) test_bool_imp(#expression, min < 0 ? expression <= min : expression >= min, 1)
+#define test_max(expression, max) test_bool_imp(#expression, 0 < expression && expression <= max, 1)
+#define test_defined(expression) test_false(expression & 0)
void test_string_imp(const char*, const char*, const char*);
#define test_string(expression, string) test_string_imp(#expression, expression, string)