tests/test_list.c

changeset 831
7970eac1c598
parent 819
5da2ead43077
child 832
97df2e4c68fb
     1.1 --- a/tests/test_list.c	Sun Feb 18 12:24:04 2024 +0100
     1.2 +++ b/tests/test_list.c	Sun Feb 18 13:01:09 2024 +0100
     1.3 @@ -41,14 +41,15 @@
     1.4      int *stackarray = stackspace;
     1.5      size_t stackarray_size = 3;
     1.6      size_t stackarray_capacity = 5;
     1.7 -    int *heaparray = calloc(5, sizeof(int));
     1.8 +    cx_array_declare(int, heaparray);
     1.9 +    heaparray = calloc(5, sizeof(int));
    1.10      heaparray[0] = 2;
    1.11      heaparray[1] = 3;
    1.12      heaparray[2] = 5;
    1.13      heaparray[3] = 7;
    1.14      heaparray[4] = 11;
    1.15 -    size_t heaparray_size = 3;
    1.16 -    size_t heaparray_capacity = 5;
    1.17 +    heaparray_size = 3;
    1.18 +    heaparray_capacity = 5;
    1.19      int elem = 8, elem2 = 47;
    1.20      enum cx_array_result result;
    1.21      CX_TEST_DO {
    1.22 @@ -73,7 +74,7 @@
    1.23          CX_TEST_ASSERT(stackarray_size == 5);
    1.24          CX_TEST_ASSERT(stackarray_capacity == 5);
    1.25  
    1.26 -        result = cx_array_add(&heaparray, &heaparray_size, &heaparray_capacity, sizeof(int), &elem, cx_array_default_reallocator);
    1.27 +        result = cx_array_simple_add(heaparray, &elem);
    1.28          CX_TEST_ASSERT(result == CX_ARRAY_SUCCESS);
    1.29          CX_TEST_ASSERT(heaparray[0] == 2);
    1.30          CX_TEST_ASSERT(heaparray[1] == 3);
    1.31 @@ -84,7 +85,7 @@
    1.32          CX_TEST_ASSERT(heaparray_capacity == 5);
    1.33  
    1.34          heaparray_size = 5;
    1.35 -        result = cx_array_add(&heaparray, &heaparray_size, &heaparray_capacity, sizeof(int), &elem2, cx_array_default_reallocator);
    1.36 +        result = cx_array_simple_add(heaparray, &elem2);
    1.37          CX_TEST_ASSERT(result == CX_ARRAY_SUCCESS);
    1.38          CX_TEST_ASSERT(heaparray[0] == 2);
    1.39          CX_TEST_ASSERT(heaparray[1] == 3);

mercurial