From b06ac622b1fe1a67b0e20e6dd02c686be357164c Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Mon, 29 Apr 2019 14:46:56 +0100 Subject: [PATCH] test: add memory tests for degenerate cases --- test/memory/mutt_mem_free.c | 11 +++++++++++ test/memory/mutt_mem_realloc.c | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/test/memory/mutt_mem_free.c b/test/memory/mutt_mem_free.c index f62082643..d31182ada 100644 --- a/test/memory/mutt_mem_free.c +++ b/test/memory/mutt_mem_free.c @@ -28,4 +28,15 @@ void test_mutt_mem_free(void) { // void mutt_mem_free(void *ptr); + + { + mutt_mem_free(NULL); + TEST_CHECK_(1, "mutt_mem_free(NULL)"); + } + + { + void *ptr = NULL; + mutt_mem_free(&ptr); + TEST_CHECK_(1, "mutt_mem_free(&ptr)"); + } } diff --git a/test/memory/mutt_mem_realloc.c b/test/memory/mutt_mem_realloc.c index 1e18d32f9..7e3afbdc1 100644 --- a/test/memory/mutt_mem_realloc.c +++ b/test/memory/mutt_mem_realloc.c @@ -28,4 +28,9 @@ void test_mutt_mem_realloc(void) { // void mutt_mem_realloc(void *ptr, size_t size); + + { + mutt_mem_realloc(NULL, 10); + TEST_CHECK_(1, "mutt_mem_realloc(NULL, 10)"); + } } -- 2.40.0