1 | /* $Id: testi.cpp 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Testcase Framework, the implicit test handle API variation.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 |
|
---|
38 | /*********************************************************************************************************************************
|
---|
39 | * Header Files *
|
---|
40 | *********************************************************************************************************************************/
|
---|
41 | #include <iprt/test.h>
|
---|
42 | #include <iprt/stdarg.h>
|
---|
43 |
|
---|
44 |
|
---|
45 | RTR3DECL(int) RTTestIPrintfV(RTTESTLVL enmLevel, const char *pszFormat, va_list va)
|
---|
46 | {
|
---|
47 | return RTTestPrintfV(NIL_RTTEST, enmLevel, pszFormat, va);
|
---|
48 | }
|
---|
49 |
|
---|
50 |
|
---|
51 | RTR3DECL(int) RTTestIPrintf(RTTESTLVL enmLevel, const char *pszFormat, ...)
|
---|
52 | {
|
---|
53 | va_list va;
|
---|
54 | va_start(va, pszFormat);
|
---|
55 | int cch = RTTestPrintfV(NIL_RTTEST, enmLevel, pszFormat, va);
|
---|
56 | va_end(va);
|
---|
57 | return cch;
|
---|
58 | }
|
---|
59 |
|
---|
60 |
|
---|
61 | RTR3DECL(int) RTTestISub(const char *pszSubTest)
|
---|
62 | {
|
---|
63 | return RTTestSub(NIL_RTTEST, pszSubTest);
|
---|
64 | }
|
---|
65 |
|
---|
66 |
|
---|
67 | RTR3DECL(int) RTTestISubF(const char *pszSubTestFmt, ...)
|
---|
68 | {
|
---|
69 | va_list va;
|
---|
70 | va_start(va, pszSubTestFmt);
|
---|
71 | int cch = RTTestSubV(NIL_RTTEST, pszSubTestFmt, va);
|
---|
72 | va_end(va);
|
---|
73 | return cch;
|
---|
74 | }
|
---|
75 |
|
---|
76 |
|
---|
77 | RTR3DECL(int) RTTestISubV(const char *pszSubTestFmt, va_list va)
|
---|
78 | {
|
---|
79 | return RTTestSubV(NIL_RTTEST, pszSubTestFmt, va);
|
---|
80 | }
|
---|
81 |
|
---|
82 |
|
---|
83 | RTR3DECL(int) RTTestISubDone(void)
|
---|
84 | {
|
---|
85 | return RTTestSubDone(NIL_RTTEST);
|
---|
86 | }
|
---|
87 |
|
---|
88 |
|
---|
89 | RTR3DECL(int) RTTestISubSub(const char *pszSubSubTest)
|
---|
90 | {
|
---|
91 | return RTTestSubSub(NIL_RTTEST, pszSubSubTest);
|
---|
92 | }
|
---|
93 |
|
---|
94 |
|
---|
95 | RTR3DECL(int) RTTestISubSubF(const char *pszSubSubTestFmt, ...)
|
---|
96 | {
|
---|
97 | va_list va;
|
---|
98 | va_start(va, pszSubSubTestFmt);
|
---|
99 | int cch = RTTestSubSubV(NIL_RTTEST, pszSubSubTestFmt, va);
|
---|
100 | va_end(va);
|
---|
101 | return cch;
|
---|
102 | }
|
---|
103 |
|
---|
104 |
|
---|
105 | RTR3DECL(int) RTTestISubSubV(const char *pszSubSubTestFmt, va_list va)
|
---|
106 | {
|
---|
107 | return RTTestSubSubV(NIL_RTTEST, pszSubSubTestFmt, va);
|
---|
108 | }
|
---|
109 |
|
---|
110 |
|
---|
111 | RTR3DECL(int) RTTestISubSubDone(void)
|
---|
112 | {
|
---|
113 | return RTTestSubSubDone(NIL_RTTEST);
|
---|
114 | }
|
---|
115 |
|
---|
116 |
|
---|
117 | RTR3DECL(int) RTTestIPassedV(const char *pszFormat, va_list va)
|
---|
118 | {
|
---|
119 | return RTTestPassedV(NIL_RTTEST, pszFormat, va);
|
---|
120 | }
|
---|
121 |
|
---|
122 |
|
---|
123 | RTR3DECL(int) RTTestIPassed(const char *pszFormat, ...)
|
---|
124 | {
|
---|
125 | va_list va;
|
---|
126 | va_start(va, pszFormat);
|
---|
127 | int cch = RTTestPassedV(NIL_RTTEST, pszFormat, va);
|
---|
128 | va_end(va);
|
---|
129 | return cch;
|
---|
130 | }
|
---|
131 |
|
---|
132 |
|
---|
133 | RTR3DECL(int) RTTestIValue(const char *pszName, uint64_t u64Value, RTTESTUNIT enmUnit)
|
---|
134 | {
|
---|
135 | return RTTestValue(NIL_RTTEST, pszName, u64Value, enmUnit);
|
---|
136 | }
|
---|
137 |
|
---|
138 |
|
---|
139 | RTR3DECL(int) RTTestIValueF(uint64_t u64Value, RTTESTUNIT enmUnit, const char *pszNameFmt, ...)
|
---|
140 | {
|
---|
141 | va_list va;
|
---|
142 | va_start(va, pszNameFmt);
|
---|
143 | int rc = RTTestValueV(NIL_RTTEST, u64Value, enmUnit, pszNameFmt, va);
|
---|
144 | va_end(va);
|
---|
145 | return rc;
|
---|
146 | }
|
---|
147 |
|
---|
148 |
|
---|
149 | RTR3DECL(int) RTTestIValueV(uint64_t u64Value, RTTESTUNIT enmUnit, const char *pszNameFmt, va_list va)
|
---|
150 | {
|
---|
151 | return RTTestValueV(NIL_RTTEST, u64Value, enmUnit, pszNameFmt, va);
|
---|
152 | }
|
---|
153 |
|
---|
154 |
|
---|
155 | RTR3DECL(int) RTTestIErrorInc(void)
|
---|
156 | {
|
---|
157 | return RTTestErrorInc(NIL_RTTEST);
|
---|
158 | }
|
---|
159 |
|
---|
160 |
|
---|
161 | RTR3DECL(uint32_t) RTTestIErrorCount(void)
|
---|
162 | {
|
---|
163 | return RTTestErrorCount(NIL_RTTEST);
|
---|
164 | }
|
---|
165 |
|
---|
166 |
|
---|
167 | RTR3DECL(int) RTTestIFailedV(const char *pszFormat, va_list va)
|
---|
168 | {
|
---|
169 | return RTTestFailedV(NIL_RTTEST, pszFormat, va);
|
---|
170 | }
|
---|
171 |
|
---|
172 |
|
---|
173 | RTR3DECL(int) RTTestIFailed(const char *pszFormat, ...)
|
---|
174 | {
|
---|
175 | va_list va;
|
---|
176 | va_start(va, pszFormat);
|
---|
177 | int cch = RTTestFailedV(NIL_RTTEST, pszFormat, va);
|
---|
178 | va_end(va);
|
---|
179 | return cch;
|
---|
180 | }
|
---|
181 |
|
---|
182 |
|
---|
183 | RTR3DECL(int) RTTestIFailedRcV(int rcRet, const char *pszFormat, va_list va)
|
---|
184 | {
|
---|
185 | RTTestFailedV(NIL_RTTEST, pszFormat, va);
|
---|
186 | return rcRet;
|
---|
187 | }
|
---|
188 |
|
---|
189 |
|
---|
190 | RTR3DECL(int) RTTestIFailedRc(int rcRet, const char *pszFormat, ...)
|
---|
191 | {
|
---|
192 | va_list va;
|
---|
193 | va_start(va, pszFormat);
|
---|
194 | RTTestFailedV(NIL_RTTEST, pszFormat, va);
|
---|
195 | va_end(va);
|
---|
196 | return rcRet;
|
---|
197 | }
|
---|
198 |
|
---|
199 |
|
---|
200 | RTR3DECL(int) RTTestIFailureDetailsV(const char *pszFormat, va_list va)
|
---|
201 | {
|
---|
202 | return RTTestFailureDetails(NIL_RTTEST, pszFormat, va);
|
---|
203 | }
|
---|
204 |
|
---|
205 |
|
---|
206 | RTR3DECL(int) RTTestIFailureDetails(const char *pszFormat, ...)
|
---|
207 | {
|
---|
208 | va_list va;
|
---|
209 | va_start(va, pszFormat);
|
---|
210 | int cch = RTTestFailureDetailsV(NIL_RTTEST, pszFormat, va);
|
---|
211 | va_end(va);
|
---|
212 | return cch;
|
---|
213 | }
|
---|
214 |
|
---|
215 |
|
---|
216 | RTR3DECL(int) RTTestIErrContextV(const char *pszFormat, va_list va)
|
---|
217 | {
|
---|
218 | return RTTestErrContextV(NIL_RTTEST, pszFormat, va);
|
---|
219 | }
|
---|
220 |
|
---|
221 |
|
---|
222 | RTR3DECL(int) RTTestIErrContext(const char *pszFormat, ...)
|
---|
223 | {
|
---|
224 | va_list va;
|
---|
225 | va_start(va, pszFormat);
|
---|
226 | int rc = RTTestErrContextV(NIL_RTTEST, pszFormat, va);
|
---|
227 | va_end(va);
|
---|
228 | return rc;
|
---|
229 | }
|
---|
230 |
|
---|
231 |
|
---|
232 | RTR3DECL(int) RTTestIDisableAssertions(void)
|
---|
233 | {
|
---|
234 | return RTTestDisableAssertions(NIL_RTTEST);
|
---|
235 | }
|
---|
236 |
|
---|
237 |
|
---|
238 | RTR3DECL(int) RTTestIRestoreAssertions(void)
|
---|
239 | {
|
---|
240 | return RTTestRestoreAssertions(NIL_RTTEST);
|
---|
241 | }
|
---|
242 |
|
---|