Tue, 22 Oct 2024 22:20:50 +0200
make both gcc and clang happy with how cx_json_value_nothing is initialized
766
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1 | /* |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
3 | * |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
4 | * Copyright 2023 Mike Becker, Olaf Wintermann All rights reserved. |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
5 | * |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
8 | * |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
11 | * |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
15 | * |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
27 | */ |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
28 | |
767
d31f4d4075dc
migrate utils tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
766
diff
changeset
|
29 | #include "cx/test.h" |
d31f4d4075dc
migrate utils tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
766
diff
changeset
|
30 | |
770
ed710122af44
migrates self-test for testing allocator - relates to #342
Mike Becker <universe@uap-core.de>
parents:
768
diff
changeset
|
31 | CxTestSuite *cx_test_suite_testing_allocator(void); |
767
d31f4d4075dc
migrate utils tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
766
diff
changeset
|
32 | CxTestSuite *cx_test_suite_utils(void); |
787
d0f02310aa47
migrate compare tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
785
diff
changeset
|
33 | CxTestSuite *cx_test_suite_compare(void); |
768
0e1cf2cd500e
migrate hash_key tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
767
diff
changeset
|
34 | CxTestSuite *cx_test_suite_hash_key(void); |
782
74d777455e96
migrate allocator tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
781
diff
changeset
|
35 | CxTestSuite *cx_test_suite_allocator(void); |
780
9965df621652
migrate printf tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
777
diff
changeset
|
36 | CxTestSuite *cx_test_suite_string(void); |
789
9b2f5661bebd
begin migration of buffer tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
787
diff
changeset
|
37 | CxTestSuite *cx_test_suite_buffer(void); |
780
9965df621652
migrate printf tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
777
diff
changeset
|
38 | CxTestSuite *cx_test_suite_printf(void); |
850
b2bc48c2b251
add iterator over raw C arrays - closes #389
Mike Becker <universe@uap-core.de>
parents:
816
diff
changeset
|
39 | CxTestSuite *cx_test_suite_iterator(void); |
800
1274e46b3013
migrate cxEmptyList tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
798
diff
changeset
|
40 | CxTestSuite *cx_test_suite_empty_list(void); |
798
7644da6e2d35
migrate low level linked list tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
789
diff
changeset
|
41 | CxTestSuite *cx_test_suite_array_list(void); |
7644da6e2d35
migrate low level linked list tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
789
diff
changeset
|
42 | CxTestSuite *cx_test_suite_linked_list(void); |
875
ee84ac776cbc
add default impl for some list member functions
Mike Becker <universe@uap-core.de>
parents:
850
diff
changeset
|
43 | CxTestSuite *cx_test_suite_array_list_defaulted_funcs(void); |
ee84ac776cbc
add default impl for some list member functions
Mike Becker <universe@uap-core.de>
parents:
850
diff
changeset
|
44 | CxTestSuite *cx_test_suite_linked_list_defaulted_funcs(void); |
816
425234b05dff
add first basic low level tree functions
Mike Becker <universe@uap-core.de>
parents:
800
diff
changeset
|
45 | CxTestSuite *cx_test_suite_tree_low_level(void); |
902
5ed7f634f046
implement cxTreeCreate family of functions
Mike Becker <universe@uap-core.de>
parents:
875
diff
changeset
|
46 | CxTestSuite *cx_test_suite_tree_high_level(void); |
781
a786b0a89b37
migrate mempool tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
780
diff
changeset
|
47 | CxTestSuite *cx_test_suite_mempool(void); |
785
bb18daa62d5f
migrate map tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
782
diff
changeset
|
48 | CxTestSuite *cx_test_suite_hash_map(void); |
924
3c90dfc35f06
add implementation for the properties parser
Mike Becker <universe@uap-core.de>
parents:
902
diff
changeset
|
49 | CxTestSuite *cx_test_suite_properties(void); |
937
10123f4d5618
add first draft of json implementation - relates to #431
Mike Becker <universe@uap-core.de>
parents:
924
diff
changeset
|
50 | CxTestSuite *cx_test_suite_json(void); |
777
e5b29e6f0615
migrate string tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
770
diff
changeset
|
51 | |
766
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
52 | #define run_tests(suite) cx_test_run_stdout(suite); success += (suite)->success; failure += (suite)->failure |
770
ed710122af44
migrates self-test for testing allocator - relates to #342
Mike Becker <universe@uap-core.de>
parents:
768
diff
changeset
|
53 | #define execute_test_suites(...) unsigned success = 0, failure = 0; CxTestSuite* test_suites[] = {__VA_ARGS__}; \ |
ed710122af44
migrates self-test for testing allocator - relates to #342
Mike Becker <universe@uap-core.de>
parents:
768
diff
changeset
|
54 | for (size_t i = 0; i < sizeof(test_suites)/sizeof(void*) ; i++) {run_tests(test_suites[i]);} (void)0 |
ed710122af44
migrates self-test for testing allocator - relates to #342
Mike Becker <universe@uap-core.de>
parents:
768
diff
changeset
|
55 | #define free_test_suites for (size_t i = 0 ; i < sizeof(test_suites)/sizeof(void*) ; i++) {cx_test_suite_free(test_suites[i]);} (void)0 |
766
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
56 | |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
57 | int main(void) { |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
58 | printf("UCX Tests\n---------\n"); |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
59 | |
770
ed710122af44
migrates self-test for testing allocator - relates to #342
Mike Becker <universe@uap-core.de>
parents:
768
diff
changeset
|
60 | execute_test_suites( |
ed710122af44
migrates self-test for testing allocator - relates to #342
Mike Becker <universe@uap-core.de>
parents:
768
diff
changeset
|
61 | cx_test_suite_testing_allocator(), |
ed710122af44
migrates self-test for testing allocator - relates to #342
Mike Becker <universe@uap-core.de>
parents:
768
diff
changeset
|
62 | cx_test_suite_utils(), |
787
d0f02310aa47
migrate compare tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
785
diff
changeset
|
63 | cx_test_suite_compare(), |
777
e5b29e6f0615
migrate string tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
770
diff
changeset
|
64 | cx_test_suite_hash_key(), |
782
74d777455e96
migrate allocator tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
781
diff
changeset
|
65 | cx_test_suite_allocator(), |
780
9965df621652
migrate printf tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
777
diff
changeset
|
66 | cx_test_suite_string(), |
789
9b2f5661bebd
begin migration of buffer tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
787
diff
changeset
|
67 | cx_test_suite_buffer(), |
781
a786b0a89b37
migrate mempool tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
780
diff
changeset
|
68 | cx_test_suite_printf(), |
850
b2bc48c2b251
add iterator over raw C arrays - closes #389
Mike Becker <universe@uap-core.de>
parents:
816
diff
changeset
|
69 | cx_test_suite_iterator(), |
800
1274e46b3013
migrate cxEmptyList tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
798
diff
changeset
|
70 | cx_test_suite_empty_list(), |
798
7644da6e2d35
migrate low level linked list tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
789
diff
changeset
|
71 | cx_test_suite_array_list(), |
7644da6e2d35
migrate low level linked list tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
789
diff
changeset
|
72 | cx_test_suite_linked_list(), |
875
ee84ac776cbc
add default impl for some list member functions
Mike Becker <universe@uap-core.de>
parents:
850
diff
changeset
|
73 | cx_test_suite_array_list_defaulted_funcs(), |
ee84ac776cbc
add default impl for some list member functions
Mike Becker <universe@uap-core.de>
parents:
850
diff
changeset
|
74 | cx_test_suite_linked_list_defaulted_funcs(), |
816
425234b05dff
add first basic low level tree functions
Mike Becker <universe@uap-core.de>
parents:
800
diff
changeset
|
75 | cx_test_suite_tree_low_level(), |
902
5ed7f634f046
implement cxTreeCreate family of functions
Mike Becker <universe@uap-core.de>
parents:
875
diff
changeset
|
76 | cx_test_suite_tree_high_level(), |
785
bb18daa62d5f
migrate map tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
782
diff
changeset
|
77 | cx_test_suite_mempool(), |
924
3c90dfc35f06
add implementation for the properties parser
Mike Becker <universe@uap-core.de>
parents:
902
diff
changeset
|
78 | cx_test_suite_hash_map(), |
937
10123f4d5618
add first draft of json implementation - relates to #431
Mike Becker <universe@uap-core.de>
parents:
924
diff
changeset
|
79 | cx_test_suite_properties(), |
10123f4d5618
add first draft of json implementation - relates to #431
Mike Becker <universe@uap-core.de>
parents:
924
diff
changeset
|
80 | cx_test_suite_json() |
770
ed710122af44
migrates self-test for testing allocator - relates to #342
Mike Becker <universe@uap-core.de>
parents:
768
diff
changeset
|
81 | ); |
768
0e1cf2cd500e
migrate hash_key tests - relates to #342
Mike Becker <universe@uap-core.de>
parents:
767
diff
changeset
|
82 | printf("=== OVERALL RESULT ===\n"); |
766
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
83 | printf(" Total: %u\n Success: %u\n Failure: %u\n", |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
84 | success + failure, success, failure); |
770
ed710122af44
migrates self-test for testing allocator - relates to #342
Mike Becker <universe@uap-core.de>
parents:
768
diff
changeset
|
85 | free_test_suites; |
766
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
86 | |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
87 | return failure > 0 ? 1 : 0; |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
88 | } |
e59b76889f00
bring back UCX test - fixes #341
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
89 |