From f67f2c3d5b67f54dae2c2c2754f43b4351445c80 Mon Sep 17 00:00:00 2001 From: Anastasis Grammenos Date: Sun, 7 Oct 2018 20:00:43 +0300 Subject: add list_exists fucntion --- unit/ck-test.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'unit') diff --git a/unit/ck-test.c b/unit/ck-test.c index b907576..1264431 100644 --- a/unit/ck-test.c +++ b/unit/ck-test.c @@ -5,11 +5,11 @@ #include "cklist.h" /* total number of unit tests */ -#define TOTAL 1 +#define TOTAL 2 -#define CK_UNIT_TESTS \ - X(ck_list_init, "Basic cklist test") - // X(ck_list_add, "Add elements to ck list") +#define CK_UNIT_TESTS \ + X(ck_list_init, "Basic cklist test") \ + X(ck_list_exists, "Test list exists function") void ck_list_init() { cklist *ckl1 = list_make_new(); @@ -25,7 +25,14 @@ void ck_list_init() { list_free(ckl2); } -void ck_list_add() { +void ck_list_exists() { + cklist *ckl = list_make_new(); + list_add(ckl, "first"); + list_add(ckl, "second"); + assert(list_exists(ckl, "first")); + assert(list_exists(ckl, "second")); + assert(!list_exists(ckl, "thrid")); + list_free(ckl); } int main() { -- cgit v1.2.3