diff options
-rw-r--r-- | src/test/test-util.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c index 476fa09dbf..9ba984c75e 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -97,12 +97,26 @@ static void test_default_term_for_tty(void) { puts(default_term_for_tty("console")); } +static void test_memdup_multiply(void) { + int org[] = {1, 2, 3}; + int *dup; + + dup = (int*)memdup_multiply(org, sizeof(int), 3); + + assert_se(dup); + assert_se(dup[0] == 1); + assert_se(dup[1] == 2); + assert_se(dup[2] == 3); + free(dup); +} + int main(int argc, char *argv[]) { test_streq_ptr(); test_first_word(); test_parse_boolean(); test_default_term_for_tty(); test_foreach_word_quoted(); + test_memdup_multiply(); return 0; } |