Use o3tl::convert in Math
[LibreOffice.git] / cppu / qa / cppumaker / test_cppumaker.cxx
blob78097e26e854828f3377f0a421e732967b30f2e9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/types.h>
22 #include <FILE.hpp>
23 #include <lconv.hpp>
24 #include <tm.hpp>
25 #include <std.hpp>
26 #include <test/codemaker/cppumaker/XTest.hpp>
27 #include <test/codemaker/cppumaker/S1.hpp>
28 #include <test/codemaker/cppumaker/services/asm.hpp>
29 #include <test/codemaker/cppumaker/services/auto.hpp>
30 #include <test/codemaker/cppumaker/services/bool.hpp>
31 #include <test/codemaker/cppumaker/services/break.hpp>
32 //TODO: #include "test/codemaker/cppumaker/services/case.hpp"
33 #include <test/codemaker/cppumaker/services/catch.hpp>
34 //TODO: #include "test/codemaker/cppumaker/services/char.hpp"
35 #include <test/codemaker/cppumaker/services/class.hpp>
36 //TODO: #include "test/codemaker/cppumaker/services/const.hpp"
37 #include <test/codemaker/cppumaker/services/continue.hpp>
38 //TODO: #include "test/codemaker/cppumaker/services/default.hpp"
39 #include <test/codemaker/cppumaker/services/delete.hpp>
40 #include <test/codemaker/cppumaker/services/do.hpp>
41 //TODO: #include "test/codemaker/cppumaker/services/double.hpp"
42 #include <test/codemaker/cppumaker/services/else.hpp>
43 //TODO: #include "test/codemaker/cppumaker/services/enum.hpp"
44 #include <test/codemaker/cppumaker/services/explicit.hpp>
45 #include <test/codemaker/cppumaker/services/export.hpp>
46 #include <test/codemaker/cppumaker/services/extern.hpp>
47 #include <test/codemaker/cppumaker/services/false.hpp>
48 //TODO: #include "test/codemaker/cppumaker/services/float.hpp"
49 #include <test/codemaker/cppumaker/services/for.hpp>
50 #include <test/codemaker/cppumaker/services/friend.hpp>
51 #include <test/codemaker/cppumaker/services/goto.hpp>
52 #include <test/codemaker/cppumaker/services/if.hpp>
53 #include <test/codemaker/cppumaker/services/inline.hpp>
54 #include <test/codemaker/cppumaker/services/int.hpp>
55 //TODO: #include "test/codemaker/cppumaker/services/long.hpp"
56 #include <test/codemaker/cppumaker/services/mutable.hpp>
57 #include <test/codemaker/cppumaker/services/namespace.hpp>
58 #include <test/codemaker/cppumaker/services/new.hpp>
59 #include <test/codemaker/cppumaker/services/operator.hpp>
60 #include <test/codemaker/cppumaker/services/private.hpp>
61 #include <test/codemaker/cppumaker/services/protected.hpp>
62 #include <test/codemaker/cppumaker/services/public.hpp>
63 #include <test/codemaker/cppumaker/services/register.hpp>
64 #include <test/codemaker/cppumaker/services/return.hpp>
65 //TODO: #include "test/codemaker/cppumaker/services/short.hpp"
66 #include <test/codemaker/cppumaker/services/signed.hpp>
67 #include <test/codemaker/cppumaker/services/sizeof.hpp>
68 #include <test/codemaker/cppumaker/services/static.hpp>
69 //TODO: #include "test/codemaker/cppumaker/services/struct.hpp"
70 //TODO: #include "test/codemaker/cppumaker/services/switch.hpp"
71 #include <test/codemaker/cppumaker/services/template.hpp>
72 #include <test/codemaker/cppumaker/services/this.hpp>
73 #include <test/codemaker/cppumaker/services/throw.hpp>
74 #include <test/codemaker/cppumaker/services/true.hpp>
75 #include <test/codemaker/cppumaker/services/try.hpp>
76 //TODO: #include "test/codemaker/cppumaker/services/typedef.hpp"
77 #include <test/codemaker/cppumaker/services/typeid.hpp>
78 #include <test/codemaker/cppumaker/services/typename.hpp>
79 //TODO: #include "test/codemaker/cppumaker/services/union.hpp"
80 //TODO: #include "test/codemaker/cppumaker/services/unsigned.hpp"
81 #include <test/codemaker/cppumaker/services/using.hpp>
82 #include <test/codemaker/cppumaker/services/virtual.hpp>
83 //TODO: #include "test/codemaker/cppumaker/services/void.hpp"
84 #include <test/codemaker/cppumaker/services/volatile.hpp>
85 #include <test/codemaker/cppumaker/services/while.hpp>
86 #include <test/codemaker/cppumaker/services/and.hpp>
87 #include <test/codemaker/cppumaker/services/bitand.hpp>
88 #include <test/codemaker/cppumaker/services/bitor.hpp>
89 #include <test/codemaker/cppumaker/services/compl.hpp>
90 #include <test/codemaker/cppumaker/services/not.hpp>
91 #include <test/codemaker/cppumaker/services/or.hpp>
92 #include <test/codemaker/cppumaker/services/xor.hpp>
93 #include <test/codemaker/cppumaker/services/BUFSIZ.hpp>
94 #include <test/codemaker/cppumaker/services/CLOCKS_PER_SEC.hpp>
95 #include <test/codemaker/cppumaker/services/EDOM.hpp>
96 #include <test/codemaker/cppumaker/services/EOF.hpp>
97 #include <test/codemaker/cppumaker/services/ERANGE.hpp>
98 #include <test/codemaker/cppumaker/services/EXIT_FAILURE.hpp>
99 #include <test/codemaker/cppumaker/services/EXIT_SUCCESS.hpp>
100 #include <test/codemaker/cppumaker/services/FILENAME_MAX.hpp>
101 #include <test/codemaker/cppumaker/services/FOPEN_MAX.hpp>
102 #include <test/codemaker/cppumaker/services/HUGE_VAL.hpp>
103 #include <test/codemaker/cppumaker/services/LC_ALL.hpp>
104 #include <test/codemaker/cppumaker/services/LC_COLLATE.hpp>
105 #include <test/codemaker/cppumaker/services/LC_CTYPE.hpp>
106 #include <test/codemaker/cppumaker/services/LC_MONETARY.hpp>
107 #include <test/codemaker/cppumaker/services/LC_NUMERIC.hpp>
108 #include <test/codemaker/cppumaker/services/LC_TIME.hpp>
109 #include <test/codemaker/cppumaker/services/L_tmpnam.hpp>
110 #include <test/codemaker/cppumaker/services/MB_CUR_MAX.hpp>
111 #include <test/codemaker/cppumaker/services/NULL.hpp>
112 #include <test/codemaker/cppumaker/services/RAND_MAX.hpp>
113 #include <test/codemaker/cppumaker/services/SEEK_CUR.hpp>
114 #include <test/codemaker/cppumaker/services/SEEK_END.hpp>
115 #include <test/codemaker/cppumaker/services/SEEK_SET.hpp>
116 #include <test/codemaker/cppumaker/services/SIGABRT.hpp>
117 #include <test/codemaker/cppumaker/services/SIGFPE.hpp>
118 #include <test/codemaker/cppumaker/services/SIGILL.hpp>
119 #include <test/codemaker/cppumaker/services/SIGINT.hpp>
120 #include <test/codemaker/cppumaker/services/SIGSEGV.hpp>
121 #include <test/codemaker/cppumaker/services/SIGTERM.hpp>
122 #include <test/codemaker/cppumaker/services/SIG_DFL.hpp>
123 #include <test/codemaker/cppumaker/services/SIG_ERR.hpp>
124 #include <test/codemaker/cppumaker/services/SIG_IGN.hpp>
125 #include <test/codemaker/cppumaker/services/TMP_MAX.hpp>
126 #include <test/codemaker/cppumaker/services/WCHAR_MAX.hpp>
127 #include <test/codemaker/cppumaker/services/WCHAR_MIN.hpp>
128 #include <test/codemaker/cppumaker/services/WEOF.hpp>
129 #include <test/codemaker/cppumaker/services/assert.hpp>
130 #include <test/codemaker/cppumaker/services/errno.hpp>
131 #include <test/codemaker/cppumaker/services/offsetof.hpp>
132 #include <test/codemaker/cppumaker/services/setjmp.hpp>
133 #include <test/codemaker/cppumaker/services/stderr.hpp>
134 #include <test/codemaker/cppumaker/services/stdin.hpp>
135 #include <test/codemaker/cppumaker/services/stdout.hpp>
136 #include <test/codemaker/cppumaker/services/CHAR_BIT.hpp>
137 #include <test/codemaker/cppumaker/services/CHAR_MAX.hpp>
138 #include <test/codemaker/cppumaker/services/CHAR_MIN.hpp>
139 #include <test/codemaker/cppumaker/services/DBL_DIG.hpp>
140 #include <test/codemaker/cppumaker/services/DBL_EPSILON.hpp>
141 #include <test/codemaker/cppumaker/services/DBL_MANT_DIG.hpp>
142 #include <test/codemaker/cppumaker/services/DBL_MAX.hpp>
143 #include <test/codemaker/cppumaker/services/DBL_MAX_10_EXP.hpp>
144 #include <test/codemaker/cppumaker/services/DBL_MAX_EXP.hpp>
145 #include <test/codemaker/cppumaker/services/DBL_MIN.hpp>
146 #include <test/codemaker/cppumaker/services/DBL_MIN_10_EXP.hpp>
147 #include <test/codemaker/cppumaker/services/DBL_MIN_EXP.hpp>
148 #include <test/codemaker/cppumaker/services/FLT_DIG.hpp>
149 #include <test/codemaker/cppumaker/services/FLT_EPSILON.hpp>
150 #include <test/codemaker/cppumaker/services/FLT_MANT_DIG.hpp>
151 #include <test/codemaker/cppumaker/services/FLT_MAX.hpp>
152 #include <test/codemaker/cppumaker/services/FLT_MAX_10_EXP.hpp>
153 #include <test/codemaker/cppumaker/services/FLT_MAX_EXP.hpp>
154 #include <test/codemaker/cppumaker/services/FLT_MIN.hpp>
155 #include <test/codemaker/cppumaker/services/FLT_MIN_10_EXP.hpp>
156 #include <test/codemaker/cppumaker/services/FLT_MIN_EXP.hpp>
157 #include <test/codemaker/cppumaker/services/FLT_RADIX.hpp>
158 #include <test/codemaker/cppumaker/services/FLT_ROUNDS.hpp>
159 #include <test/codemaker/cppumaker/services/INT_MAX.hpp>
160 #include <test/codemaker/cppumaker/services/INT_MIN.hpp>
161 #include <test/codemaker/cppumaker/services/LDBL_DIG.hpp>
162 #include <test/codemaker/cppumaker/services/LDBL_EPSILON.hpp>
163 #include <test/codemaker/cppumaker/services/LDBL_MANT_DIG.hpp>
164 #include <test/codemaker/cppumaker/services/LDBL_MAX.hpp>
165 #include <test/codemaker/cppumaker/services/LDBL_MAX_10_EXP.hpp>
166 #include <test/codemaker/cppumaker/services/LDBL_MAX_EXP.hpp>
167 #include <test/codemaker/cppumaker/services/LDBL_MIN.hpp>
168 #include <test/codemaker/cppumaker/services/LDBL_MIN_10_EXP.hpp>
169 #include <test/codemaker/cppumaker/services/LDBL_MIN_EXP.hpp>
170 #include <test/codemaker/cppumaker/services/LONG_MAX.hpp>
171 #include <test/codemaker/cppumaker/services/LONG_MIN.hpp>
172 #include <test/codemaker/cppumaker/services/MB_LEN_MAX.hpp>
173 #include <test/codemaker/cppumaker/services/SCHAR_MAX.hpp>
174 #include <test/codemaker/cppumaker/services/SCHAR_MIN.hpp>
175 #include <test/codemaker/cppumaker/services/SHRT_MAX.hpp>
176 #include <test/codemaker/cppumaker/services/SHRT_MIN.hpp>
177 #include <test/codemaker/cppumaker/services/UCHAR_MAX.hpp>
178 #include <test/codemaker/cppumaker/services/UINT_MAX.hpp>
179 #include <test/codemaker/cppumaker/services/ULONG_MAX.hpp>
180 #include <test/codemaker/cppumaker/services/USHRT_MAX.hpp>
181 #include <test/codemaker/cppumaker/services/FILE.hpp>
182 #include <test/codemaker/cppumaker/services/lconv.hpp>
183 #include <test/codemaker/cppumaker/services/tm.hpp>
184 #include <test/codemaker/cppumaker/services/std.hpp>
185 #include <test/codemaker/cppumaker/services/NDEBUG.hpp>
186 #include <test/codemaker/cppumaker/services/create.hpp>
187 #include <test/codemaker/cppumaker/singletons/asm.hpp>
188 #include <test/codemaker/cppumaker/singletons/auto.hpp>
189 #include <test/codemaker/cppumaker/singletons/bool.hpp>
190 #include <test/codemaker/cppumaker/singletons/break.hpp>
191 //TODO: #include "test/codemaker/cppumaker/singletons/case.hpp"
192 #include <test/codemaker/cppumaker/singletons/catch.hpp>
193 //TODO: #include "test/codemaker/cppumaker/singletons/char.hpp"
194 #include <test/codemaker/cppumaker/singletons/class.hpp>
195 //TODO: #include "test/codemaker/cppumaker/singletons/const.hpp"
196 #include <test/codemaker/cppumaker/singletons/continue.hpp>
197 //TODO: #include "test/codemaker/cppumaker/singletons/default.hpp"
198 #include <test/codemaker/cppumaker/singletons/delete.hpp>
199 #include <test/codemaker/cppumaker/singletons/do.hpp>
200 //TODO: #include "test/codemaker/cppumaker/singletons/double.hpp"
201 #include <test/codemaker/cppumaker/singletons/else.hpp>
202 //TODO: #include "test/codemaker/cppumaker/singletons/enum.hpp"
203 #include <test/codemaker/cppumaker/singletons/explicit.hpp>
204 #include <test/codemaker/cppumaker/singletons/export.hpp>
205 #include <test/codemaker/cppumaker/singletons/extern.hpp>
206 #include <test/codemaker/cppumaker/singletons/false.hpp>
207 //TODO: #include "test/codemaker/cppumaker/singletons/float.hpp"
208 #include <test/codemaker/cppumaker/singletons/for.hpp>
209 #include <test/codemaker/cppumaker/singletons/friend.hpp>
210 #include <test/codemaker/cppumaker/singletons/goto.hpp>
211 #include <test/codemaker/cppumaker/singletons/if.hpp>
212 #include <test/codemaker/cppumaker/singletons/inline.hpp>
213 #include <test/codemaker/cppumaker/singletons/int.hpp>
214 //TODO: #include "test/codemaker/cppumaker/singletons/long.hpp"
215 #include <test/codemaker/cppumaker/singletons/mutable.hpp>
216 #include <test/codemaker/cppumaker/singletons/namespace.hpp>
217 #include <test/codemaker/cppumaker/singletons/new.hpp>
218 #include <test/codemaker/cppumaker/singletons/operator.hpp>
219 #include <test/codemaker/cppumaker/singletons/private.hpp>
220 #include <test/codemaker/cppumaker/singletons/protected.hpp>
221 #include <test/codemaker/cppumaker/singletons/public.hpp>
222 #include <test/codemaker/cppumaker/singletons/register.hpp>
223 #include <test/codemaker/cppumaker/singletons/return.hpp>
224 //TODO: #include "test/codemaker/cppumaker/singletons/short.hpp"
225 #include <test/codemaker/cppumaker/singletons/signed.hpp>
226 #include <test/codemaker/cppumaker/singletons/sizeof.hpp>
227 #include <test/codemaker/cppumaker/singletons/static.hpp>
228 //TODO: #include "test/codemaker/cppumaker/singletons/struct.hpp"
229 //TODO: #include "test/codemaker/cppumaker/singletons/switch.hpp"
230 #include <test/codemaker/cppumaker/singletons/template.hpp>
231 #include <test/codemaker/cppumaker/singletons/this.hpp>
232 #include <test/codemaker/cppumaker/singletons/throw.hpp>
233 #include <test/codemaker/cppumaker/singletons/true.hpp>
234 #include <test/codemaker/cppumaker/singletons/try.hpp>
235 //TODO: #include "test/codemaker/cppumaker/singletons/typedef.hpp"
236 #include <test/codemaker/cppumaker/singletons/typeid.hpp>
237 #include <test/codemaker/cppumaker/singletons/typename.hpp>
238 //TODO: #include "test/codemaker/cppumaker/singletons/union.hpp"
239 //TODO: #include "test/codemaker/cppumaker/singletons/unsigned.hpp"
240 #include <test/codemaker/cppumaker/singletons/using.hpp>
241 #include <test/codemaker/cppumaker/singletons/virtual.hpp>
242 //TODO: #include "test/codemaker/cppumaker/singletons/void.hpp"
243 #include <test/codemaker/cppumaker/singletons/volatile.hpp>
244 #include <test/codemaker/cppumaker/singletons/while.hpp>
245 #include <test/codemaker/cppumaker/singletons/and.hpp>
246 #include <test/codemaker/cppumaker/singletons/bitand.hpp>
247 #include <test/codemaker/cppumaker/singletons/bitor.hpp>
248 #include <test/codemaker/cppumaker/singletons/compl.hpp>
249 #include <test/codemaker/cppumaker/singletons/not.hpp>
250 #include <test/codemaker/cppumaker/singletons/or.hpp>
251 #include <test/codemaker/cppumaker/singletons/xor.hpp>
252 #include <test/codemaker/cppumaker/singletons/BUFSIZ.hpp>
253 #include <test/codemaker/cppumaker/singletons/CLOCKS_PER_SEC.hpp>
254 #include <test/codemaker/cppumaker/singletons/EDOM.hpp>
255 #include <test/codemaker/cppumaker/singletons/EOF.hpp>
256 #include <test/codemaker/cppumaker/singletons/ERANGE.hpp>
257 #include <test/codemaker/cppumaker/singletons/EXIT_FAILURE.hpp>
258 #include <test/codemaker/cppumaker/singletons/EXIT_SUCCESS.hpp>
259 #include <test/codemaker/cppumaker/singletons/FILENAME_MAX.hpp>
260 #include <test/codemaker/cppumaker/singletons/FOPEN_MAX.hpp>
261 #include <test/codemaker/cppumaker/singletons/HUGE_VAL.hpp>
262 #include <test/codemaker/cppumaker/singletons/LC_ALL.hpp>
263 #include <test/codemaker/cppumaker/singletons/LC_COLLATE.hpp>
264 #include <test/codemaker/cppumaker/singletons/LC_CTYPE.hpp>
265 #include <test/codemaker/cppumaker/singletons/LC_MONETARY.hpp>
266 #include <test/codemaker/cppumaker/singletons/LC_NUMERIC.hpp>
267 #include <test/codemaker/cppumaker/singletons/LC_TIME.hpp>
268 #include <test/codemaker/cppumaker/singletons/L_tmpnam.hpp>
269 #include <test/codemaker/cppumaker/singletons/MB_CUR_MAX.hpp>
270 #include <test/codemaker/cppumaker/singletons/NULL.hpp>
271 #include <test/codemaker/cppumaker/singletons/RAND_MAX.hpp>
272 #include <test/codemaker/cppumaker/singletons/SEEK_CUR.hpp>
273 #include <test/codemaker/cppumaker/singletons/SEEK_END.hpp>
274 #include <test/codemaker/cppumaker/singletons/SEEK_SET.hpp>
275 #include <test/codemaker/cppumaker/singletons/SIGABRT.hpp>
276 #include <test/codemaker/cppumaker/singletons/SIGFPE.hpp>
277 #include <test/codemaker/cppumaker/singletons/SIGILL.hpp>
278 #include <test/codemaker/cppumaker/singletons/SIGINT.hpp>
279 #include <test/codemaker/cppumaker/singletons/SIGSEGV.hpp>
280 #include <test/codemaker/cppumaker/singletons/SIGTERM.hpp>
281 #include <test/codemaker/cppumaker/singletons/SIG_DFL.hpp>
282 #include <test/codemaker/cppumaker/singletons/SIG_ERR.hpp>
283 #include <test/codemaker/cppumaker/singletons/SIG_IGN.hpp>
284 #include <test/codemaker/cppumaker/singletons/TMP_MAX.hpp>
285 #include <test/codemaker/cppumaker/singletons/WCHAR_MAX.hpp>
286 #include <test/codemaker/cppumaker/singletons/WCHAR_MIN.hpp>
287 #include <test/codemaker/cppumaker/singletons/WEOF.hpp>
288 #include <test/codemaker/cppumaker/singletons/assert.hpp>
289 #include <test/codemaker/cppumaker/singletons/errno.hpp>
290 #include <test/codemaker/cppumaker/singletons/offsetof.hpp>
291 #include <test/codemaker/cppumaker/singletons/setjmp.hpp>
292 #include <test/codemaker/cppumaker/singletons/stderr.hpp>
293 #include <test/codemaker/cppumaker/singletons/stdin.hpp>
294 #include <test/codemaker/cppumaker/singletons/stdout.hpp>
295 #include <test/codemaker/cppumaker/singletons/CHAR_BIT.hpp>
296 #include <test/codemaker/cppumaker/singletons/CHAR_MAX.hpp>
297 #include <test/codemaker/cppumaker/singletons/CHAR_MIN.hpp>
298 #include <test/codemaker/cppumaker/singletons/DBL_DIG.hpp>
299 #include <test/codemaker/cppumaker/singletons/DBL_EPSILON.hpp>
300 #include <test/codemaker/cppumaker/singletons/DBL_MANT_DIG.hpp>
301 #include <test/codemaker/cppumaker/singletons/DBL_MAX.hpp>
302 #include <test/codemaker/cppumaker/singletons/DBL_MAX_10_EXP.hpp>
303 #include <test/codemaker/cppumaker/singletons/DBL_MAX_EXP.hpp>
304 #include <test/codemaker/cppumaker/singletons/DBL_MIN.hpp>
305 #include <test/codemaker/cppumaker/singletons/DBL_MIN_10_EXP.hpp>
306 #include <test/codemaker/cppumaker/singletons/DBL_MIN_EXP.hpp>
307 #include <test/codemaker/cppumaker/singletons/FLT_DIG.hpp>
308 #include <test/codemaker/cppumaker/singletons/FLT_EPSILON.hpp>
309 #include <test/codemaker/cppumaker/singletons/FLT_MANT_DIG.hpp>
310 #include <test/codemaker/cppumaker/singletons/FLT_MAX.hpp>
311 #include <test/codemaker/cppumaker/singletons/FLT_MAX_10_EXP.hpp>
312 #include <test/codemaker/cppumaker/singletons/FLT_MAX_EXP.hpp>
313 #include <test/codemaker/cppumaker/singletons/FLT_MIN.hpp>
314 #include <test/codemaker/cppumaker/singletons/FLT_MIN_10_EXP.hpp>
315 #include <test/codemaker/cppumaker/singletons/FLT_MIN_EXP.hpp>
316 #include <test/codemaker/cppumaker/singletons/FLT_RADIX.hpp>
317 #include <test/codemaker/cppumaker/singletons/FLT_ROUNDS.hpp>
318 #include <test/codemaker/cppumaker/singletons/INT_MAX.hpp>
319 #include <test/codemaker/cppumaker/singletons/INT_MIN.hpp>
320 #include <test/codemaker/cppumaker/singletons/LDBL_DIG.hpp>
321 #include <test/codemaker/cppumaker/singletons/LDBL_EPSILON.hpp>
322 #include <test/codemaker/cppumaker/singletons/LDBL_MANT_DIG.hpp>
323 #include <test/codemaker/cppumaker/singletons/LDBL_MAX.hpp>
324 #include <test/codemaker/cppumaker/singletons/LDBL_MAX_10_EXP.hpp>
325 #include <test/codemaker/cppumaker/singletons/LDBL_MAX_EXP.hpp>
326 #include <test/codemaker/cppumaker/singletons/LDBL_MIN.hpp>
327 #include <test/codemaker/cppumaker/singletons/LDBL_MIN_10_EXP.hpp>
328 #include <test/codemaker/cppumaker/singletons/LDBL_MIN_EXP.hpp>
329 #include <test/codemaker/cppumaker/singletons/LONG_MAX.hpp>
330 #include <test/codemaker/cppumaker/singletons/LONG_MIN.hpp>
331 #include <test/codemaker/cppumaker/singletons/MB_LEN_MAX.hpp>
332 #include <test/codemaker/cppumaker/singletons/SCHAR_MAX.hpp>
333 #include <test/codemaker/cppumaker/singletons/SCHAR_MIN.hpp>
334 #include <test/codemaker/cppumaker/singletons/SHRT_MAX.hpp>
335 #include <test/codemaker/cppumaker/singletons/SHRT_MIN.hpp>
336 #include <test/codemaker/cppumaker/singletons/UCHAR_MAX.hpp>
337 #include <test/codemaker/cppumaker/singletons/UINT_MAX.hpp>
338 #include <test/codemaker/cppumaker/singletons/ULONG_MAX.hpp>
339 #include <test/codemaker/cppumaker/singletons/USHRT_MAX.hpp>
340 #include <test/codemaker/cppumaker/singletons/FILE.hpp>
341 #include <test/codemaker/cppumaker/singletons/lconv.hpp>
342 #include <test/codemaker/cppumaker/singletons/tm.hpp>
343 #include <test/codemaker/cppumaker/singletons/std.hpp>
344 #include <test/codemaker/cppumaker/singletons/NDEBUG.hpp>
345 #include <test/codemaker/cppumaker/singletons/get.hpp>
346 #include <test/codemaker/cppumaker/HelperEnum.hpp>
347 #include <test/codemaker/cppumaker/HelperStruct.hpp>
348 #include <test/codemaker/cppumaker/BigStruct.hpp>
349 #include <test/codemaker/cppumaker/Struct.hpp>
350 #include <test/codemaker/cppumaker/StructUsage.hpp>
351 #include <test/codemaker/cppumaker/AlignmentDerivedStruct.hpp>
352 #include <test/codemaker/cppumaker/TestException1.hpp>
353 #include <test/codemaker/cppumaker/TestException2.hpp>
354 #include <test/codemaker/cppumaker/Constants.hpp>
356 #include <memory>
357 #include <com/sun/star/uno/Any.hxx>
358 #include <com/sun/star/uno/Type.hxx>
359 #include <com/sun/star/uno/TypeClass.hpp>
360 #include <cppunit/TestFixture.h>
361 #include <cppunit/extensions/HelperMacros.h>
362 #include <cppunit/plugin/TestPlugIn.h>
363 #include <o3tl/cppunittraitshelper.hxx>
364 #include <rtl/ustring.hxx>
366 #include <cstddef>
368 namespace test::codemaker::cppumaker {
370 static bool operator ==(
371 test::codemaker::cppumaker::TestException1 const & e1,
372 test::codemaker::cppumaker::TestException1 const & e2)
374 return e1.Message == e2.Message && e1.Context == e2.Context
375 && e1.m1 == e2.m1 && e1.m2 == e2.m2 && e1.m3 == e2.m3
376 && e1.m4.member1 == e2.m4.member1 && e1.m4.member2 == e2.m4.member2;
381 namespace {
383 class Test: public CppUnit::TestFixture {
384 public:
385 void testBigStruct();
387 void testPolyStruct();
389 void testExceptions();
391 void testConstants();
393 CPPUNIT_TEST_SUITE(Test);
394 CPPUNIT_TEST(testBigStruct);
395 CPPUNIT_TEST(testPolyStruct);
396 CPPUNIT_TEST(testExceptions);
397 CPPUNIT_TEST(testConstants);
398 CPPUNIT_TEST_SUITE_END();
401 struct Guard {
402 explicit Guard(void * buffer):
403 p(new(buffer) test::codemaker::cppumaker::BigStruct) {}
405 ~Guard() { p->test::codemaker::cppumaker::BigStruct::~BigStruct(); }
407 test::codemaker::cppumaker::BigStruct * const p;
410 void Test::testBigStruct() {
411 // Default-initialize a BigStruct instance on top of a memory buffer filled
412 // with random data, and make sure that all members are default-initialized:
413 std::unique_ptr< char []> buffer(
414 new char[sizeof (test::codemaker::cppumaker::BigStruct)]);
415 for (std::size_t i = 0; i < sizeof (test::codemaker::cppumaker::BigStruct);
416 ++i)
418 buffer[i] = '\x56';
420 Guard guard(buffer.get());
421 CPPUNIT_ASSERT_EQUAL(sal_False, guard.p->m1);
422 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int8 >(0), guard.p->m2);
423 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int16 >(0), guard.p->m3);
424 CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt16 >(0), guard.p->m4);
425 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m5);
426 CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(0), guard.p->m6);
427 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int64 >(0), guard.p->m7);
428 CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt64 >(0), guard.p->m8);
429 CPPUNIT_ASSERT_EQUAL(0.0f, guard.p->m9);
430 CPPUNIT_ASSERT_EQUAL(0.0, guard.p->m10);
431 CPPUNIT_ASSERT_EQUAL( u'\0', guard.p->m11);
432 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m12.getLength());
433 CPPUNIT_ASSERT_EQUAL(sal_Int32(css::uno::TypeClass_VOID), static_cast<sal_Int32>(guard.p->m13.getTypeClass()));
434 CPPUNIT_ASSERT_EQUAL(false, guard.p->m14.hasValue());
435 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m15.getLength());
436 CPPUNIT_ASSERT_EQUAL(int(test::codemaker::cppumaker::HelperEnum_ZERO), static_cast<int>(guard.p->m16));
437 CPPUNIT_ASSERT_EQUAL(sal_False, guard.p->m17.m1);
438 CPPUNIT_ASSERT_EQUAL(false, guard.p->m17.m2.is());
439 CPPUNIT_ASSERT_EQUAL(false, guard.p->m18.is());
440 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int8 >(0), guard.p->m19);
441 CPPUNIT_ASSERT_EQUAL(sal_Int32(test::codemaker::cppumaker::HelperEnum_ZERO), static_cast<sal_Int32>(guard.p->m20));
442 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m21.getLength());
443 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m22.getLength());
444 CPPUNIT_ASSERT_EQUAL(static_cast< sal_Int32 >(0), guard.p->m23.getLength());
446 //This is a very platform specific test.
447 #if defined __GNUC__ // see CPPU_GCC3_ALIGN
448 #if defined(LINUX) && (defined (X86_64) || defined(X86) || defined(PPC))
449 static_assert(
450 sizeof (test::codemaker::cppumaker::AlignmentDerivedStruct) ==
451 #if defined X86_64 || defined PPC
453 #else
455 #endif
457 #endif
458 #endif
460 css::uno::Type t(
461 cppu::UnoType< test::codemaker::cppumaker::BigStruct >::get());
462 typelib_TypeDescription * td = nullptr;
463 t.getDescription(&td);
464 typelib_typedescription_complete(&td);
465 fprintf(stdout, "#### 1\n");
466 CPPUNIT_ASSERT(td != nullptr);
467 CPPUNIT_ASSERT_EQUAL(+typelib_TypeClass_STRUCT, +td->eTypeClass);
468 typelib_StructTypeDescription * std =
469 reinterpret_cast< typelib_StructTypeDescription * >(td);
470 CPPUNIT_ASSERT_EQUAL(+typelib_TypeClass_UNSIGNED_SHORT, +std->aBase.ppTypeRefs[3]->eTypeClass); // unsigned short m4;
471 CPPUNIT_ASSERT_EQUAL(+typelib_TypeClass_CHAR, +std->aBase.ppTypeRefs[10]->eTypeClass); // char m11;
474 void Test::testPolyStruct() {
475 CPPUNIT_ASSERT_EQUAL(
476 OUString(
477 "test.codemaker.cppumaker.Struct<char,short>"),
478 (css::uno::makeAny(
479 test::codemaker::cppumaker::Struct< sal_Unicode, sal_Int16 >()).
480 getValueType().getTypeName()));
482 css::uno::Sequence< css::uno::Sequence< css::uno::Any > >
483 aEmptySequence;
485 CPPUNIT_ASSERT_EQUAL(
486 static_cast< sal_uInt32 >(5),
487 (test::codemaker::cppumaker::make_Struct< sal_uInt32, sal_Bool >(5,
488 aEmptySequence).member1));
491 void Test::testExceptions() {
492 css::uno::Sequence< css::uno::Sequence< css::uno::Any > >
493 aEmptySequence;
495 test::codemaker::cppumaker::TestException1 e11(
496 "abc", nullptr, 1,
497 css::uno::makeAny(123.0),
498 test::codemaker::cppumaker::HelperEnum_ONE,
499 test::codemaker::cppumaker::Struct<sal_Int32, sal_Int32>(5, aEmptySequence), 2);
500 test::codemaker::cppumaker::TestException1 e12(e11);
501 CPPUNIT_ASSERT_EQUAL(e11, e12);
502 test::codemaker::cppumaker::TestException1 e13;
503 e13 = e11;
504 CPPUNIT_ASSERT_EQUAL(e11, e13);
505 test::codemaker::cppumaker::TestException2 e21(
506 "abc", nullptr, 1,
507 css::uno::makeAny(123.0),
508 test::codemaker::cppumaker::HelperEnum_ONE,
509 test::codemaker::cppumaker::Struct<sal_Int32, sal_Int32>(5, aEmptySequence), 2);
510 test::codemaker::cppumaker::TestException2 e22(e21);
511 CPPUNIT_ASSERT_EQUAL(e21, e22);
512 test::codemaker::cppumaker::TestException2 e23;
513 e23 = e21;
514 CPPUNIT_ASSERT_EQUAL(e21, e23);
517 void Test::testConstants() {
518 CPPUNIT_ASSERT_EQUAL(
519 SAL_MIN_INT8, test::codemaker::cppumaker::Constants::byteMin);
520 CPPUNIT_ASSERT_EQUAL(
521 SAL_MAX_INT8, test::codemaker::cppumaker::Constants::byteMax);
522 CPPUNIT_ASSERT_EQUAL(
523 SAL_MIN_INT16, test::codemaker::cppumaker::Constants::shortMin);
524 CPPUNIT_ASSERT_EQUAL(
525 SAL_MAX_INT16, test::codemaker::cppumaker::Constants::shortMax);
526 CPPUNIT_ASSERT_EQUAL(
527 static_cast< sal_uInt16 >(0),
528 test::codemaker::cppumaker::Constants::unsignedShortMin);
529 CPPUNIT_ASSERT_EQUAL(
530 SAL_MAX_UINT16,
531 test::codemaker::cppumaker::Constants::unsignedShortMax);
532 CPPUNIT_ASSERT_EQUAL(
533 SAL_MIN_INT32, test::codemaker::cppumaker::Constants::longMin);
534 CPPUNIT_ASSERT_EQUAL(
535 SAL_MAX_INT32, test::codemaker::cppumaker::Constants::longMax);
536 CPPUNIT_ASSERT_EQUAL(
537 static_cast< sal_uInt32 >(0),
538 test::codemaker::cppumaker::Constants::unsignedLongMin);
539 CPPUNIT_ASSERT_EQUAL(
540 SAL_MAX_UINT32, test::codemaker::cppumaker::Constants::unsignedLongMax);
541 CPPUNIT_ASSERT_EQUAL(
542 SAL_MIN_INT64, test::codemaker::cppumaker::Constants::hyperMin);
543 CPPUNIT_ASSERT_EQUAL(
544 SAL_MAX_INT64, test::codemaker::cppumaker::Constants::hyperMax);
545 CPPUNIT_ASSERT_EQUAL(
546 static_cast< sal_uInt64 >(0),
547 test::codemaker::cppumaker::Constants::unsignedHyperMin);
548 CPPUNIT_ASSERT_EQUAL(
549 SAL_MAX_UINT64,
550 test::codemaker::cppumaker::Constants::unsignedHyperMax);
553 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
557 CPPUNIT_PLUGIN_IMPLEMENT();
559 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */