aboutsummaryrefslogtreecommitdiffstats
path: root/test/alloc/memdup.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/alloc/memdup.c')
-rw-r--r--test/alloc/memdup.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/alloc/memdup.c b/test/alloc/memdup.c
new file mode 100644
index 0000000..db40146
--- /dev/null
+++ b/test/alloc/memdup.c
@@ -0,0 +1,11 @@
+#include <alloc.h>
+#include <mem.h>
+
+static char const src[] = "hello";
+
+int main(void) {
+ void *dest = calt_memdup(src, sizeof(src));
+ int res = calt_memcmp(src, dest, sizeof(src)) == 0 ? 0 : 1;
+ calt_free(dest);
+ return res;
+}