summaryrefslogtreecommitdiff
path: root/unittests/lib/memalign.c
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/lib/memalign.c')
-rw-r--r--unittests/lib/memalign.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/unittests/lib/memalign.c b/unittests/lib/memalign.c
new file mode 100644
index 00000000..854c2744
--- /dev/null
+++ b/unittests/lib/memalign.c
@@ -0,0 +1,27 @@
+#include "../unittest.h"
+
+#include "../../lib/memalign.h"
+
+static void test_memalign_1(void)
+{
+ size_t align = 4096;
+ void *p = fio_memalign(align, 1234, false);
+
+ if (p)
+ CU_ASSERT_EQUAL(((int)(uintptr_t)p) & (align - 1), 0);
+}
+
+static struct fio_unittest_entry tests[] = {
+ {
+ .name = "memalign/1",
+ .fn = test_memalign_1,
+ },
+ {
+ .name = NULL,
+ },
+};
+
+CU_ErrorCode fio_unittest_lib_memalign(void)
+{
+ return fio_unittest_add_suite("lib/memalign.c", NULL, NULL, tests);
+}