]> granicus.if.org Git - neomutt/commitdiff
test: add string tests for degenerate cases
authorRichard Russon <rich@flatcap.org>
Mon, 15 Apr 2019 23:48:39 +0000 (00:48 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 16 Apr 2019 00:04:45 +0000 (01:04 +0100)
44 files changed:
test/string/mutt_str_adjust.c
test/string/mutt_str_append_item.c
test/string/mutt_str_asprintf.c
test/string/mutt_str_atoi.c
test/string/mutt_str_atol.c
test/string/mutt_str_atos.c
test/string/mutt_str_atoui.c
test/string/mutt_str_atoul.c
test/string/mutt_str_atoull.c
test/string/mutt_str_dequote_comment.c
test/string/mutt_str_find_word.c
test/string/mutt_str_getenv.c
test/string/mutt_str_inline_replace.c
test/string/mutt_str_is_ascii.c
test/string/mutt_str_lws_len.c
test/string/mutt_str_lws_rlen.c
test/string/mutt_str_next_word.c
test/string/mutt_str_pretty_size.c
test/string/mutt_str_remall_strcasestr.c
test/string/mutt_str_remove_trailing_ws.c
test/string/mutt_str_replace.c
test/string/mutt_str_rstrnstr.c
test/string/mutt_str_skip_email_wsp.c
test/string/mutt_str_skip_whitespace.c
test/string/mutt_str_split.c
test/string/mutt_str_startswith.c
test/string/mutt_str_strcasecmp.c
test/string/mutt_str_strcasestr.c
test/string/mutt_str_strcat.c
test/string/mutt_str_strchrnul.c
test/string/mutt_str_strcmp.c
test/string/mutt_str_strcoll.c
test/string/mutt_str_strdup.c
test/string/mutt_str_strfcpy.c
test/string/mutt_str_stristr.c
test/string/mutt_str_strlen.c
test/string/mutt_str_strlower.c
test/string/mutt_str_strncasecmp.c
test/string/mutt_str_strncat.c
test/string/mutt_str_strncmp.c
test/string/mutt_str_strnfcpy.c
test/string/mutt_str_substr_cpy.c
test/string/mutt_str_substr_dup.c
test/string/mutt_str_word_casecmp.c

index 09fd64994546cc77936695ab0a4364381a5a851e..86c69d233ffcf21fd4386c9e415026b98a2167bb 100644 (file)
 void test_mutt_str_adjust(void)
 {
   // void mutt_str_adjust(char **p);
+
+  {
+    mutt_str_adjust(NULL);
+    TEST_CHECK_(1, "mutt_str_adjust(NULL)");
+  }
+
+  {
+    char *ptr = NULL;
+    mutt_str_adjust(&ptr);
+    TEST_CHECK_(1, "mutt_str_adjust(&ptr)");
+  }
 }
index f44386450e3804209dd7b538e7911e27f380cc8e..3eed69d5bedc1ff6d842eabdcf384f619db969b8 100644 (file)
 void test_mutt_str_append_item(void)
 {
   // void mutt_str_append_item(char **str, const char *item, int sep);
+
+  {
+    mutt_str_append_item(NULL, "apple", ',');
+    TEST_CHECK_(1, "mutt_str_append_item(NULL, \"apple\", ',')");
+  }
+
+  {
+    char *ptr = NULL;
+    mutt_str_append_item(&ptr, NULL, ',');
+    TEST_CHECK_(1, "mutt_str_append_item(&ptr, NULL, ',')");
+  }
 }
index b7b8c59cce75f73554bf64c953f6786b8968ace3..cdf4fda60c777158eb5ac0396a7ace807812c4ac 100644 (file)
 #define TEST_NO_MAIN
 #include "acutest.h"
 #include "config.h"
+#include "mutt/mutt.h"
 
 void test_mutt_str_asprintf(void)
 {
   // int mutt_str_asprintf(char **strp, const char *fmt, ...);
+
+  {
+    TEST_CHECK(mutt_str_asprintf(NULL, "dummy") == -1);
+  }
+
+  {
+    char *ptr = NULL;
+    TEST_CHECK(mutt_str_asprintf(&ptr, "dummy") == -1);
+  }
+
+  {
+    char *ptr = NULL;
+    TEST_CHECK(mutt_str_asprintf(&ptr, NULL) == -1);
+  }
 }
index edf8ce10e7d9ee8d3537de9dac2f30c9d9dc17f1..25c906a7e0b31435954a5c3904af8c44edcd05ee 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_atoi(void)
 {
   // int mutt_str_atoi(const char *str, int *dst);
+
+  {
+    TEST_CHECK(mutt_str_atoi(NULL, NULL) == 0);
+  }
 }
index 0bd7c0f41fdb8cbdec125ea63107d08b1e83afe2..e3a727a415bb2a4524b491e33839f86fedd5e284 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_atol(void)
 {
   // int mutt_str_atol(const char *str, long *dst);
+
+  {
+    TEST_CHECK(mutt_str_atol(NULL, NULL) == 0);
+  }
 }
index 3424a577dd25bb5e079a7d6acdbe69a4e9a16bff..e25dc4a745f859c89910e4ccb18bd261e97040b7 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_atos(void)
 {
   // int mutt_str_atos(const char *str, short *dst);
+
+  {
+    TEST_CHECK(mutt_str_atos(NULL, NULL) == 0);
+  }
 }
index 0631fd4dbbec47ab298f8fac4be23ddbe155284f..8c83ef2c0f9dbbd09104041d2d35e702b2a7a2a7 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_atoui(void)
 {
   // int mutt_str_atoui(const char *str, unsigned int *dst);
+
+  {
+    TEST_CHECK(mutt_str_atoui(NULL, NULL) == 0);
+  }
 }
index 3e0b6267343d464bd8108786b5583c9b664fbd9a..5ec4b88898fabc6d7d6321ef866ff6393870d70e 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_atoul(void)
 {
   // int mutt_str_atoul(const char *str, unsigned long *dst);
+
+  {
+    TEST_CHECK(mutt_str_atoul(NULL, NULL) == 0);
+  }
 }
index b5e5f47331a7baf8a5df78fd2034dbfdfa87022f..192ddf6af2e9088b7c90ed39bae9ad33efd7f37c 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_atoull(void)
 {
   // int mutt_str_atoull(const char *str, unsigned long long *dst);
+
+  {
+    TEST_CHECK(mutt_str_atoull(NULL, NULL) == 0);
+  }
 }
index 56924eb9cffb85fdf7e447896cea04827586e8c9..8e4b19b6d7d18ee0d2e5aa7ab96dee47c3b20f9d 100644 (file)
 void test_mutt_str_dequote_comment(void)
 {
   // void mutt_str_dequote_comment(char *s);
+
+  {
+    mutt_str_dequote_comment(NULL);
+    TEST_CHECK_(1, "mutt_str_dequote_comment(NULL)");
+  }
+
 }
index 603da3050f36c8d7c379495882307809f0371b40..d45cdd22d00becabd9fffc49aa41ee540cfdf9ad 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_find_word(void)
 {
   // const char *mutt_str_find_word(const char *src);
+
+  {
+    TEST_CHECK(mutt_str_find_word(NULL) == NULL);
+  }
 }
index e9f09e3cdb62a6b8eeab1f50936c7906266e0a89..b8116113f21a58e7e2333de4386ce189d4dc195c 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_getenv(void)
 {
   // const char *mutt_str_getenv(const char *name);
+
+  {
+    TEST_CHECK(mutt_str_getenv(NULL) == NULL);
+  }
 }
index d799fc72c10ee84fdc76119624ea2e7dfe388b3c..1c275e738f6d4bfda1211fa4ce7c7643f8a2d353 100644 (file)
 void test_mutt_str_inline_replace(void)
 {
   // bool mutt_str_inline_replace(char *buf, size_t buflen, size_t xlen, const char *rstr);
+
+  {
+    TEST_CHECK(mutt_str_inline_replace(NULL, 10, 2, "apple") == false);
+  }
+
+  {
+    char buf[32] = "banana";
+    TEST_CHECK(mutt_str_inline_replace(buf, sizeof(buf), 2, NULL) == false);
+  }
 }
index 38f5dc277375f956cc75b59c30428446547e9176..333f1497bc8cc75169a565fe05aeddaffaf834c0 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_is_ascii(void)
 {
   // bool mutt_str_is_ascii(const char *p, size_t len);
+
+  {
+    TEST_CHECK(mutt_str_is_ascii(NULL, 10) == true);
+  }
 }
index b39c296e2e1c552113834ed3e24cfe1a7197801f..e6b0eadd3e3e5b82fb25a32e15bb25eb0d312cde 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_lws_len(void)
 {
   // size_t mutt_str_lws_len(const char *s, size_t n);
+
+  {
+    TEST_CHECK(mutt_str_lws_len(NULL, 10) == 0);
+  }
 }
index b33fba657ece71fad4baac8872f0383a5dffbc3b..faa55bec72942b560750614c3e28d4b88f663ded 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_lws_rlen(void)
 {
   // size_t mutt_str_lws_rlen(const char *s, size_t n);
+
+  {
+    TEST_CHECK(mutt_str_lws_rlen(NULL, 10) == 0);
+  }
 }
index 3d256adbe9460561a65fbbe5ef91e9fae3f9836c..0794090e52a77154a7209f716673ed87dc10ca87 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_next_word(void)
 {
   // const char *mutt_str_next_word(const char *s);
+
+  {
+    TEST_CHECK(mutt_str_next_word(NULL) == NULL);
+  }
 }
index f08ece3d9bbec6acc692ae184a035da5a3be064a..1b73e1c62d89d6971bdaee9619120374ce7329d7 100644 (file)
@@ -28,4 +28,9 @@
 void test_mutt_str_pretty_size(void)
 {
   // void mutt_str_pretty_size(char *buf, size_t buflen, size_t num);
+
+  {
+    mutt_str_pretty_size(NULL, 10, 1234);
+    TEST_CHECK_(1, "mutt_str_pretty_size(NULL, 10, 1234)");
+  }
 }
index b1c800c9420d0f51371818d6b881bc4948c31dae..5da76e92b778b3707169d0ba159bed6a6617013b 100644 (file)
 void test_mutt_str_remall_strcasestr(void)
 {
   // int mutt_str_remall_strcasestr(char *str, const char *target);
+
+  {
+    TEST_CHECK(mutt_str_remall_strcasestr(NULL, "apple") == 1);
+  }
+
+  {
+    TEST_CHECK(mutt_str_remall_strcasestr("apple", NULL) == 1);
+  }
+
+  {
+    TEST_CHECK(mutt_str_remall_strcasestr(NULL, NULL) == 1);
+  }
 }
index 3ea564a2ee470b112d03432977c15b9af91ce039..6cb8dffe4238c6057f6a78f41e698ed6e36fe1c3 100644 (file)
@@ -28,4 +28,9 @@
 void test_mutt_str_remove_trailing_ws(void)
 {
   // void mutt_str_remove_trailing_ws(char *s);
+
+  {
+    mutt_str_remove_trailing_ws(NULL);
+    TEST_CHECK_(1, "mutt_str_remove_trailing_ws(NULL)");
+  }
 }
index 30f8361e9a979cd8e977e63579812861a73e8bae..878c0d91e71fa99543975e0d4d6d3a8b1adbcb61 100644 (file)
 void test_mutt_str_replace(void)
 {
   // void mutt_str_replace(char **p, const char *s);
+
+  {
+    mutt_str_replace(NULL, NULL);
+    TEST_CHECK_(1, "mutt_str_replace(NULL, NULL)");
+  }
+
+  {
+    mutt_str_replace(NULL, "apple");
+    TEST_CHECK_(1, "mutt_str_replace(NULL, \"apple\")");
+  }
+
+  {
+    char *ptr = NULL;
+    mutt_str_replace(&ptr, NULL);
+    TEST_CHECK_(1, "mutt_str_replace(&ptr, NULL)");
+  }
 }
index e4d10cfa6c35a6ab92a41a769b117ac9f6ff9228..bfd46f4b4e6437ac7143f98cab43d9d296d87589 100644 (file)
 void test_mutt_str_rstrnstr(void)
 {
   // const char *mutt_str_rstrnstr(const char *haystack, size_t haystack_length, const char *needle);
+
+  {
+    TEST_CHECK(mutt_str_rstrnstr(NULL, 10, "apple") == NULL);
+  }
+
+  {
+    TEST_CHECK(mutt_str_rstrnstr("apple", 10, NULL) == NULL);
+  }
 }
index 48d41fc2883563d8fd2e02002e83924942d0a80e..1c122ff8fe3c84d9b37822661848c4f2ebd026ab 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_skip_email_wsp(void)
 {
   // char *mutt_str_skip_email_wsp(const char *s);
+
+  {
+    TEST_CHECK(mutt_str_skip_email_wsp(NULL) == NULL);
+  }
 }
index 1f66181ac7a0fd347685811585db3dbb5f34c797..abe944fe9e337d15afd917cf0cad13cbdc534ce1 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_skip_whitespace(void)
 {
   // char *mutt_str_skip_whitespace(char *p);
+
+  {
+    TEST_CHECK(mutt_str_skip_whitespace(NULL) == NULL);
+  }
 }
index 9bd793ded950d8c01297ecab6b529f2418b89add..2b2d049256a33880b78fb9603fa6f386a85b4a5c 100644 (file)
@@ -28,4 +28,9 @@
 void test_mutt_str_split(void)
 {
   // struct ListHead mutt_str_split(const char *src, char sep);
+
+  {
+    struct ListHead head = mutt_str_split(NULL, ',');
+    TEST_CHECK(STAILQ_EMPTY(&head));
+  }
 }
index 7634e63af2a14cd0dd2b658ffd204c6b332e332b..92bdd9023165b1f361ba5aeffb120df9943b02ea 100644 (file)
 void test_mutt_str_startswith(void)
 {
   // size_t mutt_str_startswith(const char *str, const char *prefix, enum CaseSensitivity cs);
+
+  {
+    TEST_CHECK(mutt_str_startswith(NULL, "apple", CASE_MATCH) == 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_startswith("apple", NULL, CASE_MATCH) == 0);
+  }
 }
index 9a36eca12031d667a3b15f73f09e6748692f1504..6d01db4a7e5fd6cacc517740b48d6fc4f9398bc8 100644 (file)
 void test_mutt_str_strcasecmp(void)
 {
   // int mutt_str_strcasecmp(const char *a, const char *b);
+
+  {
+    TEST_CHECK(mutt_str_strcasecmp(NULL, "apple") != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strcasecmp("apple", NULL) != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strcasecmp(NULL, NULL) == 0);
+  }
 }
index 2dde38a6cf34595696e008786836b36d1057a2f1..df9af9a6044d669e3e584084afba952389004aa8 100644 (file)
 void test_mutt_str_strcasestr(void)
 {
   // const char *mutt_str_strcasestr(const char *haystack, const char *needle);
+
+  {
+    TEST_CHECK(mutt_str_strcasestr(NULL, "apple") == NULL);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strcasestr("apple", NULL) == NULL);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strcasestr(NULL, NULL) == NULL);
+  }
 }
