]> granicus.if.org Git - neomutt/commitdiff
test: add rfc2047 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/rfc2047/rfc2047_decode.c
test/rfc2047/rfc2047_decode_addrlist.c
test/rfc2047/rfc2047_decode_envelope.c
test/rfc2047/rfc2047_encode.c
test/rfc2047/rfc2047_encode_addrlist.c
test/rfc2047/rfc2047_encode_envelope.c

index 2b25b5b95cc6184b4623cef3d08301b2e2a415f6..f9e9ab215d55f4a1daedb8abc2e9d065e2f7128e 100644 (file)
 void test_rfc2047_decode(void)
 {
   // void rfc2047_decode(char **pd);
+
+  {
+    rfc2047_decode(NULL);
+    TEST_CHECK_(1, "rfc2047_decode(NULL)");
+  }
+
+  {
+    char *pd = NULL;
+    rfc2047_decode(&pd);
+    TEST_CHECK_(1, "rfc2047_decode(&pd)");
+  }
 }
index ad0f1a12f02baf18d2309354ef5267dc068c3d24..a1302fc395bf29301d038e79f52b53195372891d 100644 (file)
@@ -30,4 +30,9 @@
 void test_rfc2047_decode_addrlist(void)
 {
   // void rfc2047_decode_addrlist(struct Address *a);
+
+  {
+    rfc2047_decode_addrlist(NULL);
+    TEST_CHECK_(1, "rfc2047_decode_addrlist(NULL)");
+  }
 }
index 163813238b46d1d1a71a5668318bfc1278808379..f152209ed2bf3b37b03b2d19eb89bbce4e8781e6 100644 (file)
@@ -30,4 +30,9 @@
 void test_rfc2047_decode_envelope(void)
 {
   // void rfc2047_decode_envelope(struct Envelope *env);
+
+  {
+    rfc2047_decode_envelope(NULL);
+    TEST_CHECK_(1, "rfc2047_decode_envelope(NULL)");
+  }
 }
index 404e38f584c91046a814a86ce4ef4aa42d6f7725..31ba958698a9acdef161461015d3e8c84f56695a 100644 (file)
 void test_rfc2047_encode(void)
 {
   // void rfc2047_encode(char **pd, const char *specials, int col, const char *charsets);
+
+  {
+    rfc2047_encode(NULL, AddressSpecials, 0, "apple");
+    TEST_CHECK_(1, "rfc2047_encode(NULL, AddressSpecials, 0, \"apple\")");
+  }
+
+  {
+    char *pd = NULL;
+    rfc2047_encode(&pd, NULL, 0, "apple");
+    TEST_CHECK_(1, "rfc2047_encode(&pd, NULL, 0, \"apple\")");
+  }
+
+  {
+    char *pd = NULL;
+    rfc2047_encode(&pd, AddressSpecials, 0, NULL);
+    TEST_CHECK_(1, "rfc2047_encode(&pd, AddressSpecials, 0, NULL)");
+  }
 }
index cdf5480e4fdc5af7053932bc087d24934f7403ee..4e07dd50c9e3797b8a84d0f2762cf2c68e827f65 100644 (file)
 void test_rfc2047_encode_addrlist(void)
 {
   // void rfc2047_encode_addrlist(struct Address *addr, const char *tag);
+
+  {
+    rfc2047_encode_addrlist(NULL, "apple");
+    TEST_CHECK_(1, "rfc2047_encode_addrlist(NULL, \"apple\")");
+  }
+
+  {
+    struct Address address = { 0 };
+    rfc2047_encode_addrlist(&address, NULL);
+    TEST_CHECK_(1, "rfc2047_encode_addrlist(&address, NULL)");
+  }
 }
index afe87f006407aa644ac25800f4102e1e9ae3c6c7..0f43c0b5448c2d8c8095ee81194d018282bbf649 100644 (file)
@@ -30,4 +30,9 @@
 void test_rfc2047_encode_envelope(void)
 {
   // void rfc2047_encode_envelope(struct Envelope *env);
+
+  {
+    rfc2047_encode_envelope(NULL);
+    TEST_CHECK_(1, "rfc2047_encode_envelope(NULL)");
+  }
 }