Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <sal/types.h>
21 :
22 : #include <stdlib.h>
23 :
24 : #include <cppunit/TestSuite.h>
25 : #include <cppunit/TestFixture.h>
26 : #include <cppunit/TestCase.h>
27 : #include <cppunit/plugin/TestPlugIn.h>
28 : #include <cppunit/extensions/HelperMacros.h>
29 :
30 : #include "Enum1.hpp"
31 : #include "Enum2.hpp"
32 : #include "Exception1.hpp"
33 : #include "Exception2.hpp"
34 : #include "Exception2a.hpp"
35 : #include "Exception2b.hpp"
36 : #include "Interface1.hpp"
37 : #include "Interface2.hpp"
38 : #include "Interface2a.hpp"
39 : #include "Interface2b.hpp"
40 : #include "Interface3.hpp"
41 : #include "Poly.hpp"
42 : #include "Struct1.hpp"
43 : #include "Struct2.hpp"
44 : #include "Struct2a.hpp"
45 : #include "Struct2b.hpp"
46 : #include "boost/noncopyable.hpp"
47 : #include "boost/type_traits/is_same.hpp"
48 : #include "com/sun/star/uno/Any.hxx"
49 : #include "com/sun/star/uno/Reference.hxx"
50 : #include "com/sun/star/uno/RuntimeException.hpp"
51 : #include "com/sun/star/uno/Sequence.hxx"
52 : #include "com/sun/star/uno/Type.hxx"
53 : #include "com/sun/star/uno/XInterface.hpp"
54 : #include "osl/diagnose.h"
55 : #include "osl/interlck.h"
56 : #include "rtl/string.h"
57 : #include "rtl/ustring.h"
58 : #include "rtl/ustring.hxx"
59 :
60 : namespace {
61 :
62 : class Base: private boost::noncopyable {
63 : public:
64 58 : Base(): m_count(0) {}
65 :
66 120 : void acquire() {
67 120 : if (osl_atomic_increment(&m_count) == SAL_MAX_INT32) {
68 0 : abort();
69 : }
70 120 : }
71 :
72 120 : void release() {
73 120 : if (osl_atomic_decrement(&m_count) == 0) {
74 58 : delete this;
75 : }
76 120 : }
77 :
78 : protected:
79 58 : virtual ~Base() {}
80 :
81 : private:
82 : oslInterlockedCount m_count;
83 : };
84 :
85 120 : class Impl1: public Interface1, private Base {
86 : public:
87 0 : virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
88 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
89 : {
90 0 : if (type
91 0 : == getCppuType< css::uno::Reference< css::uno::XInterface > >())
92 : {
93 : css::uno::Reference< css::uno::XInterface > ref(
94 0 : static_cast< css::uno::XInterface * >(this));
95 0 : return css::uno::Any(&ref, type);
96 0 : } else if (type == getCppuType< css::uno::Reference< Interface1 > >()) {
97 0 : css::uno::Reference< Interface1 > ref(this);
98 0 : return css::uno::Any(&ref, type);
99 : } else {
100 0 : return css::uno::Any();
101 : }
102 : }
103 :
104 78 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE {
105 78 : Base::acquire();
106 78 : }
107 :
108 78 : virtual void SAL_CALL release() throw () SAL_OVERRIDE {
109 78 : Base::release();
110 78 : }
111 : };
112 :
113 42 : class Impl2: public Interface2a, public Interface3, private Base {
114 : public:
115 12 : virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
116 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
117 : {
118 12 : if (type
119 12 : == getCppuType< css::uno::Reference< css::uno::XInterface > >())
120 : {
121 : css::uno::Reference< css::uno::XInterface > ref(
122 : static_cast< css::uno::XInterface * >(
123 4 : static_cast< Interface2a * >(this)));
124 4 : return css::uno::Any(&ref, type);
125 8 : } else if (type == getCppuType< css::uno::Reference< Interface2 > >()) {
126 2 : css::uno::Reference< Interface2 > ref(this);
127 2 : return css::uno::Any(&ref, type);
128 6 : } else if (type == getCppuType< css::uno::Reference< Interface2a > >())
129 : {
130 0 : css::uno::Reference< Interface2a > ref(this);
131 0 : return css::uno::Any(&ref, type);
132 6 : } else if (type == getCppuType< css::uno::Reference< Interface3 > >()) {
133 2 : css::uno::Reference< Interface3 > ref(this);
134 2 : return css::uno::Any(&ref, type);
135 : } else {
136 4 : return css::uno::Any();
137 : }
138 : }
139 :
140 36 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE {
141 36 : Base::acquire();
142 36 : }
143 :
144 36 : virtual void SAL_CALL release() throw () SAL_OVERRIDE {
145 36 : Base::release();
146 36 : }
147 : };
148 :
149 12 : class Impl2b: public Interface2b, private Base {
150 : public:
151 0 : virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
152 : throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
153 : {
154 0 : if (type
155 0 : == getCppuType< css::uno::Reference< css::uno::XInterface > >())
156 : {
157 : css::uno::Reference< css::uno::XInterface > ref(
158 : static_cast< css::uno::XInterface * >(
159 0 : static_cast< Interface2a * >(this)));
160 0 : return css::uno::Any(&ref, type);
161 0 : } else if (type == getCppuType< css::uno::Reference< Interface2 > >()) {
162 0 : css::uno::Reference< Interface2 > ref(this);
163 0 : return css::uno::Any(&ref, type);
164 0 : } else if (type == getCppuType< css::uno::Reference< Interface2a > >())
165 : {
166 0 : css::uno::Reference< Interface2a > ref(this);
167 0 : return css::uno::Any(&ref, type);
168 0 : } else if (type == getCppuType< css::uno::Reference< Interface2b > >())
169 : {
170 0 : css::uno::Reference< Interface2b > ref(this);
171 0 : return css::uno::Any(&ref, type);
172 : } else {
173 0 : return css::uno::Any();
174 : }
175 : }
176 :
177 6 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE {
178 6 : Base::acquire();
179 6 : }
180 :
181 6 : virtual void SAL_CALL release() throw () SAL_OVERRIDE {
182 6 : Base::release();
183 6 : }
184 : };
185 :
186 126 : class Test: public CppUnit::TestFixture {
187 : public:
188 : void testVoid();
189 : void testBoolean();
190 : void testByte();
191 : void testShort();
192 : void testUnsignedShort();
193 : void testLong();
194 : void testUnsignedLong();
195 : void testHyper();
196 : void testUnsignedHyper();
197 : void testFloat();
198 : void testDouble();
199 : void testChar();
200 : void testString();
201 : void testType();
202 : void testSequence();
203 : void testEnum();
204 : void testStruct();
205 : void testPoly();
206 : void testException();
207 : void testInterface();
208 : void testNull();
209 :
210 4 : CPPUNIT_TEST_SUITE(Test);
211 2 : CPPUNIT_TEST(testVoid);
212 2 : CPPUNIT_TEST(testBoolean);
213 2 : CPPUNIT_TEST(testByte);
214 2 : CPPUNIT_TEST(testShort);
215 2 : CPPUNIT_TEST(testUnsignedShort);
216 2 : CPPUNIT_TEST(testLong);
217 2 : CPPUNIT_TEST(testUnsignedLong);
218 2 : CPPUNIT_TEST(testHyper);
219 2 : CPPUNIT_TEST(testUnsignedHyper);
220 2 : CPPUNIT_TEST(testFloat);
221 2 : CPPUNIT_TEST(testDouble);
222 2 : CPPUNIT_TEST(testChar);
223 2 : CPPUNIT_TEST(testString);
224 2 : CPPUNIT_TEST(testType);
225 2 : CPPUNIT_TEST(testSequence);
226 2 : CPPUNIT_TEST(testEnum);
227 2 : CPPUNIT_TEST(testStruct);
228 2 : CPPUNIT_TEST(testPoly);
229 2 : CPPUNIT_TEST(testException);
230 2 : CPPUNIT_TEST(testInterface);
231 2 : CPPUNIT_TEST(testNull);
232 4 : CPPUNIT_TEST_SUITE_END();
233 : };
234 :
235 2 : void Test::testVoid() {
236 2 : css::uno::Any a;
237 2 : CPPUNIT_ASSERT(a.getValueType() == getVoidCppuType());
238 : {
239 2 : bool b = true;
240 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
241 : }
242 : {
243 2 : sal_Bool b = true;
244 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
245 : }
246 : {
247 2 : sal_Int8 b = 2;
248 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
249 : }
250 : {
251 2 : sal_uInt8 b = 2;
252 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
253 : }
254 : {
255 2 : sal_Int16 b = 2;
256 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
257 : }
258 : {
259 2 : sal_uInt16 b = 2;
260 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
261 : }
262 : {
263 2 : sal_Int32 b = 2;
264 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
265 : }
266 : {
267 2 : sal_uInt32 b = 2;
268 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
269 : }
270 : {
271 2 : sal_Int64 b = 2;
272 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
273 : }
274 : {
275 2 : sal_uInt64 b = 2;
276 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
277 : }
278 : {
279 2 : float b = 2;
280 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
281 : }
282 : {
283 2 : double b = 2;
284 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
285 : }
286 : {
287 2 : sal_Unicode b = '2';
288 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
289 : }
290 : {
291 2 : rtl::OUString b("2");
292 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
293 : }
294 : {
295 2 : css::uno::Type b(getCppuType< rtl::OUString >());
296 4 : CPPUNIT_ASSERT_MESSAGE(
297 : "css::uno::Type",
298 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
299 : }
300 : {
301 2 : css::uno::Any b(rtl::OUString("2"));
302 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
303 : }
304 : {
305 2 : css::uno::Sequence< rtl::OUString > b(2);
306 4 : CPPUNIT_ASSERT_MESSAGE(
307 4 : "css::uno::Sequence<rtl::OUString>", !(a >>= b) && b.getLength() == 2);
308 : }
309 : {
310 2 : Enum1 b = Enum1_M2;
311 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
312 : }
313 : {
314 2 : Struct1 b(2);
315 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
316 : }
317 : {
318 : Exception1 b(
319 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
320 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
321 : }
322 : {
323 2 : css::uno::Reference< Interface1 > i(new Impl1);
324 4 : css::uno::Reference< Interface1 > b(i);
325 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
326 2 : }
327 2 : }
328 :
329 2 : void Test::testBoolean() {
330 2 : css::uno::Any a(false);
331 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Bool >());
332 : {
333 2 : bool b = true;
334 2 : CPPUNIT_ASSERT_MESSAGE("bool", (a >>= b) && !b);
335 : }
336 : {
337 2 : sal_Bool b = true;
338 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", (a >>= b) && !b);
339 : }
340 : {
341 2 : sal_Int8 b = 2;
342 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
343 : }
344 : {
345 2 : sal_uInt8 b = 2;
346 : if (boost::is_same< sal_uInt8, sal_Bool >::value) {
347 2 : CPPUNIT_ASSERT_MESSAGE("@sal_uInt8", (a >>= b) && b == 0);
348 : } else {
349 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
350 : }
351 : }
352 : {
353 2 : sal_Int16 b = 2;
354 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
355 : }
356 : {
357 2 : sal_uInt16 b = 2;
358 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
359 : }
360 : {
361 2 : sal_Int32 b = 2;
362 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
363 : }
364 : {
365 2 : sal_uInt32 b = 2;
366 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
367 : }
368 : {
369 2 : sal_Int64 b = 2;
370 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
371 : }
372 : {
373 2 : sal_uInt64 b = 2;
374 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
375 : }
376 : {
377 2 : float b = 2;
378 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
379 : }
380 : {
381 2 : double b = 2;
382 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
383 : }
384 : {
385 2 : sal_Unicode b = '2';
386 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
387 : }
388 : {
389 2 : rtl::OUString b("2");
390 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
391 : }
392 : {
393 2 : css::uno::Type b(getCppuType< rtl::OUString >());
394 4 : CPPUNIT_ASSERT_MESSAGE(
395 : "css::uno::Type",
396 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
397 : }
398 : {
399 2 : css::uno::Any b(rtl::OUString("2"));
400 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
401 : }
402 : {
403 2 : css::uno::Sequence< rtl::OUString > b(2);
404 4 : CPPUNIT_ASSERT_MESSAGE(
405 : "css::uno::Sequence<rtl::OUString>",
406 4 : !(a >>= b) && b.getLength() == 2);
407 : }
408 : {
409 2 : Enum1 b = Enum1_M2;
410 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
411 : }
412 : {
413 2 : Struct1 b(2);
414 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
415 : }
416 : {
417 : Exception1 b(
418 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
419 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
420 : }
421 : {
422 2 : css::uno::Reference< Interface1 > i(new Impl1);
423 4 : css::uno::Reference< Interface1 > b(i);
424 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
425 2 : }
426 2 : }
427 :
428 2 : void Test::testByte() {
429 2 : css::uno::Any a(static_cast< sal_Int8 >(1));
430 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int8 >());
431 : {
432 2 : bool b = true;
433 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
434 : }
435 : {
436 2 : sal_Bool b = true;
437 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
438 : }
439 : {
440 2 : sal_Int8 b = 2;
441 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", (a >>= b) && b == 1);
442 : }
443 : {
444 2 : sal_uInt8 b = 2;
445 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
446 : }
447 : {
448 2 : sal_Int16 b = 2;
449 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
450 : }
451 : {
452 2 : sal_uInt16 b = 2;
453 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
454 : }
455 : {
456 2 : sal_Int32 b = 2;
457 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
458 : }
459 : {
460 2 : sal_uInt32 b = 2;
461 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
462 : }
463 : {
464 2 : sal_Int64 b = 2;
465 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
466 : }
467 : {
468 2 : sal_uInt64 b = 2;
469 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
470 : }
471 : {
472 2 : float b = 2;
473 2 : CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
474 : }
475 : {
476 2 : double b = 2;
477 2 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
478 : }
479 : {
480 2 : sal_Unicode b = '2';
481 : if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
482 2 : CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
483 : } else {
484 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
485 : }
486 : }
487 : {
488 2 : rtl::OUString b("2");
489 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
490 : }
491 : {
492 2 : css::uno::Type b(getCppuType< rtl::OUString >());
493 4 : CPPUNIT_ASSERT_MESSAGE(
494 : "css::uno::Type",
495 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
496 : }
497 : {
498 2 : css::uno::Any b(rtl::OUString("2"));
499 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
500 : }
501 : {
502 2 : css::uno::Sequence< rtl::OUString > b(2);
503 4 : CPPUNIT_ASSERT_MESSAGE(
504 : "css::uno::Sequence<rtl::OUString>",
505 4 : !(a >>= b) && b.getLength() == 2);
506 : }
507 : {
508 2 : Enum1 b = Enum1_M2;
509 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
510 : }
511 : {
512 2 : Struct1 b(2);
513 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
514 : }
515 : {
516 : Exception1 b(
517 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
518 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
519 : }
520 : {
521 2 : css::uno::Reference< Interface1 > i(new Impl1);
522 4 : css::uno::Reference< Interface1 > b(i);
523 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
524 2 : }
525 2 : }
526 :
527 2 : void Test::testShort() {
528 2 : css::uno::Any a(static_cast< sal_Int16 >(1));
529 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int16 >());
530 : {
531 2 : bool b = true;
532 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
533 : }
534 : {
535 2 : sal_Bool b = true;
536 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
537 : }
538 : {
539 2 : sal_Int8 b = 2;
540 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
541 : }
542 : {
543 2 : sal_uInt8 b = 2;
544 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
545 : }
546 : {
547 2 : sal_Int16 b = 2;
548 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
549 : }
550 : {
551 2 : sal_uInt16 b = 2;
552 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
553 : }
554 : {
555 2 : sal_Int32 b = 2;
556 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
557 : }
558 : {
559 2 : sal_uInt32 b = 2;
560 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
561 : }
562 : {
563 2 : sal_Int64 b = 2;
564 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
565 : }
566 : {
567 2 : sal_uInt64 b = 2;
568 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
569 : }
570 : {
571 2 : float b = 2;
572 2 : CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
573 : }
574 : {
575 2 : double b = 2;
576 2 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
577 : }
578 : {
579 2 : sal_Unicode b = '2';
580 : if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
581 2 : CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
582 : } else {
583 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
584 : }
585 : }
586 : {
587 2 : rtl::OUString b("2");
588 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
589 : }
590 : {
591 2 : css::uno::Type b(getCppuType< rtl::OUString >());
592 4 : CPPUNIT_ASSERT_MESSAGE(
593 : "css::uno::Type",
594 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
595 : }
596 : {
597 2 : css::uno::Any b(rtl::OUString("2"));
598 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
599 : }
600 : {
601 2 : css::uno::Sequence< rtl::OUString > b(2);
602 4 : CPPUNIT_ASSERT_MESSAGE(
603 : "css::uno::Sequence<rtl::OUString>",
604 4 : !(a >>= b) && b.getLength() == 2);
605 : }
606 : {
607 2 : Enum1 b = Enum1_M2;
608 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
609 : }
610 : {
611 2 : Struct1 b(2);
612 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
613 : }
614 : {
615 : Exception1 b(
616 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
617 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
618 : }
619 : {
620 2 : css::uno::Reference< Interface1 > i(new Impl1);
621 4 : css::uno::Reference< Interface1 > b(i);
622 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
623 2 : }
624 2 : }
625 :
626 2 : void Test::testUnsignedShort() {
627 2 : sal_uInt16 n = 1;
628 2 : css::uno::Any a(&n, getCppuType(static_cast< sal_uInt16 const * >(0)));
629 4 : CPPUNIT_ASSERT(
630 2 : a.getValueType() == getCppuType(static_cast< sal_uInt16 const * >(0)));
631 : {
632 2 : bool b = true;
633 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
634 : }
635 : {
636 2 : sal_Bool b = true;
637 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
638 : }
639 : {
640 2 : sal_Int8 b = 2;
641 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
642 : }
643 : {
644 2 : sal_uInt8 b = 2;
645 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
646 : }
647 : {
648 2 : sal_Int16 b = 2;
649 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
650 : }
651 : {
652 2 : sal_uInt16 b = 2;
653 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
654 : }
655 : {
656 2 : sal_Int32 b = 2;
657 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
658 : }
659 : {
660 2 : sal_uInt32 b = 2;
661 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
662 : }
663 : {
664 2 : sal_Int64 b = 2;
665 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
666 : }
667 : {
668 2 : sal_uInt64 b = 2;
669 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
670 : }
671 : {
672 2 : float b = 2;
673 2 : CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
674 : }
675 : {
676 2 : double b = 2;
677 2 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
678 : }
679 : {
680 2 : sal_Unicode b = '2';
681 : if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
682 2 : CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
683 : } else {
684 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
685 : }
686 : }
687 : {
688 2 : rtl::OUString b("2");
689 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
690 : }
691 : {
692 2 : css::uno::Type b(getCppuType< rtl::OUString >());
693 4 : CPPUNIT_ASSERT_MESSAGE(
694 : "css::uno::Type",
695 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
696 : }
697 : {
698 2 : css::uno::Any b(rtl::OUString("2"));
699 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
700 : }
701 : {
702 2 : css::uno::Sequence< rtl::OUString > b(2);
703 4 : CPPUNIT_ASSERT_MESSAGE(
704 : "css::uno::Sequence<rtl::OUString>",
705 4 : !(a >>= b) && b.getLength() == 2);
706 : }
707 : {
708 2 : Enum1 b = Enum1_M2;
709 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
710 : }
711 : {
712 2 : Struct1 b(2);
713 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
714 : }
715 : {
716 : Exception1 b(
717 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
718 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
719 : }
720 : {
721 2 : css::uno::Reference< Interface1 > i(new Impl1);
722 4 : css::uno::Reference< Interface1 > b(i);
723 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
724 2 : }
725 2 : }
726 :
727 2 : void Test::testLong() {
728 2 : css::uno::Any a(static_cast< sal_Int32 >(1));
729 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int32 >());
730 : {
731 2 : bool b = true;
732 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
733 : }
734 : {
735 2 : sal_Bool b = true;
736 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
737 : }
738 : {
739 2 : sal_Int8 b = 2;
740 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
741 : }
742 : {
743 2 : sal_uInt8 b = 2;
744 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
745 : }
746 : {
747 2 : sal_Int16 b = 2;
748 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
749 : }
750 : {
751 2 : sal_uInt16 b = 2;
752 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
753 : }
754 : {
755 2 : sal_Int32 b = 2;
756 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
757 : }
758 : {
759 2 : sal_uInt32 b = 2;
760 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
761 : }
762 : {
763 2 : sal_Int64 b = 2;
764 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
765 : }
766 : {
767 2 : sal_uInt64 b = 2;
768 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
769 : }
770 : {
771 2 : float b = 2;
772 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
773 : }
774 : {
775 2 : double b = 2;
776 2 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
777 : }
778 : {
779 2 : sal_Unicode b = '2';
780 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
781 : }
782 : {
783 2 : rtl::OUString b("2");
784 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
785 : }
786 : {
787 2 : css::uno::Type b(getCppuType< rtl::OUString >());
788 4 : CPPUNIT_ASSERT_MESSAGE(
789 : "css::uno::Type",
790 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
791 : }
792 : {
793 2 : css::uno::Any b(rtl::OUString("2"));
794 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
795 : }
796 : {
797 2 : css::uno::Sequence< rtl::OUString > b(2);
798 4 : CPPUNIT_ASSERT_MESSAGE(
799 : "css::uno::Sequence<rtl::OUString>",
800 4 : !(a >>= b) && b.getLength() == 2);
801 : }
802 : {
803 2 : Enum1 b = Enum1_M2;
804 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
805 : }
806 : {
807 2 : Struct1 b(2);
808 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
809 : }
810 : {
811 : Exception1 b(
812 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
813 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
814 : }
815 : {
816 2 : css::uno::Reference< Interface1 > i(new Impl1);
817 4 : css::uno::Reference< Interface1 > b(i);
818 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
819 2 : }
820 2 : }
821 :
822 2 : void Test::testUnsignedLong() {
823 2 : css::uno::Any a(static_cast< sal_uInt32 >(1));
824 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_uInt32 >());
825 : {
826 2 : bool b = true;
827 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
828 : }
829 : {
830 2 : sal_Bool b = true;
831 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
832 : }
833 : {
834 2 : sal_Int8 b = 2;
835 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
836 : }
837 : {
838 2 : sal_uInt8 b = 2;
839 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
840 : }
841 : {
842 2 : sal_Int16 b = 2;
843 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
844 : }
845 : {
846 2 : sal_uInt16 b = 2;
847 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
848 : }
849 : {
850 2 : sal_Int32 b = 2;
851 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
852 : }
853 : {
854 2 : sal_uInt32 b = 2;
855 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
856 : }
857 : {
858 2 : sal_Int64 b = 2;
859 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
860 : }
861 : {
862 2 : sal_uInt64 b = 2;
863 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
864 : }
865 : {
866 2 : float b = 2;
867 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
868 : }
869 : {
870 2 : double b = 2;
871 2 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
872 : }
873 : {
874 2 : sal_Unicode b = '2';
875 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
876 : }
877 : {
878 2 : rtl::OUString b("2");
879 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
880 : }
881 : {
882 2 : css::uno::Type b(getCppuType< rtl::OUString >());
883 4 : CPPUNIT_ASSERT_MESSAGE(
884 : "css::uno::Type",
885 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
886 : }
887 : {
888 2 : css::uno::Any b(rtl::OUString("2"));
889 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
890 : }
891 : {
892 2 : css::uno::Sequence< rtl::OUString > b(2);
893 4 : CPPUNIT_ASSERT_MESSAGE(
894 : "css::uno::Sequence<rtl::OUString>",
895 4 : !(a >>= b) && b.getLength() == 2);
896 : }
897 : {
898 2 : Enum1 b = Enum1_M2;
899 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
900 : }
901 : {
902 2 : Struct1 b(2);
903 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
904 : }
905 : {
906 : Exception1 b(
907 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
908 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
909 : }
910 : {
911 2 : css::uno::Reference< Interface1 > i(new Impl1);
912 4 : css::uno::Reference< Interface1 > b(i);
913 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
914 2 : }
915 2 : }
916 :
917 2 : void Test::testHyper() {
918 2 : css::uno::Any a(static_cast< sal_Int64 >(1));
919 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int64 >());
920 : {
921 2 : bool b = true;
922 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
923 : }
924 : {
925 2 : sal_Bool b = true;
926 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
927 : }
928 : {
929 2 : sal_Int8 b = 2;
930 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
931 : }
932 : {
933 2 : sal_uInt8 b = 2;
934 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
935 : }
936 : {
937 2 : sal_Int16 b = 2;
938 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
939 : }
940 : {
941 2 : sal_uInt16 b = 2;
942 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
943 : }
944 : {
945 2 : sal_Int32 b = 2;
946 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
947 : }
948 : {
949 2 : sal_uInt32 b = 2;
950 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
951 : }
952 : {
953 2 : sal_Int64 b = 2;
954 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
955 : }
956 : {
957 2 : sal_uInt64 b = 2;
958 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
959 : }
960 : {
961 2 : float b = 2;
962 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
963 : }
964 : {
965 2 : double b = 2;
966 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
967 : }
968 : {
969 2 : sal_Unicode b = '2';
970 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
971 : }
972 : {
973 2 : rtl::OUString b("2");
974 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
975 : }
976 : {
977 2 : css::uno::Type b(getCppuType< rtl::OUString >());
978 4 : CPPUNIT_ASSERT_MESSAGE(
979 : "css::uno::Type",
980 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
981 : }
982 : {
983 2 : css::uno::Any b(rtl::OUString("2"));
984 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
985 : }
986 : {
987 2 : css::uno::Sequence< rtl::OUString > b(2);
988 4 : CPPUNIT_ASSERT_MESSAGE(
989 : "css::uno::Sequence<rtl::OUString>",
990 4 : !(a >>= b) && b.getLength() == 2);
991 : }
992 : {
993 2 : Enum1 b = Enum1_M2;
994 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
995 : }
996 : {
997 2 : Struct1 b(2);
998 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
999 : }
1000 : {
1001 : Exception1 b(
1002 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1003 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1004 : }
1005 : {
1006 2 : css::uno::Reference< Interface1 > i(new Impl1);
1007 4 : css::uno::Reference< Interface1 > b(i);
1008 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1009 2 : }
1010 2 : }
1011 :
1012 2 : void Test::testUnsignedHyper() {
1013 2 : css::uno::Any a(static_cast< sal_uInt64 >(1));
1014 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_uInt64 >());
1015 : {
1016 2 : bool b = true;
1017 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1018 : }
1019 : {
1020 2 : sal_Bool b = true;
1021 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1022 : }
1023 : {
1024 2 : sal_Int8 b = 2;
1025 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1026 : }
1027 : {
1028 2 : sal_uInt8 b = 2;
1029 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1030 : }
1031 : {
1032 2 : sal_Int16 b = 2;
1033 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1034 : }
1035 : {
1036 2 : sal_uInt16 b = 2;
1037 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1038 : }
1039 : {
1040 2 : sal_Int32 b = 2;
1041 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1042 : }
1043 : {
1044 2 : sal_uInt32 b = 2;
1045 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1046 : }
1047 : {
1048 2 : sal_Int64 b = 2;
1049 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
1050 : }
1051 : {
1052 2 : sal_uInt64 b = 2;
1053 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
1054 : }
1055 : {
1056 2 : float b = 2;
1057 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1058 : }
1059 : {
1060 2 : double b = 2;
1061 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1062 : }
1063 : {
1064 2 : sal_Unicode b = '2';
1065 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1066 : }
1067 : {
1068 2 : rtl::OUString b("2");
1069 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1070 : }
1071 : {
1072 2 : css::uno::Type b(getCppuType< rtl::OUString >());
1073 4 : CPPUNIT_ASSERT_MESSAGE(
1074 : "css::uno::Type",
1075 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1076 : }
1077 : {
1078 2 : css::uno::Any b(rtl::OUString("2"));
1079 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1080 : }
1081 : {
1082 2 : css::uno::Sequence< rtl::OUString > b(2);
1083 4 : CPPUNIT_ASSERT_MESSAGE(
1084 : "css::uno::Sequence<rtl::OUString>",
1085 4 : !(a >>= b) && b.getLength() == 2);
1086 : }
1087 : {
1088 2 : Enum1 b = Enum1_M2;
1089 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1090 : }
1091 : {
1092 2 : Struct1 b(2);
1093 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1094 : }
1095 : {
1096 : Exception1 b(
1097 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1098 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1099 : }
1100 : {
1101 2 : css::uno::Reference< Interface1 > i(new Impl1);
1102 4 : css::uno::Reference< Interface1 > b(i);
1103 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1104 2 : }
1105 2 : }
1106 :
1107 2 : void Test::testFloat() {
1108 2 : css::uno::Any a(1.f);
1109 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< float >());
1110 : {
1111 2 : bool b = true;
1112 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1113 : }
1114 : {
1115 2 : sal_Bool b = true;
1116 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1117 : }
1118 : {
1119 2 : sal_Int8 b = 2;
1120 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1121 : }
1122 : {
1123 2 : sal_uInt8 b = 2;
1124 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1125 : }
1126 : {
1127 2 : sal_Int16 b = 2;
1128 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1129 : }
1130 : {
1131 2 : sal_uInt16 b = 2;
1132 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1133 : }
1134 : {
1135 2 : sal_Int32 b = 2;
1136 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1137 : }
1138 : {
1139 2 : sal_uInt32 b = 2;
1140 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1141 : }
1142 : {
1143 2 : sal_Int64 b = 2;
1144 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1145 : }
1146 : {
1147 2 : sal_uInt64 b = 2;
1148 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1149 : }
1150 : {
1151 2 : float b = 2;
1152 2 : CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
1153 : }
1154 : {
1155 2 : double b = 2;
1156 2 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1157 : }
1158 : {
1159 2 : sal_Unicode b = '2';
1160 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1161 : }
1162 : {
1163 2 : rtl::OUString b("2");
1164 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1165 : }
1166 : {
1167 2 : css::uno::Type b(getCppuType< rtl::OUString >());
1168 4 : CPPUNIT_ASSERT_MESSAGE(
1169 : "css::uno::Type",
1170 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1171 : }
1172 : {
1173 2 : css::uno::Any b(rtl::OUString("2"));
1174 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1175 : }
1176 : {
1177 2 : css::uno::Sequence< rtl::OUString > b(2);
1178 4 : CPPUNIT_ASSERT_MESSAGE(
1179 : "css::uno::Sequence<rtl::OUString>",
1180 4 : !(a >>= b) && b.getLength() == 2);
1181 : }
1182 : {
1183 2 : Enum1 b = Enum1_M2;
1184 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1185 : }
1186 : {
1187 2 : Struct1 b(2);
1188 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1189 : }
1190 : {
1191 : Exception1 b(
1192 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1193 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1194 : }
1195 : {
1196 2 : css::uno::Reference< Interface1 > i(new Impl1);
1197 4 : css::uno::Reference< Interface1 > b(i);
1198 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1199 2 : }
1200 2 : }
1201 :
1202 2 : void Test::testDouble() {
1203 2 : css::uno::Any a(1.);
1204 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< double >());
1205 : {
1206 2 : bool b = true;
1207 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1208 : }
1209 : {
1210 2 : sal_Bool b = true;
1211 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1212 : }
1213 : {
1214 2 : sal_Int8 b = 2;
1215 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1216 : }
1217 : {
1218 2 : sal_uInt8 b = 2;
1219 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1220 : }
1221 : {
1222 2 : sal_Int16 b = 2;
1223 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1224 : }
1225 : {
1226 2 : sal_uInt16 b = 2;
1227 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1228 : }
1229 : {
1230 2 : sal_Int32 b = 2;
1231 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1232 : }
1233 : {
1234 2 : sal_uInt32 b = 2;
1235 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1236 : }
1237 : {
1238 2 : sal_Int64 b = 2;
1239 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1240 : }
1241 : {
1242 2 : sal_uInt64 b = 2;
1243 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1244 : }
1245 : {
1246 2 : float b = 2;
1247 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1248 : }
1249 : {
1250 2 : double b = 2;
1251 2 : CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1252 : }
1253 : {
1254 2 : sal_Unicode b = '2';
1255 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1256 : }
1257 : {
1258 2 : rtl::OUString b("2");
1259 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1260 : }
1261 : {
1262 2 : css::uno::Type b(getCppuType< rtl::OUString >());
1263 4 : CPPUNIT_ASSERT_MESSAGE(
1264 : "css::uno::Type",
1265 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1266 : }
1267 : {
1268 2 : css::uno::Any b(rtl::OUString("2"));
1269 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1270 : }
1271 : {
1272 2 : css::uno::Sequence< rtl::OUString > b(2);
1273 4 : CPPUNIT_ASSERT_MESSAGE(
1274 : "css::uno::Sequence<rtl::OUString>",
1275 4 : !(a >>= b) && b.getLength() == 2);
1276 : }
1277 : {
1278 2 : Enum1 b = Enum1_M2;
1279 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1280 : }
1281 : {
1282 2 : Struct1 b(2);
1283 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1284 : }
1285 : {
1286 : Exception1 b(
1287 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1288 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1289 : }
1290 : {
1291 2 : css::uno::Reference< Interface1 > i(new Impl1);
1292 4 : css::uno::Reference< Interface1 > b(i);
1293 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1294 2 : }
1295 2 : }
1296 :
1297 2 : void Test::testChar() {
1298 2 : sal_Unicode c = '1';
1299 2 : css::uno::Any a(&c, getCppuType< sal_Unicode >());
1300 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Unicode >());
1301 : {
1302 2 : bool b = true;
1303 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1304 : }
1305 : {
1306 2 : sal_Bool b = true;
1307 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1308 : }
1309 : {
1310 2 : sal_Int8 b = 2;
1311 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1312 : }
1313 : {
1314 2 : sal_uInt8 b = 2;
1315 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1316 : }
1317 : {
1318 2 : sal_Int16 b = 2;
1319 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1320 : }
1321 : {
1322 2 : sal_uInt16 b = 2;
1323 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1324 : }
1325 : {
1326 2 : sal_Int32 b = 2;
1327 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1328 : }
1329 : {
1330 2 : sal_uInt32 b = 2;
1331 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1332 : }
1333 : {
1334 2 : sal_Int64 b = 2;
1335 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1336 : }
1337 : {
1338 2 : sal_uInt64 b = 2;
1339 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1340 : }
1341 : {
1342 2 : float b = 2;
1343 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1344 : }
1345 : {
1346 2 : double b = 2;
1347 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1348 : }
1349 : {
1350 2 : sal_Unicode b = '2';
1351 : if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
1352 2 : CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", !(a >>= b) && b == '2');
1353 : } else {
1354 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", (a >>= b) && b == '1');
1355 : }
1356 : }
1357 : {
1358 2 : rtl::OUString b("2");
1359 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1360 : }
1361 : {
1362 2 : css::uno::Type b(getCppuType< rtl::OUString >());
1363 4 : CPPUNIT_ASSERT_MESSAGE(
1364 : "css::uno::Type",
1365 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1366 : }
1367 : {
1368 2 : css::uno::Any b(rtl::OUString("2"));
1369 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1370 : }
1371 : {
1372 2 : css::uno::Sequence< rtl::OUString > b(2);
1373 4 : CPPUNIT_ASSERT_MESSAGE(
1374 : "css::uno::Sequence<rtl::OUString>",
1375 4 : !(a >>= b) && b.getLength() == 2);
1376 : }
1377 : {
1378 2 : Enum1 b = Enum1_M2;
1379 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1380 : }
1381 : {
1382 2 : Struct1 b(2);
1383 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1384 : }
1385 : {
1386 : Exception1 b(
1387 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1388 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1389 : }
1390 : {
1391 2 : css::uno::Reference< Interface1 > i(new Impl1);
1392 4 : css::uno::Reference< Interface1 > b(i);
1393 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1394 2 : }
1395 2 : }
1396 :
1397 2 : void Test::testString() {
1398 2 : css::uno::Any a(rtl::OUString("1"));
1399 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< rtl::OUString >());
1400 : {
1401 2 : bool b = true;
1402 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1403 : }
1404 : {
1405 2 : sal_Bool b = true;
1406 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1407 : }
1408 : {
1409 2 : sal_Int8 b = 2;
1410 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1411 : }
1412 : {
1413 2 : sal_uInt8 b = 2;
1414 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1415 : }
1416 : {
1417 2 : sal_Int16 b = 2;
1418 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1419 : }
1420 : {
1421 2 : sal_uInt16 b = 2;
1422 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1423 : }
1424 : {
1425 2 : sal_Int32 b = 2;
1426 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1427 : }
1428 : {
1429 2 : sal_uInt32 b = 2;
1430 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1431 : }
1432 : {
1433 2 : sal_Int64 b = 2;
1434 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1435 : }
1436 : {
1437 2 : sal_uInt64 b = 2;
1438 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1439 : }
1440 : {
1441 2 : float b = 2;
1442 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1443 : }
1444 : {
1445 2 : double b = 2;
1446 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1447 : }
1448 : {
1449 2 : sal_Unicode b = '2';
1450 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1451 : }
1452 : {
1453 2 : rtl::OUString b("2");
1454 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", (a >>= b) && b == "1" );
1455 : }
1456 : {
1457 2 : css::uno::Type b(getCppuType< rtl::OUString >());
1458 4 : CPPUNIT_ASSERT_MESSAGE(
1459 : "css::uno::Type",
1460 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1461 : }
1462 : {
1463 2 : css::uno::Any b(rtl::OUString("2"));
1464 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1465 : }
1466 : {
1467 2 : css::uno::Sequence< rtl::OUString > b(2);
1468 4 : CPPUNIT_ASSERT_MESSAGE(
1469 : "css::uno::Sequence<rtl::OUString>",
1470 4 : !(a >>= b) && b.getLength() == 2);
1471 : }
1472 : {
1473 2 : Enum1 b = Enum1_M2;
1474 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1475 : }
1476 : {
1477 2 : Struct1 b(2);
1478 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1479 : }
1480 : {
1481 : Exception1 b(
1482 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1483 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1484 : }
1485 : {
1486 2 : css::uno::Reference< Interface1 > i(new Impl1);
1487 4 : css::uno::Reference< Interface1 > b(i);
1488 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1489 2 : }
1490 2 : }
1491 :
1492 2 : void Test::testType() {
1493 2 : css::uno::Any a(getCppuType< sal_Int32 >());
1494 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< css::uno::Type >());
1495 : {
1496 2 : bool b = true;
1497 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1498 : }
1499 : {
1500 2 : sal_Bool b = true;
1501 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1502 : }
1503 : {
1504 2 : sal_Int8 b = 2;
1505 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1506 : }
1507 : {
1508 2 : sal_uInt8 b = 2;
1509 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1510 : }
1511 : {
1512 2 : sal_Int16 b = 2;
1513 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1514 : }
1515 : {
1516 2 : sal_uInt16 b = 2;
1517 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1518 : }
1519 : {
1520 2 : sal_Int32 b = 2;
1521 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1522 : }
1523 : {
1524 2 : sal_uInt32 b = 2;
1525 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1526 : }
1527 : {
1528 2 : sal_Int64 b = 2;
1529 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1530 : }
1531 : {
1532 2 : sal_uInt64 b = 2;
1533 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1534 : }
1535 : {
1536 2 : float b = 2;
1537 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1538 : }
1539 : {
1540 2 : double b = 2;
1541 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1542 : }
1543 : {
1544 2 : sal_Unicode b = '2';
1545 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1546 : }
1547 : {
1548 2 : rtl::OUString b("2");
1549 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1550 : }
1551 : {
1552 2 : css::uno::Type b(getCppuType< rtl::OUString >());
1553 4 : CPPUNIT_ASSERT_MESSAGE(
1554 4 : "css::uno::Type", (a >>= b) && b == getCppuType< sal_Int32 >());
1555 : }
1556 : {
1557 2 : css::uno::Any b(rtl::OUString("2"));
1558 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1559 : }
1560 : {
1561 2 : css::uno::Sequence< rtl::OUString > b(2);
1562 4 : CPPUNIT_ASSERT_MESSAGE(
1563 : "css::uno::Sequence<rtl::OUString>",
1564 4 : !(a >>= b) && b.getLength() == 2);
1565 : }
1566 : {
1567 2 : Enum1 b = Enum1_M2;
1568 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1569 : }
1570 : {
1571 2 : Struct1 b(2);
1572 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1573 : }
1574 : {
1575 : Exception1 b(
1576 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1577 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1578 : }
1579 : {
1580 2 : css::uno::Reference< Interface1 > i(new Impl1);
1581 4 : css::uno::Reference< Interface1 > b(i);
1582 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1583 2 : }
1584 2 : }
1585 :
1586 2 : void Test::testSequence() {
1587 2 : sal_Int32 n = 1;
1588 2 : css::uno::Any a(css::uno::Sequence< sal_Int32 >(&n, 1));
1589 4 : CPPUNIT_ASSERT(
1590 2 : a.getValueType() == getCppuType< css::uno::Sequence< sal_Int32 > >());
1591 : {
1592 2 : bool b = true;
1593 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1594 : }
1595 : {
1596 2 : sal_Bool b = true;
1597 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1598 : }
1599 : {
1600 2 : sal_Int8 b = 2;
1601 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1602 : }
1603 : {
1604 2 : sal_uInt8 b = 2;
1605 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1606 : }
1607 : {
1608 2 : sal_Int16 b = 2;
1609 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1610 : }
1611 : {
1612 2 : sal_uInt16 b = 2;
1613 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1614 : }
1615 : {
1616 2 : sal_Int32 b = 2;
1617 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1618 : }
1619 : {
1620 2 : sal_uInt32 b = 2;
1621 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1622 : }
1623 : {
1624 2 : sal_Int64 b = 2;
1625 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1626 : }
1627 : {
1628 2 : sal_uInt64 b = 2;
1629 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1630 : }
1631 : {
1632 2 : float b = 2;
1633 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1634 : }
1635 : {
1636 2 : double b = 2;
1637 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1638 : }
1639 : {
1640 2 : sal_Unicode b = '2';
1641 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1642 : }
1643 : {
1644 2 : rtl::OUString b("2");
1645 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1646 : }
1647 : {
1648 2 : css::uno::Type b(getCppuType< rtl::OUString >());
1649 4 : CPPUNIT_ASSERT_MESSAGE(
1650 : "css::uno::Type",
1651 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1652 : }
1653 : {
1654 2 : css::uno::Any b(rtl::OUString("2"));
1655 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1656 : }
1657 : {
1658 2 : css::uno::Sequence< rtl::OUString > b(2);
1659 4 : CPPUNIT_ASSERT_MESSAGE(
1660 : "css::uno::Sequence<rtl::OUString>",
1661 4 : !(a >>= b) && b.getLength() == 2);
1662 : }
1663 : {
1664 2 : css::uno::Sequence< sal_Int32 > b(2);
1665 4 : CPPUNIT_ASSERT_MESSAGE(
1666 : "css::uno::Sequence<sal_Int32>",
1667 4 : (a >>= b) && b.getLength() == 1 && b[0] == 1);
1668 : }
1669 : {
1670 2 : Enum1 b = Enum1_M2;
1671 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1672 : }
1673 : {
1674 2 : Struct1 b(2);
1675 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1676 : }
1677 : {
1678 : Exception1 b(
1679 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1680 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1681 : }
1682 : {
1683 2 : css::uno::Reference< Interface1 > i(new Impl1);
1684 4 : css::uno::Reference< Interface1 > b(i);
1685 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1686 2 : }
1687 2 : }
1688 :
1689 2 : void Test::testEnum() {
1690 2 : css::uno::Any a(Enum2_M1);
1691 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< Enum2 >());
1692 : {
1693 2 : bool b = true;
1694 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1695 : }
1696 : {
1697 2 : sal_Bool b = true;
1698 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1699 : }
1700 : {
1701 2 : sal_Int8 b = 2;
1702 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1703 : }
1704 : {
1705 2 : sal_uInt8 b = 2;
1706 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1707 : }
1708 : {
1709 2 : sal_Int16 b = 2;
1710 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1711 : }
1712 : {
1713 2 : sal_uInt16 b = 2;
1714 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1715 : }
1716 : {
1717 2 : sal_Int32 b = 2;
1718 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1719 : }
1720 : {
1721 2 : sal_uInt32 b = 2;
1722 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1723 : }
1724 : {
1725 2 : sal_Int64 b = 2;
1726 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1727 : }
1728 : {
1729 2 : sal_uInt64 b = 2;
1730 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1731 : }
1732 : {
1733 2 : float b = 2;
1734 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1735 : }
1736 : {
1737 2 : double b = 2;
1738 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1739 : }
1740 : {
1741 2 : sal_Unicode b = '2';
1742 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1743 : }
1744 : {
1745 2 : rtl::OUString b("2");
1746 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1747 : }
1748 : {
1749 2 : css::uno::Type b(getCppuType< rtl::OUString >());
1750 4 : CPPUNIT_ASSERT_MESSAGE(
1751 : "css::uno::Type",
1752 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1753 : }
1754 : {
1755 2 : css::uno::Any b(rtl::OUString("2"));
1756 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1757 : }
1758 : {
1759 2 : css::uno::Sequence< rtl::OUString > b(2);
1760 4 : CPPUNIT_ASSERT_MESSAGE(
1761 : "css::uno::Sequence<rtl::OUString>",
1762 4 : !(a >>= b) && b.getLength() == 2);
1763 : }
1764 : {
1765 2 : Enum1 b = Enum1_M2;
1766 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1767 : }
1768 : {
1769 2 : Enum2 b = Enum2_M2;
1770 2 : CPPUNIT_ASSERT_MESSAGE("Enum2", (a >>= b) && b == Enum2_M1);
1771 : }
1772 : {
1773 2 : Struct1 b(2);
1774 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1775 : }
1776 : {
1777 : Exception1 b(
1778 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1779 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1780 : }
1781 : {
1782 2 : css::uno::Reference< Interface1 > i(new Impl1);
1783 4 : css::uno::Reference< Interface1 > b(i);
1784 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1785 2 : }
1786 2 : }
1787 :
1788 2 : void Test::testStruct() {
1789 2 : css::uno::Any a(Struct2a(1, 3));
1790 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< Struct2a >());
1791 : {
1792 2 : bool b = true;
1793 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1794 : }
1795 : {
1796 2 : sal_Bool b = true;
1797 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1798 : }
1799 : {
1800 2 : sal_Int8 b = 2;
1801 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1802 : }
1803 : {
1804 2 : sal_uInt8 b = 2;
1805 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1806 : }
1807 : {
1808 2 : sal_Int16 b = 2;
1809 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1810 : }
1811 : {
1812 2 : sal_uInt16 b = 2;
1813 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1814 : }
1815 : {
1816 2 : sal_Int32 b = 2;
1817 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1818 : }
1819 : {
1820 2 : sal_uInt32 b = 2;
1821 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1822 : }
1823 : {
1824 2 : sal_Int64 b = 2;
1825 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1826 : }
1827 : {
1828 2 : sal_uInt64 b = 2;
1829 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1830 : }
1831 : {
1832 2 : float b = 2;
1833 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1834 : }
1835 : {
1836 2 : double b = 2;
1837 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1838 : }
1839 : {
1840 2 : sal_Unicode b = '2';
1841 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1842 : }
1843 : {
1844 2 : rtl::OUString b("2");
1845 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1846 : }
1847 : {
1848 2 : css::uno::Type b(getCppuType< rtl::OUString >());
1849 4 : CPPUNIT_ASSERT_MESSAGE(
1850 : "css::uno::Type",
1851 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1852 : }
1853 : {
1854 2 : css::uno::Any b(rtl::OUString("2"));
1855 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1856 : }
1857 : {
1858 2 : css::uno::Sequence< rtl::OUString > b(2);
1859 4 : CPPUNIT_ASSERT_MESSAGE(
1860 : "css::uno::Sequence<rtl::OUString>",
1861 4 : !(a >>= b) && b.getLength() == 2);
1862 : }
1863 : {
1864 2 : Enum1 b = Enum1_M2;
1865 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1866 : }
1867 : {
1868 2 : Struct1 b(2);
1869 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1870 : }
1871 : {
1872 2 : Struct2 b(2);
1873 2 : CPPUNIT_ASSERT_MESSAGE("Struct2", (a >>= b) && b.member == 1);
1874 : }
1875 : {
1876 2 : Struct2a b(2, 2);
1877 4 : CPPUNIT_ASSERT_MESSAGE(
1878 2 : "Struct2a", (a >>= b) && b.member == 1 && b.member2 == 3);
1879 : }
1880 : {
1881 2 : Struct2b b(2, 2, 2);
1882 2 : CPPUNIT_ASSERT_MESSAGE("Struct2b", !(a >>= b) && b.member == 2);
1883 : }
1884 : {
1885 : Exception1 b(
1886 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1887 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1888 : }
1889 : {
1890 2 : css::uno::Reference< Interface1 > i(new Impl1);
1891 4 : css::uno::Reference< Interface1 > b(i);
1892 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1893 2 : }
1894 2 : }
1895 :
1896 2 : void Test::testPoly() {
1897 2 : css::uno::Any a;
1898 2 : a <<= Poly< css::uno::Sequence< ::sal_Unicode > >();
1899 2 : CPPUNIT_ASSERT_MESSAGE( "type name", a.getValueType().getTypeName() == "Poly<[]char>" );
1900 4 : CPPUNIT_ASSERT_MESSAGE(
1901 : "constructor",
1902 4 : a == css::uno::Any(Poly< css::uno::Sequence< ::sal_Unicode > >()));
1903 2 : }
1904 :
1905 2 : void Test::testException() {
1906 : css::uno::Any a(
1907 : Exception2a(
1908 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 1,
1909 2 : 3));
1910 2 : CPPUNIT_ASSERT(a.getValueType() == getCppuType< Exception2a >());
1911 : {
1912 2 : bool b = true;
1913 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1914 : }
1915 : {
1916 2 : sal_Bool b = true;
1917 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1918 : }
1919 : {
1920 2 : sal_Int8 b = 2;
1921 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1922 : }
1923 : {
1924 2 : sal_uInt8 b = 2;
1925 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1926 : }
1927 : {
1928 2 : sal_Int16 b = 2;
1929 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1930 : }
1931 : {
1932 2 : sal_uInt16 b = 2;
1933 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1934 : }
1935 : {
1936 2 : sal_Int32 b = 2;
1937 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1938 : }
1939 : {
1940 2 : sal_uInt32 b = 2;
1941 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1942 : }
1943 : {
1944 2 : sal_Int64 b = 2;
1945 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1946 : }
1947 : {
1948 2 : sal_uInt64 b = 2;
1949 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1950 : }
1951 : {
1952 2 : float b = 2;
1953 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1954 : }
1955 : {
1956 2 : double b = 2;
1957 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1958 : }
1959 : {
1960 2 : sal_Unicode b = '2';
1961 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1962 : }
1963 : {
1964 2 : rtl::OUString b("2");
1965 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1966 : }
1967 : {
1968 2 : css::uno::Type b(getCppuType< rtl::OUString >());
1969 4 : CPPUNIT_ASSERT_MESSAGE(
1970 : "css::uno::Type",
1971 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
1972 : }
1973 : {
1974 2 : css::uno::Any b(rtl::OUString("2"));
1975 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1976 : }
1977 : {
1978 2 : css::uno::Sequence< rtl::OUString > b(2);
1979 4 : CPPUNIT_ASSERT_MESSAGE(
1980 : "css::uno::Sequence<rtl::OUString>",
1981 4 : !(a >>= b) && b.getLength() == 2);
1982 : }
1983 : {
1984 2 : Enum1 b = Enum1_M2;
1985 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1986 : }
1987 : {
1988 2 : Struct1 b(2);
1989 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1990 : }
1991 : {
1992 : Exception1 b(
1993 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1994 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1995 : }
1996 : {
1997 : Exception2 b(
1998 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1999 2 : CPPUNIT_ASSERT_MESSAGE("Exception2", (a >>= b) && b.member == 1);
2000 : }
2001 : {
2002 : Exception2a b(
2003 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2004 2 : 2);
2005 4 : CPPUNIT_ASSERT_MESSAGE(
2006 4 : "Exception2a", (a >>= b) && b.member == 1 && b.member2 == 3);
2007 : }
2008 : {
2009 : Exception2b b(
2010 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2011 2 : 2);
2012 2 : CPPUNIT_ASSERT_MESSAGE("Exception2b", !(a >>= b) && b.member == 2);
2013 : }
2014 : {
2015 2 : css::uno::Reference< Interface1 > i(new Impl1);
2016 4 : css::uno::Reference< Interface1 > b(i);
2017 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2018 2 : }
2019 2 : }
2020 :
2021 2 : void Test::testInterface() {
2022 2 : css::uno::Reference< Interface2a > i2(new Impl2);
2023 4 : css::uno::Any a(i2);
2024 4 : CPPUNIT_ASSERT(
2025 : a.getValueType()
2026 2 : == getCppuType< css::uno::Reference< Interface2a > >());
2027 : {
2028 2 : bool b = true;
2029 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2030 : }
2031 : {
2032 2 : sal_Bool b = true;
2033 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2034 : }
2035 : {
2036 2 : sal_Int8 b = 2;
2037 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2038 : }
2039 : {
2040 2 : sal_uInt8 b = 2;
2041 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2042 : }
2043 : {
2044 2 : sal_Int16 b = 2;
2045 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2046 : }
2047 : {
2048 2 : sal_uInt16 b = 2;
2049 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2050 : }
2051 : {
2052 2 : sal_Int32 b = 2;
2053 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2054 : }
2055 : {
2056 2 : sal_uInt32 b = 2;
2057 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2058 : }
2059 : {
2060 2 : sal_Int64 b = 2;
2061 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2062 : }
2063 : {
2064 2 : sal_uInt64 b = 2;
2065 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2066 : }
2067 : {
2068 2 : float b = 2;
2069 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2070 : }
2071 : {
2072 2 : double b = 2;
2073 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2074 : }
2075 : {
2076 2 : sal_Unicode b = '2';
2077 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2078 : }
2079 : {
2080 2 : rtl::OUString b("2");
2081 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
2082 : }
2083 : {
2084 2 : css::uno::Type b(getCppuType< rtl::OUString >());
2085 4 : CPPUNIT_ASSERT_MESSAGE(
2086 : "css::uno::Type",
2087 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
2088 : }
2089 : {
2090 2 : css::uno::Any b(rtl::OUString("2"));
2091 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2092 : }
2093 : {
2094 2 : css::uno::Sequence< rtl::OUString > b(2);
2095 4 : CPPUNIT_ASSERT_MESSAGE(
2096 : "css::uno::Sequence<rtl::OUString>",
2097 4 : !(a >>= b) && b.getLength() == 2);
2098 : }
2099 : {
2100 2 : Enum1 b = Enum1_M2;
2101 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2102 : }
2103 : {
2104 2 : Struct1 b(2);
2105 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2106 : }
2107 : {
2108 : Exception1 b(
2109 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2110 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2111 : }
2112 : {
2113 2 : css::uno::Reference< Interface1 > i(new Impl1);
2114 4 : css::uno::Reference< Interface1 > b(i);
2115 4 : CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2116 : }
2117 : {
2118 2 : css::uno::Reference< Interface2 > b(new Impl2);
2119 2 : CPPUNIT_ASSERT_MESSAGE("Interface2", (a >>= b) && b == i2);
2120 : }
2121 : {
2122 2 : css::uno::Reference< Interface2a > b(new Impl2);
2123 2 : CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && b == i2);
2124 : }
2125 : {
2126 2 : css::uno::Reference< Interface2b > i(new Impl2b);
2127 4 : css::uno::Reference< Interface2b > b(i);
2128 4 : CPPUNIT_ASSERT_MESSAGE("Interface2b", !(a >>= b) && b == i);
2129 : }
2130 : {
2131 2 : css::uno::Reference< Interface3 > b(new Impl2);
2132 2 : CPPUNIT_ASSERT_MESSAGE("Interface3", (a >>= b) && b == i2);
2133 2 : }
2134 2 : }
2135 :
2136 2 : void Test::testNull() {
2137 2 : css::uno::Any a = css::uno::Any(css::uno::Reference< Interface2a >());
2138 4 : CPPUNIT_ASSERT(
2139 : a.getValueType()
2140 2 : == getCppuType< css::uno::Reference< Interface2a > >());
2141 : {
2142 2 : bool b = true;
2143 2 : CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2144 : }
2145 : {
2146 2 : sal_Bool b = true;
2147 2 : CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2148 : }
2149 : {
2150 2 : sal_Int8 b = 2;
2151 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2152 : }
2153 : {
2154 2 : sal_uInt8 b = 2;
2155 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2156 : }
2157 : {
2158 2 : sal_Int16 b = 2;
2159 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2160 : }
2161 : {
2162 2 : sal_uInt16 b = 2;
2163 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2164 : }
2165 : {
2166 2 : sal_Int32 b = 2;
2167 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2168 : }
2169 : {
2170 2 : sal_uInt32 b = 2;
2171 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2172 : }
2173 : {
2174 2 : sal_Int64 b = 2;
2175 2 : CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2176 : }
2177 : {
2178 2 : sal_uInt64 b = 2;
2179 2 : CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2180 : }
2181 : {
2182 2 : float b = 2;
2183 2 : CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2184 : }
2185 : {
2186 2 : double b = 2;
2187 2 : CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2188 : }
2189 : {
2190 2 : sal_Unicode b = '2';
2191 2 : CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2192 : }
2193 : {
2194 2 : rtl::OUString b("2");
2195 2 : CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
2196 : }
2197 : {
2198 2 : css::uno::Type b(getCppuType< rtl::OUString >());
2199 4 : CPPUNIT_ASSERT_MESSAGE(
2200 : "css::uno::Type",
2201 4 : !(a >>= b) && b == getCppuType< rtl::OUString >());
2202 : }
2203 : {
2204 2 : css::uno::Any b(rtl::OUString("2"));
2205 2 : CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2206 : }
2207 : {
2208 2 : css::uno::Sequence< rtl::OUString > b(2);
2209 4 : CPPUNIT_ASSERT_MESSAGE(
2210 : "css::uno::Sequence<rtl::OUString>",
2211 4 : !(a >>= b) && b.getLength() == 2);
2212 : }
2213 : {
2214 2 : Enum1 b = Enum1_M2;
2215 2 : CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2216 : }
2217 : {
2218 2 : Struct1 b(2);
2219 2 : CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2220 : }
2221 : {
2222 : Exception1 b(
2223 2 : rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2224 2 : CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2225 : }
2226 : {
2227 2 : css::uno::Reference< Interface1 > b(new Impl1);
2228 4 : CPPUNIT_ASSERT_MESSAGE(
2229 4 : "Interface1", (a >>= b) && !b.is());
2230 : }
2231 : {
2232 2 : css::uno::Reference< Interface2 > b(new Impl2);
2233 4 : CPPUNIT_ASSERT_MESSAGE(
2234 4 : "Interface2", (a >>= b) && !b.is());
2235 : }
2236 : {
2237 2 : css::uno::Reference< Interface2a > b(new Impl2);
2238 2 : CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && !b.is());
2239 : }
2240 : {
2241 2 : css::uno::Reference< Interface2b > b(new Impl2b);
2242 4 : CPPUNIT_ASSERT_MESSAGE(
2243 4 : "Interface2b", (a >>= b) && !b.is());
2244 : }
2245 : {
2246 2 : css::uno::Reference< Interface3 > b(new Impl2);
2247 4 : CPPUNIT_ASSERT_MESSAGE(
2248 4 : "Interface3", (a >>= b) && !b.is());
2249 2 : }
2250 2 : }
2251 :
2252 2 : CPPUNIT_TEST_SUITE_REGISTRATION(Test);
2253 :
2254 : }
2255 :
2256 8 : CPPUNIT_PLUGIN_IMPLEMENT();
2257 :
2258 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|