diff options
| author | Peter Jones <pjones@redhat.com> | 2021-03-10 14:26:46 -0500 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2021-03-10 15:54:20 -0500 |
| commit | c722a590d08506f29ddb70c1c57c511a836efb7a (patch) | |
| tree | 8e72ee8b1faf0eda742210ab174ac9318772662d /include/test.h | |
| parent | 8d006f5c70b19d6e7f35f83e61880deb45b05977 (diff) | |
| download | efi-boot-shim-c722a590d08506f29ddb70c1c57c511a836efb7a.tar.gz efi-boot-shim-c722a590d08506f29ddb70c1c57c511a836efb7a.zip | |
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 <pjones@redhat.com>
Diffstat (limited to 'include/test.h')
| -rw-r--r-- | include/test.h | 14 |
1 files changed, 14 insertions, 0 deletions
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; \ |
