tests/test_list.c

changeset 1611
de21dd0d1426
parent 1608
46d8a8305948
child 1616
bdc04a8e0dd3
equal deleted inserted replaced
1610:ce0b0bf7d29c 1611:de21dd0d1426
98 CX_TEST_ASSERT(arr.data[1] == 3); 98 CX_TEST_ASSERT(arr.data[1] == 3);
99 } 99 }
100 cx_array_free(arr); 100 cx_array_free(arr);
101 } 101 }
102 102
103 CX_TEST(test_array_move_to_new) { 103 CX_TEST(test_array_copy_to_new) {
104 CX_ARRAY(int, arr); 104 CX_ARRAY(int, arr);
105 int fixed[5] = {2, 4, 6}; 105 int fixed[5] = {2, 4, 6};
106 cx_array_init_fixed(arr, fixed, 3); 106 cx_array_init_fixed(arr, fixed, 3);
107 CX_TEST_DO { 107 CX_TEST_DO {
108 CX_TEST_ASSERT(arr.data == fixed); 108 CX_TEST_ASSERT(arr.data == fixed);
109 CX_TEST_ASSERT(arr.size == 3); 109 CX_TEST_ASSERT(arr.size == 3);
110 CX_TEST_ASSERT(arr.capacity == 5); 110 CX_TEST_ASSERT(arr.capacity == 5);
111 111
112 CX_TEST_ASSERT(0 == cx_array_move_to_new(arr, 8)); 112 CX_TEST_ASSERT(0 == cx_array_copy_to_new(arr, 8));
113 113
114 CX_TEST_ASSERT(arr.data != fixed); 114 CX_TEST_ASSERT(arr.data != fixed);
115 CX_TEST_ASSERT(arr.size == 3); 115 CX_TEST_ASSERT(arr.size == 3);
116 CX_TEST_ASSERT(arr.capacity == 8); 116 CX_TEST_ASSERT(arr.capacity == 8);
117 CX_TEST_ASSERT(arr.data[0] == 2); 117 CX_TEST_ASSERT(arr.data[0] == 2);
3277 CxTestSuite *cx_test_suite_array_list(void) { 3277 CxTestSuite *cx_test_suite_array_list(void) {
3278 CxTestSuite *suite = cx_test_suite_new("array_list"); 3278 CxTestSuite *suite = cx_test_suite_new("array_list");
3279 3279
3280 cx_test_register(suite, test_array_add); 3280 cx_test_register(suite, test_array_add);
3281 cx_test_register(suite, test_array_reserve); 3281 cx_test_register(suite, test_array_reserve);
3282 cx_test_register(suite, test_array_move_to_new); 3282 cx_test_register(suite, test_array_copy_to_new);
3283 cx_test_register(suite, test_array_insert_sorted); 3283 cx_test_register(suite, test_array_insert_sorted);
3284 cx_test_register(suite, test_array_insert_unique); 3284 cx_test_register(suite, test_array_insert_unique);
3285 cx_test_register(suite, test_array_binary_search); 3285 cx_test_register(suite, test_array_binary_search);
3286 cx_test_register(suite, test_array_binary_search_with_duplicates); 3286 cx_test_register(suite, test_array_binary_search_with_duplicates);
3287 3287

mercurial