tests/test_list.c

changeset 1225
086e63c8dd06
parent 1163
68ff0839bc6a
equal deleted inserted replaced
1224:e20e100fa71f 1225:086e63c8dd06
966 } 966 }
967 } 967 }
968 968
969 CX_TEST(test_empty_list_at) { 969 CX_TEST(test_empty_list_at) {
970 CX_TEST_DO { 970 CX_TEST_DO {
971 // the placeholder empty list
971 CX_TEST_ASSERT(cxListAt(cxEmptyList, 0) == NULL); 972 CX_TEST_ASSERT(cxListAt(cxEmptyList, 0) == NULL);
972 CX_TEST_ASSERT(cxListAt(cxEmptyList, 1) == NULL); 973 CX_TEST_ASSERT(cxListAt(cxEmptyList, 1) == NULL);
974 // a "true" empty list
975 CxList *list = cxLinkedListCreateSimple(sizeof(int));
976 CX_TEST_ASSERT(cxListAt(list, 0) == NULL);
977 CX_TEST_ASSERT(cxListAt(list, 1) == NULL);
978 cxListFree(list);
973 } 979 }
974 } 980 }
975 981
976 CX_TEST(test_empty_list_find) { 982 CX_TEST(test_empty_list_find) {
977 int x = 42, y = 1337; 983 int x = 42, y = 1337;
978 CX_TEST_DO { 984 CX_TEST_DO {
985 // the placeholder empty list
979 CX_TEST_ASSERT(cxListFind(cxEmptyList, &x) == 0); 986 CX_TEST_ASSERT(cxListFind(cxEmptyList, &x) == 0);
980 CX_TEST_ASSERT(cxListFind(cxEmptyList, &y) == 0); 987 CX_TEST_ASSERT(cxListFindRemove(cxEmptyList, &y) == 0);
988 // a "true" empty list
989 CxList *list = cxLinkedListCreateSimple(sizeof(int));
990 CX_TEST_ASSERT(cxListFind(list, &x) == 0);
991 CX_TEST_ASSERT(cxListFindRemove(list, &y) == 0);
992 cxListFree(list);
981 } 993 }
982 } 994 }
983 995
984 CX_TEST(test_empty_list_compare) { 996 CX_TEST(test_empty_list_compare) {
985 CxList *empty = cxEmptyList; 997 CxList *empty = cxEmptyList;

mercurial