934 } |
934 } |
935 } |
935 } |
936 |
936 |
937 CX_TEST(test_empty_list_iterator) { |
937 CX_TEST(test_empty_list_iterator) { |
938 CxList *list = cxEmptyList; |
938 CxList *list = cxEmptyList; |
|
939 |
|
940 CxIterator it1 = cxListIterator(list); |
|
941 CxIterator it2 = cxListBackwardsIterator(list); |
|
942 CxIterator it3 = cxListMutIterator(list); |
|
943 CxIterator it4 = cxListMutBackwardsIterator(list); |
|
944 |
|
945 CX_TEST_DO { |
|
946 CX_TEST_ASSERT(!cxIteratorValid(it1)); |
|
947 CX_TEST_ASSERT(!cxIteratorValid(it2)); |
|
948 CX_TEST_ASSERT(!cxIteratorValid(it3)); |
|
949 CX_TEST_ASSERT(!cxIteratorValid(it4)); |
|
950 |
|
951 int c = 0; |
|
952 cx_foreach(void*, data, it1) c++; |
|
953 cx_foreach(void*, data, it2) c++; |
|
954 cx_foreach(void*, data, it3) c++; |
|
955 cx_foreach(void*, data, it4) c++; |
|
956 CX_TEST_ASSERT(c == 0); |
|
957 } |
|
958 } |
|
959 |
|
960 CX_TEST(test_null_list_iterator) { |
|
961 CxList *list = NULL; |
939 |
962 |
940 CxIterator it1 = cxListIterator(list); |
963 CxIterator it1 = cxListIterator(list); |
941 CxIterator it2 = cxListBackwardsIterator(list); |
964 CxIterator it2 = cxListBackwardsIterator(list); |
942 CxIterator it3 = cxListMutIterator(list); |
965 CxIterator it3 = cxListMutIterator(list); |
943 CxIterator it4 = cxListMutBackwardsIterator(list); |
966 CxIterator it4 = cxListMutBackwardsIterator(list); |
2405 CxTestSuite *cx_test_suite_empty_list(void) { |
2428 CxTestSuite *cx_test_suite_empty_list(void) { |
2406 CxTestSuite *suite = cx_test_suite_new("empty list dummy"); |
2429 CxTestSuite *suite = cx_test_suite_new("empty list dummy"); |
2407 |
2430 |
2408 cx_test_register(suite, test_empty_list_size); |
2431 cx_test_register(suite, test_empty_list_size); |
2409 cx_test_register(suite, test_empty_list_iterator); |
2432 cx_test_register(suite, test_empty_list_iterator); |
|
2433 cx_test_register(suite, test_null_list_iterator); |
2410 cx_test_register(suite, test_empty_list_noops); |
2434 cx_test_register(suite, test_empty_list_noops); |
2411 cx_test_register(suite, test_empty_list_at); |
2435 cx_test_register(suite, test_empty_list_at); |
2412 cx_test_register(suite, test_empty_list_find); |
2436 cx_test_register(suite, test_empty_list_find); |
2413 cx_test_register(suite, test_empty_list_compare); |
2437 cx_test_register(suite, test_empty_list_compare); |
2414 |
2438 |