From c722a590d08506f29ddb70c1c57c511a836efb7a Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 10 Mar 2021 14:26:46 -0500 Subject: Add more string test cases. This adds test cases for the rest of our ASCII string functions. While doing so, it fixes two minor bugs: - strcasecmp() now handles utf8 correctly - strncpy() no longer does the stpncpy() behavior of clearing leftover buffer Signed-off-by: Peter Jones --- include/test.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/test.h') diff --git a/include/test.h b/include/test.h index 92d1314e..012ffc51 100644 --- a/include/test.h +++ b/include/test.h @@ -213,6 +213,20 @@ extern int debug; } \ }) +#define assert_negative_goto(a, label, fmt, ...) \ + ({ \ + int rc_ = assert_negative_as_expr(a, -1, fmt, ##__VA_ARGS__); \ + if (rc_ != 0) \ + goto label; \ + }) + +#define assert_positive_goto(a, label, fmt, ...) \ + ({ \ + int rc_ = assert_positive_as_expr(a, -1, fmt, ##__VA_ARGS__); \ + if (rc_ != 0) \ + goto label; \ + }) + #define test(x, ...) \ ({ \ int rc; \ -- cgit v1.2.3