Browse Source

improving the test coverage a bit while watchin soccer

Stasik0 10 years ago
parent
commit
1f759b78b3
1 changed files with 26 additions and 0 deletions
  1. 26 0
      tests/check_indexedList.c

+ 26 - 0
tests/check_indexedList.c

@@ -28,6 +28,29 @@ _Bool matcher(void* payload){
 	return FALSE;
 }
 
+START_TEST(linkedList_test_destroyemptylist)
+{
+	UA_indexedList_List list;
+	UA_indexedList_init(&list);
+	ck_assert_int_eq(list.size, 0);
+	UA_indexedList_destroy(&list, UA_indexedList_defaultFreer);
+	ck_assert_int_eq(list.size, 0);
+}
+END_TEST
+
+START_TEST(linkedList_test_destroysingle)
+{
+	UA_indexedList_List list;
+	UA_indexedList_init(&list);
+	ck_assert_int_eq(list.size, 0);
+	UA_Int32* payload = (UA_Int32*)malloc(sizeof(*payload));
+	*payload = 10;
+	UA_indexedList_addValue(&list, 1, payload);
+	UA_indexedList_destroy(&list, UA_indexedList_defaultFreer);
+	ck_assert_int_eq(list.size, 0);
+}
+END_TEST
+	
 START_TEST(linkedList_test_basic)
 {
 
@@ -76,6 +99,7 @@ START_TEST(linkedList_test_basic)
 
 	ck_assert_int_eq(free_count, 2);
 	ck_assert_int_eq(list.size, 0);
+	
 }
 END_TEST
 
@@ -84,6 +108,8 @@ Suite*linkedList_testSuite(void)
 	Suite *s = suite_create("linkedList_test");
 	TCase *tc_core = tcase_create("Core");
 	tcase_add_test(tc_core, linkedList_test_basic);
+	tcase_add_test(tc_core, linkedList_test_destroyemptylist);
+	tcase_add_test(tc_core, linkedList_test_destroysingle);
 	suite_add_tcase(s,tc_core);
 	return s;
 }