From ad379273107312ae95e76ce9f914457a04aea312 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 29 Apr 2019 14:46:56 +0100 Subject: [PATCH] test: add mapping tests for degenerate cases --- test/mapping/mutt_map_get_name.c | 4 ++++ test/mapping/mutt_map_get_value.c | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/test/mapping/mutt_map_get_name.c b/test/mapping/mutt_map_get_name.c index 2dee5e312..3f27ba7d0 100644 --- a/test/mapping/mutt_map_get_name.c +++ b/test/mapping/mutt_map_get_name.c @@ -28,4 +28,8 @@ void test_mutt_map_get_name(void) { // const char *mutt_map_get_name(int val, const struct Mapping *map); + + { + TEST_CHECK(!mutt_map_get_name(0, NULL)); + } } diff --git a/test/mapping/mutt_map_get_value.c b/test/mapping/mutt_map_get_value.c index f44aaae2d..7e1cac6a8 100644 --- a/test/mapping/mutt_map_get_value.c +++ b/test/mapping/mutt_map_get_value.c @@ -28,4 +28,13 @@ void test_mutt_map_get_value(void) { // int mutt_map_get_value(const char *name, const struct Mapping *map); + + { + struct Mapping mapping = { 0 }; + TEST_CHECK(mutt_map_get_value(NULL, &mapping) != 0); + } + + { + TEST_CHECK(mutt_map_get_value("apple", NULL) != 0); + } } -- 2.40.0