EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
epicsUnitTest.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
3 * National Laboratory.
4 * SPDX-License-Identifier: EPICS
5 * EPICS BASE is distributed subject to a Software License Agreement found
6 * in file LICENSE that is included with this distribution.
7 \*************************************************************************/
8 
149 #ifndef INC_epicsUnitTest_H
150 #define INC_epicsUnitTest_H
151 
152 #include <stdarg.h>
153 
154 #include "compilerDependencies.h"
155 #include "libComAPI.h"
156 
157 #ifdef __cplusplus
158 extern "C" {
159 #endif
160 
165 LIBCOM_API void testPlan(int tests);
166 
177 LIBCOM_API int testOk(int pass, const char *fmt, ...)
178  EPICS_PRINTF_STYLE(2, 3);
183 #define testOk1(cond) testOk(cond, "%s", #cond)
184 
190 LIBCOM_API int testOkV(int pass, const char *fmt, va_list pvar);
196 LIBCOM_API void testPass(const char *fmt, ...)
197  EPICS_PRINTF_STYLE(1, 2);
202 LIBCOM_API void testFail(const char *fmt, ...)
203  EPICS_PRINTF_STYLE(1, 2);
215 LIBCOM_API void testSkip(int skip, const char *why);
219 LIBCOM_API void testTodoBegin(const char *why);
222 LIBCOM_API void testTodoEnd(void);
227 LIBCOM_API void testAbort(const char *fmt, ...)
228  EPICS_PRINTF_STYLE(1, 2);
235 LIBCOM_API int testDiag(const char *fmt, ...)
236  EPICS_PRINTF_STYLE(1, 2);
239 LIBCOM_API int testDone(void);
240 
250 LIBCOM_API
251 int testImpreciseTiming(void);
252 
260 typedef int (*TESTFUNC)(void);
263 LIBCOM_API void testHarness(void);
266 LIBCOM_API void testHarnessExit(void *dummy);
271 LIBCOM_API void runTestFunc(const char *name, TESTFUNC func);
272 
276 #define runTest(func) runTestFunc(#func, func)
277 
279 #define testHarnessDone() testHarnessExit(0)
280 
282 #ifdef __cplusplus
283 }
284 #endif
285 
286 #endif /* INC_epicsUnitTest_H */
LIBCOM_API int testImpreciseTiming(void)
Return non-zero in shared/oversubscribed testing environments.
LIBCOM_API int testOk(int pass, const char *fmt,...) EPICS_PRINTF_STYLE(2
Test result with printf-style description.
LIBCOM_API void LIBCOM_API int LIBCOM_API int testDone(void)
Mark the end of testing.
LIBCOM_API void LIBCOM_API void testFail(const char *fmt,...) EPICS_PRINTF_STYLE(1
Failing test result with printf-style description.
LIBCOM_API void testSkip(int skip, const char *why)
Place-holders for tests that can&#39;t be run.
Compiler specific declarations.
LIBCOM_API void testTodoBegin(const char *why)
Mark the start of a group of tests that are expected to fail.
LIBCOM_API void testTodoEnd(void)
Mark the end of a failing test group.
LIBCOM_API void LIBCOM_API int testDiag(const char *fmt,...) EPICS_PRINTF_STYLE(1
Output additional diagnostics.
LIBCOM_API void testHarness(void)
Initialize test harness.
LIBCOM_API void testAbort(const char *fmt,...) EPICS_PRINTF_STYLE(1
Stop testing, program cannot continue.
LIBCOM_API void testHarnessExit(void *dummy)
End of testing.
LIBCOM_API void testPass(const char *fmt,...) EPICS_PRINTF_STYLE(1
Passing test result with printf-style description.
LIBCOM_API int testOkV(int pass, const char *fmt, va_list pvar)
Test result with var-args description.
LIBCOM_API void testPlan(int tests)
Declare the test plan, required.
LIBCOM_API void runTestFunc(const char *name, TESTFUNC func)
Run a single test program.