lib/memalign: remove smalloc()/sfree() dependency
[fio.git] / unittests / lib / memalign.c
1 #include <stdlib.h>
2 #include "../unittest.h"
3
4 #include "../../lib/memalign.h"
5
6 static void test_memalign_1(void)
7 {
8         size_t align = 4096;
9         void *p = __fio_memalign(align, 1234, malloc);
10
11         if (p)
12                 CU_ASSERT_EQUAL(((int)(uintptr_t)p) & (align - 1), 0);
13 }
14
15 static struct fio_unittest_entry tests[] = {
16         {
17                 .name   = "memalign/1",
18                 .fn     = test_memalign_1,
19         },
20         {
21                 .name   = NULL,
22         },
23 };
24
25 CU_ErrorCode fio_unittest_lib_memalign(void)
26 {
27         return fio_unittest_add_suite("lib/memalign.c", NULL, NULL, tests);
28 }