6 static void destructor(void **data
) {
10 static int test_isds_list_free(struct isds_list
**list
, int destructor_hits
) {
15 if (destructor_hits
!= counter
)
16 FAIL_TEST("Destructor called wrong times: expected=%d, called=%d",
17 destructor_hits
, counter
);
22 FAIL_TEST("isds_list_free() did not null pointer");
28 int main(int argc
, char **argv
) {
30 INIT_TEST("isds_list_free()");
32 ABORT_UNIT("isds_init() failed");
35 /* isds_list_free() */
36 struct isds_list
*list
= NULL
;
37 TEST("NULL", test_isds_list_free
, NULL
, 0);
38 TEST("*NULL", test_isds_list_free
, &list
, 0);
41 TEST("One item without destructor", test_isds_list_free
, &list
, 0);
44 list
->destructor
= destructor
;
45 TEST("One item with destructor", test_isds_list_free
, &list
, 1);
48 list
->destructor
= destructor
;
49 TEST_CALLOC(list
->next
);
50 list
->next
->destructor
= destructor
;
51 TEST("Two items list", test_isds_list_free
, &list
, 2);