index d12ee747e3fbb7ffa4453e03a3ff91844dbb09f3..dd5313d11c8aedef1380fa4609de9374f0c91dac 100644 (file)
 void test_mutt_str_strcat(void)
 {
   // char *mutt_str_strcat(char *buf, size_t buflen, const char *s);
+
+  {
+    TEST_CHECK(mutt_str_strcat(NULL, 10, "apple") == NULL);
+  }
+
+  {
+    char buf[32] = { 0 };
+    TEST_CHECK(mutt_str_strcat(buf, sizeof(buf), NULL) == buf);
+  }
 }
index af8e7bca626e3cd29c60240d66fa6fea003869c7..1fe9e6fc21d2efe8280b23b58392fed1ed72ecfc 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_strchrnul(void)
 {
   // const char *mutt_str_strchrnul(const char *s, char c);
+
+  {
+    TEST_CHECK(mutt_str_strchrnul(NULL, 'a') == NULL);
+  }
 }
index fd6ee1d465209f7c7ff209c6e59a16da34198627..402bbe8cd6683da27a83924d2cf5fe658f0205c6 100644 (file)
 void test_mutt_str_strcmp(void)
 {
   // int mutt_str_strcmp(const char *a, const char *b);
+
+  {
+    TEST_CHECK(mutt_str_strcmp(NULL, "apple") != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strcmp("apple", NULL) != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strcmp(NULL, NULL) == 0);
+  }
 }
