diff --git a/test_list.c b/test_list.c index 565eca2..f0b9e53 100644 --- a/test_list.c +++ b/test_list.c @@ -69,7 +69,7 @@ TEST(test_list_obtain__shall_allocate_a_list) { mem_reset_stat(); IntList list = list_obtain(); ASSERT_TRUE(list != 0, MSG("Expected non-null list")); - ASSERT_TRUE(mem_get_alloc_call_cnt() == exp_alloc_cnt, MSG("Expected mem_alloc being called exactly %d time(s)", exp_alloc_cnt)); + ASSERT_TRUE(mem_get_alloc_call_cnt() == exp_alloc_cnt, MSG("Expected mem_alloc being called exactly %d time(s), but was called %d time(s)", exp_alloc_cnt, mem_get_alloc_call_cnt())); ASSERT_TRUE(mem_is_allocated(list), MSG("Expected obtained list is allocated using mem_alloc")); if (list != 0) { free(list); @@ -102,7 +102,7 @@ TEST(test_list_obtain_failed__shall_not_allocate_a_list) { mem_block_allocs(true); IntList list = list_obtain(); ASSERT_TRUE(list == 0, MSG("Expected null list")); - ASSERT_TRUE(mem_get_alloc_call_cnt() == exp_alloc_cnt, MSG("Expected mem_alloc being called exactly %d time(s)", exp_alloc_cnt)); + ASSERT_TRUE(mem_get_alloc_call_cnt() == exp_alloc_cnt, MSG("Expected mem_alloc being called exactly %d time(s), but was called %d time(s)", exp_alloc_cnt, mem_get_alloc_call_cnt())); if (list != 0) { free(list); } @@ -548,11 +548,11 @@ TEST(test_list_get_size__shall_be_0_for_newly_obtained_list) { TEST(test_list_get_size__shall_reflect_number_of_values_after_adding_values) { IntList list = ASSERT_RESET_AND_NEW_VALID_LIST(); list_insert(list, 71); - ASSERT_TRUE(list_get_size(list) == 1, MSG("Expected that size of list is 1 after adding first value")); + ASSERT_TRUE(list_get_size(list) == 1, MSG("Expected that size of list is 1 after adding first value, but found size %d", list_get_size(list))); list_insert(list, 72); - ASSERT_TRUE(list_get_size(list) == 2, MSG("Expected that size of list is 2 after adding second value")); + ASSERT_TRUE(list_get_size(list) == 2, MSG("Expected that size of list is 2 after adding second value, but found size %d", list_get_size(list))); list_insert(list, 73); - ASSERT_TRUE(list_get_size(list) == 3, MSG("Expected that size of list is 3 after adding third value")); + ASSERT_TRUE(list_get_size(list) == 3, MSG("Expected that size of list is 3 after adding third value, but found size %d", list_get_size(list))); ASSERT_MEM_STATUS(4, 0); ASSERT_FREE_VALID_LIST(&list); } @@ -563,11 +563,11 @@ TEST(test_list_get_size__shall_reflect_number_of_values_after_removing_values) { list_insert(list, 82); list_insert(list, 83); list_remove_at(list, 0); - ASSERT_TRUE(list_get_size(list) == 2, MSG("Expected that size of list is 2 after removing first value")); + ASSERT_TRUE(list_get_size(list) == 2, MSG("Expected that size of list is 2 after removing first value, but found size %d", list_get_size(list))); list_remove_at(list, 1); - ASSERT_TRUE(list_get_size(list) == 1, MSG("Expected that size of list is 1 after removing second value")); + ASSERT_TRUE(list_get_size(list) == 1, MSG("Expected that size of list is 1 after removing second value, but found size %d", list_get_size(list))); list_remove_at(list, 0); - ASSERT_TRUE(list_get_size(list) == 0, MSG("Expected that size of list is 0 after removing third value")); + ASSERT_TRUE(list_get_size(list) == 0, MSG("Expected that size of list is 0 after removing third value, but found size %d", list_get_size(list))); ASSERT_MEM_STATUS(4, 3); ASSERT_FREE_VALID_LIST(&list); } @@ -578,7 +578,7 @@ TEST(test_list_get_size__shall_be_0_after_clear) { list_insert(list, 82); list_insert(list, 83); list_clear(list); - ASSERT_TRUE(list_get_size(list) == 0, MSG("Expected that size of list is 0 after clearing the list")); + ASSERT_TRUE(list_get_size(list) == 0, MSG("Expected that size of list is 0 after clearing the list, but found size %d", list_get_size(list))); ASSERT_MEM_STATUS(4, 3); ASSERT_FREE_VALID_LIST(&list); } @@ -775,9 +775,9 @@ TEST(test_list_it_obtain__shall_allocate_and_release_a_list_iterator_for_a_list) mem_reset_calls(); IntListIterator it = list_it_obtain(list); ASSERT_TRUE(it != 0, MSG("Expected non-null list iterator")); - ASSERT_TRUE(mem_get_alloc_call_cnt() == 1, MSG("Expected mem_alloc being called exactly %d time(s) for the iterator", 1)); + ASSERT_TRUE(mem_get_alloc_call_cnt() == 1, MSG("Expected mem_alloc being called exactly %d time(s) for the iterator, but was called %d time(s)", 1, mem_get_alloc_call_cnt())); list_it_release(&it); - ASSERT_TRUE(mem_get_free_call_cnt() == 1, MSG("Expected mem_free being called exactly %d time(s) for the iterator", 1)); + ASSERT_TRUE(mem_get_free_call_cnt() == 1, MSG("Expected mem_free being called exactly %d time(s) for the iterator, but was called %d time(s)", 1, mem_get_free_call_cnt())); list_release(&list); } @@ -788,9 +788,9 @@ TEST(test_list_it_obtain__shall_allocate_and_point_to_list_head) { IntListIterator it = list_it_obtain(list); ASSERT_TRUE(it != 0, MSG("Expected non-null list iterator")); ASSERT_TRUE(list_it_get(it) == 21, MSG("Expected list iterator pointing to list head (requires 'list_it_get()'")); - ASSERT_TRUE(mem_get_alloc_call_cnt() == 1, MSG("Expected mem_alloc being called exactly %d time(s) for the iterator", 1)); + ASSERT_TRUE(mem_get_alloc_call_cnt() == 1, MSG("Expected mem_alloc being called exactly %d time(s) for the iterator, but was called %d time(s)", 1, mem_get_alloc_call_cnt())); list_it_release(&it); - ASSERT_TRUE(mem_get_free_call_cnt() == 1, MSG("Expected mem_free being called exactly %d time(s) for the iterator", 1)); + ASSERT_TRUE(mem_get_free_call_cnt() == 1, MSG("Expected mem_free being called exactly %d time(s) for the iterator, but was called %d time(s)", 1, mem_get_free_call_cnt())); list_release(&list); } @@ -798,7 +798,7 @@ TEST(test_list_it_obtain__shall_not_allocate_a_list_iterator_for_an_invalid_list mem_reset_calls(); IntListIterator it = list_it_obtain(0); ASSERT_TRUE(it == 0, MSG("Expected null list iterator")); - ASSERT_TRUE(mem_get_alloc_call_cnt() == 0, MSG("Expected mem_alloc being called exactly %d time(s) for the iterator", 0)); + ASSERT_TRUE(mem_get_alloc_call_cnt() == 0, MSG("Expected mem_alloc being called exactly %d time(s) for the iterator, but was called %d time(s)", 0, mem_get_alloc_call_cnt())); } TEST(test_list_it_is_valid) {