Wed, 07 Aug 2019 20:45:21 +0200
reverts deletion of tests for ucx_array_at()
test/array_tests.c | file | annotate | diff | comparison | revisions | |
test/array_tests.h | file | annotate | diff | comparison | revisions | |
test/main.c | file | annotate | diff | comparison | revisions |
1.1 --- a/test/array_tests.c Wed Aug 07 19:43:50 2019 +0200 1.2 +++ b/test/array_tests.c Wed Aug 07 20:45:21 2019 +0200 1.3 @@ -257,6 +257,30 @@ 1.4 ucx_array_free(&a2); 1.5 } 1.6 1.7 +UCX_TEST(test_ucx_array_at) { 1.8 + UcxArray array = ucx_array_new(16, sizeof(int)); 1.9 + 1.10 + int x = 42; 1.11 + ucx_array_append(&array, &x); 1.12 + x = 13; 1.13 + ucx_array_append(&array, &x); 1.14 + x = 5; 1.15 + ucx_array_append(&array, &x); 1.16 + 1.17 + UCX_TEST_BEGIN 1.18 + 1.19 + UCX_TEST_ASSERT(*(int*)ucx_array_at(array, 1) == 13, "failed"); 1.20 + *(int*)ucx_array_at(array, 1) = 80; 1.21 + UCX_TEST_ASSERT(*(int*)ucx_array_at(array, 1) == 80, "assignment failed"); 1.22 + 1.23 + UCX_TEST_ASSERT(*(int*)ucx_array_at(array, 0) == 42, "corrupted data"); 1.24 + UCX_TEST_ASSERT(*(int*)ucx_array_at(array, 2) == 5, "corrupted data"); 1.25 + 1.26 + UCX_TEST_END 1.27 + 1.28 + ucx_array_free(&array); 1.29 +} 1.30 + 1.31 UCX_TEST(test_ucx_array_find) { 1.32 UcxArray array = ucx_array_new(16, sizeof(int)); 1.33 int *elems;
2.1 --- a/test/array_tests.h Wed Aug 07 19:43:50 2019 +0200 2.2 +++ b/test/array_tests.h Wed Aug 07 20:45:21 2019 +0200 2.3 @@ -38,6 +38,7 @@ 2.4 2.5 UCX_TEST(test_ucx_array_free); 2.6 UCX_TEST(test_ucx_array_new); 2.7 +UCX_TEST(test_ucx_array_at); 2.8 UCX_TEST(test_ucx_array_append); 2.9 UCX_TEST(test_ucx_array_prepend); 2.10 UCX_TEST(test_ucx_array_set);
3.1 --- a/test/main.c Wed Aug 07 19:43:50 2019 +0200 3.2 +++ b/test/main.c Wed Aug 07 20:45:21 2019 +0200 3.3 @@ -145,6 +145,7 @@ 3.4 /* UcxArray Tests */ 3.5 ucx_test_register(suite, test_ucx_array_free); 3.6 ucx_test_register(suite, test_ucx_array_new); 3.7 + ucx_test_register(suite, test_ucx_array_at); 3.8 ucx_test_register(suite, test_ucx_array_append); 3.9 ucx_test_register(suite, test_ucx_array_prepend); 3.10 ucx_test_register(suite, test_ucx_array_set);