index 827eed1dce42aa3e93f74ac568ec1539d6c9ee81..88ab0ba994e2cae6e76fbfe36fec45ce2b460c78 100644 (file)
 void test_mutt_str_strcoll(void)
 {
   // int mutt_str_strcoll(const char *a, const char *b);
+
+  {
+    TEST_CHECK(mutt_str_strcoll(NULL, "apple") != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strcoll("apple", NULL) != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strcoll(NULL, NULL) == 0);
+  }
 }
index 4fc4c4e370abf8f1948362d134335ac506124d98..f1baf676281f4d2ab03679c24c82348a08f02243 100644 (file)
 void test_mutt_str_strdup(void)
 {
   // char *mutt_str_strdup(const char *str);
+
+  {
+    TEST_CHECK(mutt_str_strdup(NULL) == NULL);
+  }
+
+  {
+    char *ptr = NULL;
+    TEST_CHECK(mutt_str_strdup(ptr) == NULL);
+  }
 }
index 8d742b86fde91e4751a8465f3126e928a0584a76..0962d0364d27fa7f41ad9709ccf4796fbdea5657 100644 (file)
 void test_mutt_str_strfcpy(void)
 {
   // size_t mutt_str_strfcpy(char *dest, const char *src, size_t dsize);
+
+  {
+    TEST_CHECK(mutt_str_strfcpy(NULL, "apple", 10) == 0);
+  }
+
+  {
+    char buf[32] = { 0 };
+    TEST_CHECK(mutt_str_strfcpy(buf, NULL, sizeof(buf)) == 0);
+  }
 }
