From: Richard Russon Date: Mon, 29 Apr 2019 13:46:56 +0000 (+0100) Subject: test: add envelope tests for degenerate cases X-Git-Tag: 2019-10-25~233^2~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=85459cc8261c4035e46a5cc4efeb67414340038f;p=neomutt test: add envelope tests for degenerate cases --- diff --git a/test/envelope/mutt_env_cmp_strict.c b/test/envelope/mutt_env_cmp_strict.c index dc0ce3715..7495f375f 100644 --- a/test/envelope/mutt_env_cmp_strict.c +++ b/test/envelope/mutt_env_cmp_strict.c @@ -30,4 +30,14 @@ void test_mutt_env_cmp_strict(void) { // bool mutt_env_cmp_strict(const struct Envelope *e1, const struct Envelope *e2); + + { + struct Envelope envelope = { 0 }; + TEST_CHECK(!mutt_env_cmp_strict(NULL, &envelope)); + } + + { + struct Envelope envelope = { 0 }; + TEST_CHECK(!mutt_env_cmp_strict(&envelope, NULL)); + } } diff --git a/test/envelope/mutt_env_free.c b/test/envelope/mutt_env_free.c index 390c2f649..bf6349d70 100644 --- a/test/envelope/mutt_env_free.c +++ b/test/envelope/mutt_env_free.c @@ -30,4 +30,15 @@ void test_mutt_env_free(void) { // void mutt_env_free(struct Envelope **p); + + { + mutt_env_free(NULL); + TEST_CHECK_(1, "mutt_env_free(NULL)"); + } + + { + struct Envelope *envelope = NULL; + mutt_env_free(&envelope); + TEST_CHECK_(1, "mutt_env_free(&envelope)"); + } } diff --git a/test/envelope/mutt_env_merge.c b/test/envelope/mutt_env_merge.c index c342fa372..a9713d387 100644 --- a/test/envelope/mutt_env_merge.c +++ b/test/envelope/mutt_env_merge.c @@ -30,4 +30,25 @@ void test_mutt_env_merge(void) { // void mutt_env_merge(struct Envelope *base, struct Envelope **extra); + + { + struct Envelope envelope = { 0 }; + struct Envelope *envp = &envelope; + + mutt_env_merge(NULL, &envp); + TEST_CHECK_(1, "mutt_env_merge(NULL, &envp)"); + } + + { + struct Envelope base = { 0 }; + mutt_env_merge(&base, NULL); + TEST_CHECK_(1, "mutt_env_merge(&base, NULL)"); + } + + { + struct Envelope base = { 0 }; + struct Envelope *envp = NULL; + mutt_env_merge(&base, &envp); + TEST_CHECK_(1, "mutt_env_merge(&base, &envp)"); + } } diff --git a/test/envelope/mutt_env_to_intl.c b/test/envelope/mutt_env_to_intl.c index 69d5d40d5..dd23ebef2 100644 --- a/test/envelope/mutt_env_to_intl.c +++ b/test/envelope/mutt_env_to_intl.c @@ -30,4 +30,22 @@ void test_mutt_env_to_intl(void) { // int mutt_env_to_intl(struct Envelope *env, const char **tag, char **err); + + { + const char *tag = NULL; + char *err = NULL; + TEST_CHECK(mutt_env_to_intl(NULL, &tag, &err) == 1); + } + + { + struct Envelope envelope = { 0 }; + char *err = NULL; + TEST_CHECK(mutt_env_to_intl(&envelope, NULL, &err) == 0); + } + + { + struct Envelope envelope = { 0 }; + const char *tag = NULL; + TEST_CHECK(mutt_env_to_intl(&envelope, &tag, NULL) == 0); + } } diff --git a/test/envelope/mutt_env_to_local.c b/test/envelope/mutt_env_to_local.c index 030bc9512..6cbbf7e78 100644 --- a/test/envelope/mutt_env_to_local.c +++ b/test/envelope/mutt_env_to_local.c @@ -30,4 +30,9 @@ void test_mutt_env_to_local(void) { // void mutt_env_to_local(struct Envelope *env); + + { + mutt_env_to_local(NULL); + TEST_CHECK_(1, "mutt_env_to_local(NULL)"); + } }