summaryrefslogtreecommitdiff
path: root/src/util.test.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.test.c')
-rw-r--r--src/util.test.c57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/util.test.c b/src/util.test.c
deleted file mode 100644
index c2f8462..0000000
--- a/src/util.test.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <stdlib.h>
-
-#include <kalmia.h>
-#include "util.h"
-#include "test/test.h"
-
-void next_array_element();
-
-void suite_util()
-{
- lily_run_test(next_array_element);
-}
-
-void next_array_element()
-{
- int *arr = NULL;
- size_t count = 0;
- size_t max = 0;
-
- int *next = kai_next_array_element((void**) &arr, &count, &max, sizeof(int));
- lily_assert_not_null(arr);
- lily_assert_not_null(next);
-
- lily_assert_ptr_equal(arr+0, next);
- lily_assert_int_equal(count, 1);
- lily_assert_int_equal(max, 1);
- *next = 2;
-
- next = kai_next_array_element((void**) &arr, &count, &max, sizeof(int));
-
- lily_assert_not_null(next);
- lily_assert_ptr_equal(arr+1, next);
- lily_assert_int_equal(count, 2);
- lily_assert_int_equal(max, 2);
- *next = 1;
-
- next = kai_next_array_element((void**) &arr, &count, &max, sizeof(int));
-
- lily_assert_not_null(next);
- lily_assert_ptr_equal(arr+2, next);
- lily_assert_int_equal(count, 3);
- lily_assert_int_equal(max, 4);
- *next = 3;
-
- next = kai_next_array_element((void**) &arr, &count, &max, sizeof(int));
-
- lily_assert_not_null(next);
- lily_assert_ptr_equal(arr+3, next);
- lily_assert_int_equal(count, 4);
- lily_assert_int_equal(max, 4);
- *next = 4;
-
- int expected[] = { 2, 1, 3, 4 };
- lily_assert_memory_equal(expected, arr, 4 * sizeof(int));
-
- free(arr);
-}