aboutsummaryrefslogblamecommitdiffstats
path: root/unit/ck-test.c
blob: b90757637905a3f7772f267688a8d24f632a5a95 (plain) (tree)
1
2
3
4
5
6
7
8
9



                   
                   
 


                                
                                                 
                                      
                                               

                     










                                            


                    


            
                
                                                 
                                                 
                                                 
                          



               
#include <assert.h>
#include <stdio.h>
#include <string.h>

#include "cklist.h"

/* total number of unit tests */
#define TOTAL 1

#define CK_UNIT_TESTS				\
  X(ck_list_init, "Basic cklist test")
  //  X(ck_list_add, "Add elements to ck list")

void ck_list_init() {
  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() {
}

int main() {
  int count = 1;
#define X(TEST, DESC)				\
  printf("[%d/%d] %s\n", count++, TOTAL, DESC); \
  TEST();					\
  printf("=> Passed\n\n");
  CK_UNIT_TESTS
#undef X
}