aboutsummaryrefslogtreecommitdiffstats
path: root/unit
diff options
context:
space:
mode:
Diffstat (limited to 'unit')
-rw-r--r--unit/ck-test.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/unit/ck-test.c b/unit/ck-test.c
index 01156f1..9c18dfb 100644
--- a/unit/ck-test.c
+++ b/unit/ck-test.c
@@ -1,12 +1,25 @@
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
#include "cklist.h"
-#include "stdio.h"
#define CK_UNIT_TESTS \
X(ck_list_init, "Initialize ck list") \
X(ck_list_add, "Add elements to ck list")
void ck_list_init() {
- printf("Test1\n");
+ cklist *ckl1 = list_make_new();
+ cklist *ckl2 = list_make_and_add("first");
+ list_add(ckl2, "second");
+ list_add(ckl1, "first");
+ list_add(ckl1, "second");
+ assert(strcmp(list_get_at(ckl1, 0),
+ list_get_at(ckl2, 0)) == 0);
+ assert(strcmp(list_get_at(ckl1, 1),
+ list_get_at(ckl2, 1)) == 0);
+ list_free(ckl1);
+ list_free(ckl2);
}
void ck_list_add() {