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

index 94b5642fffa95e8b44247988f4e1fb16a0e3bf8e..a3ce044c0bb7c7cca91b76d65681f730353e6102 100644 (file)
 void test_mutt_email_cmp_strict(void)
 {
   // bool mutt_email_cmp_strict(const struct Email *e1, const struct Email *e2);
+
+  {
+    struct Email email = { 0 };
+    TEST_CHECK(!mutt_email_cmp_strict(NULL, &email));
+  }
+
+  {
+    struct Email email = { 0 };
+    TEST_CHECK(!mutt_email_cmp_strict(&email, NULL));
+  }
 }
index 15f01ed09d3ef81025c4e3aeb534af452fc68512..e8aa4b60d4397949524a961966a104bdacea1e21 100644 (file)
 void test_mutt_email_free(void)
 {
   // void mutt_email_free(struct Email **e);
+
+  {
+    mutt_email_free(NULL);
+    TEST_CHECK_(1, "mutt_email_free(NULL)");
+  }
+
+  {
+    struct Email *email = NULL;
+    mutt_email_free(&email);
+    TEST_CHECK_(1, "mutt_email_free(&email)");
+  }
 }
index 41b6234398fe27da44aa2ec94a6e125c6a0da295..4842910b76033a31b989563ad1af13e479fb5cb6 100644 (file)
@@ -30,4 +30,8 @@
 void test_mutt_email_size(void)
 {
   // size_t mutt_email_size(const struct Email *e);
+
+  {
+    TEST_CHECK(mutt_email_size(NULL) == 0);
+  }
 }