test/ucxtest.h

Thu, 03 Sep 2026 12:13:05 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 03 Sep 2026 12:13:05 +0200
changeset 214
31d73d150c76
parent 213
cf7b86d79d35
permissions
-rw-r--r--

make all should really build all (including the tests)

we removed the tests from the all-target initially
because they will cause warnings with compilers not
supporting C23

but we should not care too much about this

148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 /*
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
3 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 * Copyright 2017 Mike Becker, Olaf Wintermann All rights reserved.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
11 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
6cc15ba51424 add test directory and make target for tests
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
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27 */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30 * @file: test.h
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
31 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
32 * UCX Test Framework.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
33 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
34 * Usage of this test framework:
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 * **** IN HEADER FILE: ****
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
38 * <code>
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
39 * CX_TEST(function_name);
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
40 * CX_TEST_SUBROUTINE(subroutine_name, paramlist); // optional
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41 * </code>
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
42 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43 * **** IN SOURCE FILE: ****
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44 * <code>
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
45 * CX_TEST_SUBROUTINE(subroutine_name, paramlist) {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
46 * // tests with CX_TEST_ASSERT()
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
47 * }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
48 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
49 * CX_TEST(function_name) {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
50 * // memory allocation and other stuff here
213
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
51 * CX_TEST_DO {
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
52 * // tests with CX_TEST_ASSERT() and/or
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
53 * // calls with CX_TEST_CALL_SUBROUTINE() here
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
54 * }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
55 * // cleanup of memory here
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
56 * }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
57 * </code>
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
58 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
59 * @attention Do not call own functions within a test that use
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
60 * CX_TEST_ASSERT() macros and are not defined by using CX_TEST_SUBROUTINE().
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
61 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
62 * @author Mike Becker
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
63 * @author Olaf Wintermann
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
64 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
65 */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
66
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
67 #ifndef UCX_TEST_H
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
68 #define UCX_TEST_H
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
69
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
70 #include <stdlib.h>
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
71 #include <stdio.h>
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
72 #include <string.h>
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
73 #include <setjmp.h>
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
74
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
75 #ifndef __FUNCTION__
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
76 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
77 * Alias for the <code>__func__</code> preprocessor macro.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
78 * Some compilers use <code>__func__</code> and others use __FUNCTION__.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
79 * We use __FUNCTION__ so we define it for those compilers which use
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
80 * <code>__func__</code>.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
81 */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
82 #define __FUNCTION__ __func__
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
83 #endif
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
84
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
85 #if !defined(__clang__) && __GNUC__ > 3
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
86 #pragma GCC diagnostic ignored "-Wclobbered"
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
87 #endif
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
88
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
89 /** Type for the CxTestSuite. */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
90 typedef struct CxTestSuite CxTestSuite;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
91
213
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
92 /** Output function compatible to cx_write_func */
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
93 typedef size_t (*cx_test_output_func)(const void*, size_t, size_t, void*);
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
94
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
95 /** Pointer to a test function. */
213
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
96 typedef void(*CxTest)(CxTestSuite *, void *, cx_test_output_func);
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
97
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
98 /** Type for the internal list of test cases. */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
99 typedef struct CxTestSet CxTestSet;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
100
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
101 /** Structure for the internal list of test cases. */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
102 struct CxTestSet {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
103
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
104 /** Test case. */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
105 CxTest test;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
106
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
107 /** Pointer to the next list element. */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
108 CxTestSet *next;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
109 };
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
110
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
111 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
112 * A test suite containing multiple test cases.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
113 */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
114 struct CxTestSuite {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
115
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
116 /** The number of successful tests after the suite has been run. */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
117 unsigned int success;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
118
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
119 /** The number of failed tests after the suite has been run. */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
120 unsigned int failure;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
121
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
122 /** The optional name of this test suite. */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
123 const char *name;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
124
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
125 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
126 * Internal list of test cases.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
127 * Use cx_test_register() to add tests to this list.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
128 */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
129 CxTestSet *tests;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
130 };
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
131
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
132 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
133 * Creates a new test suite.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
134 * @param name optional name of the suite
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
135 * @return a new test suite
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
136 */
213
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
137 static inline CxTestSuite* cx_test_suite_new(const char *name) {
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
138 CxTestSuite* suite = (CxTestSuite*) malloc(sizeof(CxTestSuite));
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
139 if (suite != NULL) {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
140 suite->name = name;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
141 suite->success = 0;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
142 suite->failure = 0;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
143 suite->tests = NULL;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
144 }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
145
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
146 return suite;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
147 }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
149 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
150 * Deallocates a test suite.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
151 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
152 * @param suite the test suite to free
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
153 */
213
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
154 static inline void cx_test_suite_free(CxTestSuite* suite) {
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
155 if (suite == NULL) return;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
156 CxTestSet *l = suite->tests;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
157 while (l != NULL) {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
158 CxTestSet *e = l;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
159 l = l->next;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
160 free(e);
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
161 }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
162 free(suite);
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
163 }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
164
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
165 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
166 * Registers a test function with the specified test suite.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
167 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
168 * @param suite the suite the test function shall be added to
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
169 * @param test the test function to register
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
170 * @retval zero success
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
171 * @retval non-zero failure
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
172 */
213
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
173 static inline int cx_test_register(CxTestSuite* suite, CxTest test) {
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
174 CxTestSet *t = (CxTestSet*) malloc(sizeof(CxTestSet));
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
175 if (t) {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
176 t->test = test;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
177 t->next = NULL;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
178 if (suite->tests == NULL) {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
179 suite->tests = t;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
180 } else {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
181 CxTestSet *last = suite->tests;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
182 while (last->next) {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
183 last = last->next;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
184 }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
185 last->next = t;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
186 }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
187 return 0;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
188 } else {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
189 return 1;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
190 }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
191 }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
192
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
193 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
194 * Runs a test suite and writes the test log to the specified stream.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
195 * @param suite the test suite to run
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
196 * @param out_target the target buffer or file to write the output to
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
197 * @param out_writer the write function writing to @p out_target
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
198 */
213
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
199 static inline void cx_test_run(CxTestSuite *suite, void *out_target,
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
200 cx_test_output_func out_writer) {
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
201 if (suite->name == NULL) {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
202 out_writer("*** Test Suite ***\n", 1, 19, out_target);
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
203 } else {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
204 out_writer("*** Test Suite : ", 1, 17, out_target);
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
205 out_writer(suite->name, 1, strlen(suite->name), out_target);
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
206 out_writer(" ***\n", 1, 5, out_target);
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
207 }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
208 suite->success = 0;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
209 suite->failure = 0;
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
210 for (CxTestSet *elem = suite->tests; elem; elem = elem->next) {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
211 elem->test(suite, out_target, out_writer);
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
212 }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
213 out_writer("\nAll test completed.\n", 1, 21, out_target);
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
214 char total[80];
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
215 int len = snprintf(
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
216 total, 80,
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
217 " Tests: %5u\n Success: %5u\n Failure: %5u\n\n",
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
218 suite->success + suite->failure, suite->success, suite->failure
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
219 );
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
220 out_writer(total, 1, len, out_target);
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
221 }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
222
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
223 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
224 * Runs a test suite and writes the test log to the specified FILE stream.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
225 * @param suite (@c CxTestSuite*) the test suite to run
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
226 * @param file (@c FILE*) the target file to write the output to
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
227 */
213
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
228 #define cx_test_run_f(suite, file) cx_test_run(suite, (void*)file, \
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
229 (cx_test_output_func) fwrite)
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
230
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
231 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
232 * Runs a test suite and writes the test log to stdout.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
233 * @param suite (@c CxTestSuite*) the test suite to run
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
234 */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
235 #define cx_test_run_stdout(suite) cx_test_run_f(suite, stdout)
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
236
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
237 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
238 * Macro for a #CxTest function header.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
239 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
240 * Use this macro to declare and/or define a #CxTest function.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
241 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
242 * @param name the name of the test function
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
243 */
213
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
244 #define CX_TEST(name) void name(CxTestSuite* _suite_,void *_output_, \
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
245 cx_test_output_func _writefnc_)
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
246
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
247 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
248 * Defines the scope of a test.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
249 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
250 * @code
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
251 * CX_TEST(my_test_name) {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
252 * // setup code
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
253 * CX_TEST_DO {
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
254 * // your tests go here
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
255 * }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
256 * // tear down code
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
257 * }
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
258 * @endcode
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
259 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
260 * @attention Any CX_TEST_ASSERT() calls must be performed in the scope of
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
261 * #CX_TEST_DO.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
262 */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
263 #define CX_TEST_DO _writefnc_("Running ", 1, 8, _output_);\
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
264 _writefnc_(__FUNCTION__, 1, strlen(__FUNCTION__), _output_);\
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
265 _writefnc_("... ", 1, 4, _output_);\
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
266 jmp_buf _env_;\
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
267 for (unsigned int _cx_test_loop_ = 0 ;\
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
268 _cx_test_loop_ == 0 && !setjmp(_env_);\
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
269 _writefnc_("success.\n", 1, 9, _output_),\
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
270 _suite_->success++, _cx_test_loop_++)
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
271
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
272 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
273 * Checks a test assertion.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
274 * If the assertion is correct, the test carries on. If the assertion is not
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
275 * correct, the specified message (terminated by a dot and a line break) is
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
276 * written to the test suites output stream.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
277 * @param condition (@c bool) the condition to check
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
278 * @param message (@c char*) the message that shall be printed out on failure
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
279 */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
280 #define CX_TEST_ASSERTM(condition,message) if (!(condition)) { \
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
281 const char *_assert_msg_ = message; \
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
282 _writefnc_(_assert_msg_, 1, strlen(_assert_msg_), _output_); \
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
283 _writefnc_(".\n", 1, 2, _output_); \
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
284 _suite_->failure++; \
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
285 longjmp(_env_, 1);\
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
286 } (void) 0
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
287
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
288 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
289 * Checks a test assertion.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
290 * If the assertion is correct, the test carries on. If the assertion is not
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
291 * correct, the specified message (terminated by a dot and a line break) is
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
292 * written to the test suites output stream.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
293 * @param condition (@c bool) the condition to check
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
294 */
213
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
295 #define CX_TEST_ASSERT(condition) \
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
296 CX_TEST_ASSERTM(condition, #condition " failed")
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
297
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
298 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
299 * Macro for a test subroutine function header.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
300 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
301 * Use this to declare and/or define a subroutine that can be called by using
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
302 * CX_TEST_CALL_SUBROUTINE().
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
303 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
304 * @param name the name of the subroutine
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
305 * @param ... the parameter list
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
306 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
307 * @see CX_TEST_CALL_SUBROUTINE()
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
308 */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
309 #define CX_TEST_SUBROUTINE(name,...) void name(CxTestSuite* _suite_,\
213
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
310 void *_output_, cx_test_output_func _writefnc_, \
cf7b86d79d35 add (empty) test suites for all pieces
Mike Becker <universe@uap-core.de>
parents: 149
diff changeset
311 jmp_buf _env_, __VA_ARGS__)
148
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
312
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
313 /**
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
314 * Macro for calling a test subroutine.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
315 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
316 * Subroutines declared with CX_TEST_SUBROUTINE() can be called by using this
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
317 * macro.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
318 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
319 * @remark You may <b>only</b> call subroutines within a #CX_TEST_DO block.
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
320 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
321 * @param name the name of the subroutine
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
322 * @param ... the argument list
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
323 *
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
324 * @see CX_TEST_SUBROUTINE()
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
325 */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
326 #define CX_TEST_CALL_SUBROUTINE(name,...) \
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
327 name(_suite_,_output_,_writefnc_,_env_,__VA_ARGS__)
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
328
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
329 #endif /* UCX_TEST_H */
6cc15ba51424 add test directory and make target for tests
Mike Becker <universe@uap-core.de>
parents:
diff changeset
330

mercurial