index 9ce561d90b83e0602daa1c3868ca835c278d5bd6..3f6eb0ad20a28935b05119a52742484320dbf7f6 100644 (file)
 void test_mutt_str_stristr(void)
 {
   // const char *mutt_str_stristr(const char *haystack, const char *needle);
+
+  {
+    TEST_CHECK(mutt_str_stristr(NULL, "apple") == NULL);
+  }
+
+  {
+    char *haystack = "apple";
+    TEST_CHECK(mutt_str_stristr(haystack, NULL) == haystack);
+  }
+
+  {
+    TEST_CHECK(mutt_str_stristr(NULL, NULL) == NULL);
+  }
 }
index 3d29c993b62b8fd90c87e3eb3ef0dd4afccf3ed4..2f2d171b81d7bd3dcfadcd53c51af4ff07b1e229 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_strlen(void)
 {
   // size_t mutt_str_strlen(const char *a);
+
+  {
+    TEST_CHECK(mutt_str_strlen(NULL) == 0);
+  }
 }
index 6915a876f6ab05cf94407217901cc01ccbeaa20b..6e7714310a5a66f698a6da82d3e9d061fd9ccf71 100644 (file)
@@ -28,4 +28,8 @@
 void test_mutt_str_strlower(void)
 {
   // char *mutt_str_strlower(char *s);
+
+  {
+    TEST_CHECK(mutt_str_strlower(NULL) == NULL);
+  }
 }
