summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>2013-02-18 23:49:04 +0100
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>2013-02-18 23:57:36 +0100
commit0d585d82913f06cd6174dd8d35fe5aacc3e08719 (patch)
tree5732222ef3c7706f1f3f7988a515d2721dae526e
parent1e447e0a3cb3e98827938a182593056ddbb13b29 (diff)
tests: add test of memdup_multiply
-rw-r--r--src/test/test-util.c14
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;
}