Unit Test Framework C and Traditional C++ API Reference
test_connext_interface.h
1/*
2 * (c) Copyright, Real-Time Innovations, 2022.
3 * All rights reserved.
4 * No duplications, whole or partial, manual or electronic, may be made
5 * without express written permission. Any such copies, or
6 * revisions thereof, must display this notice unaltered.
7 * This code contains trade secrets of Real-Time Innovations, Inc.
8 */
9
10#ifndef rtitest_connext_interface_h
11#define rtitest_connext_interface_h
12
13#include "rtitest/test_dll.h"
14#include "rtitest/test_types.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/************************************ Setup ***********************************/
21
26#define RTITestConnext_setup() \
27 /* Setting RTILog_g_enable_backtrace_upon_sigsegv to RTI_TRUE here */ \
28 /* because we want to make sure that our tests always enable backtraces. */ \
29 RTILog_g_enable_backtrace_upon_sigsegv = RTI_TRUE; \
30 /* Setting RTILog_g_detectPrecondition to RTI_TRUE to detect */ \
31 /* preconditions by default in tests. */ \
32 RTILog_g_detectPrecondition = RTI_TRUE; \
33 RTITestConnext_configurePreconditionDetection( \
34 &RTILog_g_detectPrecondition, \
35 &RTILog_g_preconditionDetected); \
36 RTITestConnext_configureAbortOnError(&RTILog_abortOnFatalError)
37
38/******************************** Preconditions *******************************/
39
48extern RTITestDllExport void RTITestConnext_configurePreconditionDetection(
49 RTIBool *detectPrecondition,
50 RTIBool *preconditionDetected);
51
58extern RTITestDllExport void RTITestConnext_setPreconditionDetection(
59 RTIBool detectPrecondition);
60
67extern RTITestDllExport RTIBool
68RTITestConnext_isPreconditionsDetectionEnabled(void);
69
75extern RTITestDllExport RTIBool RTITestConnext_isPreconditionDetected(void);
76
83extern RTITestDllExport void RTITestConnext_resetPreconditionDetection(void);
84
89extern RTITestDllExport void RTITestConnext_cachePreconditionDetection(void);
90
98extern RTITestDllExport RTIBool
99RTITestConnext_getPreconditionDetectionCache(void);
100
101/******************************* Abort on error *******************************/
102
109extern RTITestDllExport void RTITestConnext_configureAbortOnError(
110 RTIBool *abortOnError);
111
116extern RTITestDllExport void RTITestConnext_enableAbortOnError(void);
117
123extern RTITestDllExport RTIBool RTITestConnext_isAbortOnErrorEnabled(void);
124
125/********************* RTI Test log API using Connext log *********************/
126
143#define RTITestConnextLogger_log(instrumentationBit__, logMessage__, ...) \
144 if (RTITestLog_g_instrumentationMask & (instrumentationBit__)) \
145 RTILogMessageParamString_printWithParams( \
146 RTI_LOG_PRINT_FORMAT_MASK_ALL, \
147 (RTITestLogBitmap) (instrumentationBit__), \
148 MODULE_TEST, \
149 RTI_FILE_NAME, \
150 RTI_LINE_NUMBER, \
151 RTI_FUNCTION_NAME, \
152 (logMessage__), \
153 __VA_ARGS__)
154
174#define RTITestConnextLogger_logWithFunctionName( \
175 formatMask__, \
176 instrumentationBit__, \
177 functionName__, \
178 ...) \
179 if (RTITestLog_g_instrumentationMask & (instrumentationBit__)) \
180 RTILogMessage_printWithParams( \
181 (formatMask__) \
182 & (RTILogPrintFormatKindMask) ~( \
183 RTI_LOG_PRINT_BIT_LOG_LEVEL), \
184 (RTITestLogBitmap) (instrumentationBit__), \
185 MODULE_TEST, \
186 RTI_FILE_NAME, \
187 RTI_LINE_NUMBER, \
188 (functionName__), \
189 __VA_ARGS__)
190
200#define RTITestConnextLogger_logParamString(instrumentationBit__, ...) \
201 if ((RTITestLog_g_instrumentationMask) & (instrumentationBit__)) \
202 RTILogParamString_printUnformatted( \
203 (RTITestLogBitmap) (instrumentationBit__), \
204 __VA_ARGS__)
205
206#ifdef __cplusplus
207}
208#endif
209
210#endif /* rtitest_connext_interface_h */