diff options
Diffstat (limited to 'src/test/test-util.c')
-rw-r--r-- | src/test/test-util.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c index fde3fa0988..7619950320 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -2072,6 +2072,18 @@ static void test_tempfn(void) { free(ret); } +static void test_strcmp_ptr(void) { + assert_se(strcmp_ptr(NULL, NULL) == 0); + assert_se(strcmp_ptr("", NULL) > 0); + assert_se(strcmp_ptr("foo", NULL) > 0); + assert_se(strcmp_ptr(NULL, "") < 0); + assert_se(strcmp_ptr(NULL, "bar") < 0); + assert_se(strcmp_ptr("foo", "bar") > 0); + assert_se(strcmp_ptr("bar", "baz") < 0); + assert_se(strcmp_ptr("foo", "foo") == 0); + assert_se(strcmp_ptr("", "") == 0); +} + int main(int argc, char *argv[]) { log_parse_environment(); log_open(); @@ -2158,6 +2170,7 @@ int main(int argc, char *argv[]) { test_shell_maybe_quote(); test_parse_mode(); test_tempfn(); + test_strcmp_ptr(); return 0; } |