]> granicus.if.org Git - neomutt/commitdiff
test: add body tests for degenerate cases
authorRichard Russon <rich@flatcap.org>
Mon, 29 Apr 2019 13:46:55 +0000 (14:46 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 30 Apr 2019 10:22:04 +0000 (11:22 +0100)
test/body/mutt_body_cmp_strict.c
test/body/mutt_body_free.c

index ce7314810a5f8a63a41d47579622b5d7a6fb1264..ddeeffdb765d70d5635938f0e7e1946c85f2950b 100644 (file)
 void test_mutt_body_cmp_strict(void)
 {
   // bool mutt_body_cmp_strict(const struct Body *b1, const struct Body *b2);
+
+  {
+    struct Body body = { 0 };
+    TEST_CHECK(!mutt_body_cmp_strict(NULL, &body));
+  }
+
+  {
+    struct Body body = { 0 };
+    TEST_CHECK(!mutt_body_cmp_strict(&body, NULL));
+  }
 }
index d230a87465046e13e6a8bc93561e9a7cb61a31bd..7be5a33d6a1b284b0a9946c14505431863f26cde 100644 (file)
 void test_mutt_body_free(void)
 {
   // void mutt_body_free(struct Body **p);
+
+  {
+    mutt_body_free(NULL);
+    TEST_CHECK_(1, "mutt_body_free(NULL)");
+  }
+
+  {
+    struct Body *body = NULL;
+    mutt_body_free(&body);
+    TEST_CHECK_(1, "mutt_body_free(&body)");
+  }
 }