1 /* |
1 /* |
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
3 * |
3 * |
4 * Copyright 2016 Olaf Wintermann. All rights reserved. |
4 * Copyright 2017 Mike Becker, Olaf Wintermann All rights reserved. |
5 * |
5 * |
6 * Redistribution and use in source and binary forms, with or without |
6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions are met: |
7 * modification, are permitted provided that the following conditions are met: |
8 * |
8 * |
9 * 1. Redistributions of source code must retain the above copyright |
9 * 1. Redistributions of source code must retain the above copyright |
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 * POSSIBILITY OF SUCH DAMAGE. |
26 * POSSIBILITY OF SUCH DAMAGE. |
27 */ |
27 */ |
28 |
28 |
29 #include "test.h" |
29 #include "ucx/test.h" |
30 |
30 |
31 UcxTestSuite* ucx_test_suite_new() { |
31 UcxTestSuite* ucx_test_suite_new() { |
32 UcxTestSuite* suite = (UcxTestSuite*) malloc(sizeof(UcxTestSuite)); |
32 UcxTestSuite* suite = (UcxTestSuite*) malloc(sizeof(UcxTestSuite)); |
33 if (suite != NULL) { |
33 if (suite != NULL) { |
34 suite->success = 0; |
34 suite->success = 0; |
84 suite->failure = 0; |
84 suite->failure = 0; |
85 for (UcxTestList* elem = suite->tests ; elem ; elem = elem->next) { |
85 for (UcxTestList* elem = suite->tests ; elem ; elem = elem->next) { |
86 elem->test(suite, output); |
86 elem->test(suite, output); |
87 } |
87 } |
88 fwrite("\nAll test completed.\n", 1, 21, output); |
88 fwrite("\nAll test completed.\n", 1, 21, output); |
89 fprintf(output, " Total: %d\n Success: %d\n Failure: %d\n", |
89 fprintf(output, " Total: %u\n Success: %u\n Failure: %u\n", |
90 suite->success+suite->failure, suite->success, suite->failure); |
90 suite->success+suite->failure, suite->success, suite->failure); |
91 } |
91 } |