diff options
Diffstat (limited to 'test/alloc')
-rw-r--r-- | test/alloc/memdup.c | 11 | ||||
-rw-r--r-- | test/alloc/meson.build | 3 |
2 files changed, 14 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; +} diff --git a/test/alloc/meson.build b/test/alloc/meson.build index e69de29..8e8c5cd 100644 --- a/test/alloc/meson.build +++ b/test/alloc/meson.build @@ -0,0 +1,3 @@ +test('memdup', executable('memdup', 'memdup.c', + dependencies : calt +)) |