index 7acd1a643ed255734c99423edf1751ade5cd7e21..7cf565b9c6f99e47e75faa8ebc251f67ff7866fb 100644 (file)
 void test_mutt_str_strncasecmp(void)
 {
   // int mutt_str_strncasecmp(const char *a, const char *b, size_t l);
+
+  {
+    TEST_CHECK(mutt_str_strncasecmp(NULL, "apple", 3) != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strncasecmp("apple", NULL, 3) != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strncasecmp(NULL, NULL, 3) == 0);
+  }
 }
index 8435291368f8934d9ddd600bffe504572db3a932..f239fde70064bc691174ebb9b426b49017584f14 100644 (file)
 void test_mutt_str_strncat(void)
 {
   // char *mutt_str_strncat(char *d, size_t l, const char *s, size_t sl);
+
+  {
+    TEST_CHECK(mutt_str_strncat(NULL, 10, "apple", 5) == NULL);
+  }
+
+  {
+    char buf[32] = { 0 };
+    TEST_CHECK(mutt_str_strncat(buf, sizeof(buf), NULL, 5) == buf);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strncat(NULL, 10, NULL, 5) == NULL);
+  }
 }
index ad494ba38efadf12d1dadddc15a0779a9ed52749..3270bf13329855a80fa5eeda1037d35edb53bf86 100644 (file)
 void test_mutt_str_strncmp(void)
 {
   // int mutt_str_strncmp(const char *a, const char *b, size_t l);
+
+  {
+    TEST_CHECK(mutt_str_strncmp(NULL, "apple", 5) != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strncmp("apple", NULL, 5) != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strncmp(NULL, NULL, 5) == 0);
+  }
 }
