add first test suite to test_linked_list.c

Sun, 14 Feb 2021 11:31:13 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 14 Feb 2021 11:31:13 +0100
changeset 411
2842f729caab
parent 410
76b76f0f046b
child 412
af766caea48d

add first test suite to test_linked_list.c

test/test_linked_list.c file | annotate | diff | comparison | revisions
     1.1 --- a/test/test_linked_list.c	Sun Feb 14 11:30:47 2021 +0100
     1.2 +++ b/test/test_linked_list.c	Sun Feb 14 11:31:13 2021 +0100
     1.3 @@ -27,9 +27,40 @@
     1.4   */
     1.5  
     1.6  #include "cx/linked_list.h"
     1.7 +#include "test_config.h"
     1.8  
     1.9 -#include <CUnit/Basic.h>
    1.10 +void test_linked_list_wrap() {
    1.11 +    CU_FAIL("test not implemented")
    1.12 +}
    1.13  
    1.14  int main() {
    1.15 -    return 0;
    1.16 +    CU_pSuite suite = NULL;
    1.17 +
    1.18 +    if (CUE_SUCCESS != CU_initialize_registry()) {
    1.19 +        return CU_get_error();
    1.20 +    }
    1.21 +
    1.22 +    suite = CU_add_suite("linked list creation", NULL, NULL);
    1.23 +    if (NULL == suite) {
    1.24 +        CU_cleanup_registry();
    1.25 +        return CU_get_error();
    1.26 +    }
    1.27 +
    1.28 +    if (
    1.29 +            !CU_add_test(suite, "wrapping of custom linked list", test_linked_list_wrap)
    1.30 +            ) {
    1.31 +        CU_cleanup_registry();
    1.32 +        return CU_get_error();
    1.33 +    }
    1.34 +
    1.35 +    CU_basic_set_mode(UCX_CU_BRM);
    1.36 +
    1.37 +    int exitcode;
    1.38 +    if (CU_basic_run_tests()) {
    1.39 +        exitcode = CU_get_error();
    1.40 +    } else {
    1.41 +        exitcode = CU_get_number_of_failures() == 0 ? 0 : 1;
    1.42 +    }
    1.43 +    CU_cleanup_registry();
    1.44 +    return exitcode;
    1.45  }

mercurial