diff options
Diffstat (limited to 'regress/unittests/test_helper')
-rw-r--r-- | regress/unittests/test_helper/test_helper.c | 13 | ||||
-rw-r--r-- | regress/unittests/test_helper/test_helper.h | 17 |
2 files changed, 28 insertions, 2 deletions
diff --git a/regress/unittests/test_helper/test_helper.c b/regress/unittests/test_helper/test_helper.c index 26ca26b5e..f855137fb 100644 --- a/regress/unittests/test_helper/test_helper.c +++ b/regress/unittests/test_helper/test_helper.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: test_helper.c,v 1.6 2015/03/03 20:42:49 djm Exp $ */ | 1 | /* $OpenBSD: test_helper.c,v 1.7 2017/03/14 01:10:07 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2011 Damien Miller <djm@mindrot.org> | 3 | * Copyright (c) 2011 Damien Miller <djm@mindrot.org> |
4 | * | 4 | * |
@@ -442,6 +442,17 @@ assert_u_int(const char *file, int line, const char *a1, const char *a2, | |||
442 | } | 442 | } |
443 | 443 | ||
444 | void | 444 | void |
445 | assert_long(const char *file, int line, const char *a1, const char *a2, | ||
446 | long aa1, long aa2, enum test_predicate pred) | ||
447 | { | ||
448 | TEST_CHECK(aa1, aa2, pred); | ||
449 | test_header(file, line, a1, a2, "LONG", pred); | ||
450 | fprintf(stderr, "%12s = %ld / 0x%lx\n", a1, aa1, aa1); | ||
451 | fprintf(stderr, "%12s = %ld / 0x%lx\n", a2, aa2, aa2); | ||
452 | test_die(); | ||
453 | } | ||
454 | |||
455 | void | ||
445 | assert_long_long(const char *file, int line, const char *a1, const char *a2, | 456 | assert_long_long(const char *file, int line, const char *a1, const char *a2, |
446 | long long aa1, long long aa2, enum test_predicate pred) | 457 | long long aa1, long long aa2, enum test_predicate pred) |
447 | { | 458 | { |
diff --git a/regress/unittests/test_helper/test_helper.h b/regress/unittests/test_helper/test_helper.h index 1d9c66986..615b7832b 100644 --- a/regress/unittests/test_helper/test_helper.h +++ b/regress/unittests/test_helper/test_helper.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: test_helper.h,v 1.6 2015/01/18 19:52:44 djm Exp $ */ | 1 | /* $OpenBSD: test_helper.h,v 1.7 2017/03/14 01:10:07 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2011 Damien Miller <djm@mindrot.org> | 3 | * Copyright (c) 2011 Damien Miller <djm@mindrot.org> |
4 | * | 4 | * |
@@ -67,6 +67,9 @@ void assert_size_t(const char *file, int line, | |||
67 | void assert_u_int(const char *file, int line, | 67 | void assert_u_int(const char *file, int line, |
68 | const char *a1, const char *a2, | 68 | const char *a1, const char *a2, |
69 | u_int aa1, u_int aa2, enum test_predicate pred); | 69 | u_int aa1, u_int aa2, enum test_predicate pred); |
70 | void assert_long(const char *file, int line, | ||
71 | const char *a1, const char *a2, | ||
72 | long aa1, long aa2, enum test_predicate pred); | ||
70 | void assert_long_long(const char *file, int line, | 73 | void assert_long_long(const char *file, int line, |
71 | const char *a1, const char *a2, | 74 | const char *a1, const char *a2, |
72 | long long aa1, long long aa2, enum test_predicate pred); | 75 | long long aa1, long long aa2, enum test_predicate pred); |
@@ -110,6 +113,8 @@ void assert_u64(const char *file, int line, | |||
110 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) | 113 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) |
111 | #define ASSERT_U_INT_EQ(a1, a2) \ | 114 | #define ASSERT_U_INT_EQ(a1, a2) \ |
112 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) | 115 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) |
116 | #define ASSERT_LONG_EQ(a1, a2) \ | ||
117 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) | ||
113 | #define ASSERT_LONG_LONG_EQ(a1, a2) \ | 118 | #define ASSERT_LONG_LONG_EQ(a1, a2) \ |
114 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) | 119 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_EQ) |
115 | #define ASSERT_CHAR_EQ(a1, a2) \ | 120 | #define ASSERT_CHAR_EQ(a1, a2) \ |
@@ -139,6 +144,8 @@ void assert_u64(const char *file, int line, | |||
139 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) | 144 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) |
140 | #define ASSERT_U_INT_NE(a1, a2) \ | 145 | #define ASSERT_U_INT_NE(a1, a2) \ |
141 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) | 146 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) |
147 | #define ASSERT_LONG_NE(a1, a2) \ | ||
148 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) | ||
142 | #define ASSERT_LONG_LONG_NE(a1, a2) \ | 149 | #define ASSERT_LONG_LONG_NE(a1, a2) \ |
143 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) | 150 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_NE) |
144 | #define ASSERT_CHAR_NE(a1, a2) \ | 151 | #define ASSERT_CHAR_NE(a1, a2) \ |
@@ -166,6 +173,8 @@ void assert_u64(const char *file, int line, | |||
166 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) | 173 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) |
167 | #define ASSERT_U_INT_LT(a1, a2) \ | 174 | #define ASSERT_U_INT_LT(a1, a2) \ |
168 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) | 175 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) |
176 | #define ASSERT_LONG_LT(a1, a2) \ | ||
177 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) | ||
169 | #define ASSERT_LONG_LONG_LT(a1, a2) \ | 178 | #define ASSERT_LONG_LONG_LT(a1, a2) \ |
170 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) | 179 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LT) |
171 | #define ASSERT_CHAR_LT(a1, a2) \ | 180 | #define ASSERT_CHAR_LT(a1, a2) \ |
@@ -193,6 +202,8 @@ void assert_u64(const char *file, int line, | |||
193 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) | 202 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) |
194 | #define ASSERT_U_INT_LE(a1, a2) \ | 203 | #define ASSERT_U_INT_LE(a1, a2) \ |
195 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) | 204 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) |
205 | #define ASSERT_LONG_LE(a1, a2) \ | ||
206 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) | ||
196 | #define ASSERT_LONG_LONG_LE(a1, a2) \ | 207 | #define ASSERT_LONG_LONG_LE(a1, a2) \ |
197 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) | 208 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_LE) |
198 | #define ASSERT_CHAR_LE(a1, a2) \ | 209 | #define ASSERT_CHAR_LE(a1, a2) \ |
@@ -220,6 +231,8 @@ void assert_u64(const char *file, int line, | |||
220 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) | 231 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) |
221 | #define ASSERT_U_INT_GT(a1, a2) \ | 232 | #define ASSERT_U_INT_GT(a1, a2) \ |
222 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) | 233 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) |
234 | #define ASSERT_LONG_GT(a1, a2) \ | ||
235 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) | ||
223 | #define ASSERT_LONG_LONG_GT(a1, a2) \ | 236 | #define ASSERT_LONG_LONG_GT(a1, a2) \ |
224 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) | 237 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GT) |
225 | #define ASSERT_CHAR_GT(a1, a2) \ | 238 | #define ASSERT_CHAR_GT(a1, a2) \ |
@@ -247,6 +260,8 @@ void assert_u64(const char *file, int line, | |||
247 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) | 260 | assert_size_t(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) |
248 | #define ASSERT_U_INT_GE(a1, a2) \ | 261 | #define ASSERT_U_INT_GE(a1, a2) \ |
249 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) | 262 | assert_u_int(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) |
263 | #define ASSERT_LONG_GE(a1, a2) \ | ||
264 | assert_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) | ||
250 | #define ASSERT_LONG_LONG_GE(a1, a2) \ | 265 | #define ASSERT_LONG_LONG_GE(a1, a2) \ |
251 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) | 266 | assert_long_long(__FILE__, __LINE__, #a1, #a2, a1, a2, TEST_GE) |
252 | #define ASSERT_CHAR_GE(a1, a2) \ | 267 | #define ASSERT_CHAR_GE(a1, a2) \ |