index 81f19610ad6e290d417fa6d4cec5ee12c37122e1..165db46571eb0d7ff8c612690d238282b9465d38 100644 (file)
 void test_mutt_str_strnfcpy(void)
 {
   // size_t mutt_str_strnfcpy(char *dest, const char *src, size_t n, size_t dsize);
+
+  {
+    TEST_CHECK(mutt_str_strnfcpy(NULL, "apple", 5, 10) == 0);
+  }
+
+  {
+    char buf[32] = { 0 };
+    TEST_CHECK(mutt_str_strnfcpy(buf, NULL, 5, sizeof(buf)) == 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_strnfcpy(NULL, NULL, 5, 10) == 0);
+  }
 }
index a325e4a30b7221b6ccf212d42eb4c2ce3e4391aa..c0d68598844d22e95f69c76573d3fc7ff62e106d 100644 (file)
 void test_mutt_str_substr_cpy(void)
 {
   // char *mutt_str_substr_cpy(char *dest, const char *begin, const char *end, size_t destlen);
+
+  const char *str = "apple banana";
+
+  {
+    TEST_CHECK(mutt_str_substr_cpy(NULL, str + 3, str + 7, 32) == NULL);
+  }
+
+  {
+    char buf[32] = { 0 };
+    TEST_CHECK(mutt_str_substr_cpy(buf, NULL, str + 7, sizeof(buf)) == buf);
+  }
+
+  {
+    char buf[32] = { 0 };
+    TEST_CHECK(mutt_str_substr_cpy(buf, str + 3, NULL, sizeof(buf)) == buf);
+  }
 }
index 5d88726ef2b53641b4ba178817a5ce6ac5d153bc..c51cc63e6b6d01b8eb1604b11776c19c982f94fd 100644 (file)
 void test_mutt_str_substr_dup(void)
 {
   // char *mutt_str_substr_dup(const char *begin, const char *end);
+
+  const char *str = "apple banana";
+
+  {
+    TEST_CHECK(mutt_str_substr_dup(NULL, str + 7) == NULL);
+  }
 }
index e2c68000f8742957a0cbe442949de0b326d7fcd1..86dfe2eb91fc5720ebb188c4cbd67e6e84f1cefb 100644 (file)
 void test_mutt_str_word_casecmp(void)
 {
   // int mutt_str_word_casecmp(const char *a, const char *b);
+
+  {
+    TEST_CHECK(mutt_str_word_casecmp(NULL, "apple") != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_word_casecmp("apple", NULL) != 0);
+  }
+
+  {
+    TEST_CHECK(mutt_str_word_casecmp(NULL, NULL) == 0);
+  }
 }