90 #define __FUNCTION__ __func__ |
91 #define __FUNCTION__ __func__ |
91 #endif |
92 #endif |
92 |
93 |
93 /** Type for the UcxTestSuite. */ |
94 /** Type for the UcxTestSuite. */ |
94 typedef struct UcxTestSuite UcxTestSuite; |
95 typedef struct UcxTestSuite UcxTestSuite; |
|
96 |
95 /** Pointer to a test function. */ |
97 /** Pointer to a test function. */ |
96 typedef void(*UcxTest)(UcxTestSuite*,FILE*); |
98 typedef void(*UcxTest)(UcxTestSuite*,FILE*); |
|
99 |
97 /** Type for the internal list of test cases. */ |
100 /** Type for the internal list of test cases. */ |
98 typedef struct UcxTestList UcxTestList; |
101 typedef struct UcxTestList UcxTestList; |
99 |
102 |
100 /** Structure for the internal list of test cases. */ |
103 /** Structure for the internal list of test cases. */ |
101 struct UcxTestList { |
104 struct UcxTestList { |
|
105 |
102 /** Test case. */ |
106 /** Test case. */ |
103 UcxTest test; |
107 UcxTest test; |
|
108 |
104 /** Pointer to the next list element. */ |
109 /** Pointer to the next list element. */ |
105 UcxTestList *next; |
110 UcxTestList *next; |
106 }; |
111 }; |
107 |
112 |
108 /** |
113 /** |
109 * A test suite containing multiple test cases. |
114 * A test suite containing multiple test cases. |
110 */ |
115 */ |
111 struct UcxTestSuite { |
116 struct UcxTestSuite { |
|
117 |
112 /** The number of successful tests after the suite has been run. */ |
118 /** The number of successful tests after the suite has been run. */ |
113 unsigned int success; |
119 unsigned int success; |
|
120 |
114 /** The number of failed tests after the suite has been run. */ |
121 /** The number of failed tests after the suite has been run. */ |
115 unsigned int failure; |
122 unsigned int failure; |
|
123 |
116 /** |
124 /** |
117 * Internal list of test cases. |
125 * Internal list of test cases. |
118 * Use ucx_test_register() to add tests to this list. |
126 * Use ucx_test_register() to add tests to this list. |
119 */ |
127 */ |
120 UcxTestList *tests; |
128 UcxTestList *tests; |
123 /** |
131 /** |
124 * Creates a new test suite. |
132 * Creates a new test suite. |
125 * @return a new test suite |
133 * @return a new test suite |
126 */ |
134 */ |
127 UcxTestSuite* ucx_test_suite_new(); |
135 UcxTestSuite* ucx_test_suite_new(); |
|
136 |
128 /** |
137 /** |
129 * Destroys a test suite. |
138 * Destroys a test suite. |
130 * @param suite the test suite to destroy |
139 * @param suite the test suite to destroy |
131 */ |
140 */ |
132 void ucx_test_suite_free(UcxTestSuite* suite); |
141 void ucx_test_suite_free(UcxTestSuite* suite); |
138 * @param test the test function to register |
147 * @param test the test function to register |
139 * @return <code>EXIT_SUCCESS</code> on success or |
148 * @return <code>EXIT_SUCCESS</code> on success or |
140 * <code>EXIT_FAILURE</code> on failure |
149 * <code>EXIT_FAILURE</code> on failure |
141 */ |
150 */ |
142 int ucx_test_register(UcxTestSuite* suite, UcxTest test); |
151 int ucx_test_register(UcxTestSuite* suite, UcxTest test); |
|
152 |
143 /** |
153 /** |
144 * Runs a test suite and writes the test log to the specified stream. |
154 * Runs a test suite and writes the test log to the specified stream. |
145 * @param suite the test suite to run |
155 * @param suite the test suite to run |
146 * @param outstream the stream the log shall be written to |
156 * @param outstream the stream the log shall be written to |
147 */ |
157 */ |