1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
24 #include <cppunit/TestFixture.h>
25 #include <cppunit/plugin/TestPlugIn.h>
26 #include <cppunit/extensions/HelperMacros.h>
30 #include <Exception1.hpp>
31 #include <Exception2.hpp>
32 #include <Exception2a.hpp>
33 #include <Exception2b.hpp>
34 #include <Interface1.hpp>
35 #include <Interface2.hpp>
36 #include <Interface2a.hpp>
37 #include <Interface2b.hpp>
38 #include <Interface3.hpp>
40 #include <Struct1.hpp>
41 #include <Struct2.hpp>
42 #include <Struct2a.hpp>
43 #include <Struct2b.hpp>
44 #include <com/sun/star/uno/Any.hxx>
45 #include <com/sun/star/uno/Reference.hxx>
46 #include <com/sun/star/uno/Sequence.hxx>
47 #include <com/sun/star/uno/Type.hxx>
48 #include <o3tl/cppunittraitshelper.hxx>
49 #include <osl/interlck.h>
50 #include <rtl/ustring.hxx>
58 Base(const Base
&) = delete;
59 const Base
& operator=(const Base
&) = delete;
62 if (osl_atomic_increment(&m_count
) == SAL_MAX_INT32
) {
68 if (osl_atomic_decrement(&m_count
) == 0) {
77 oslInterlockedCount m_count
;
80 class Impl1
: public Interface1
, private Base
{
82 virtual css::uno::Any SAL_CALL
queryInterface(css::uno::Type
const & type
) override
84 if (type
== cppu::UnoType
<css::uno::XInterface
>::get()) {
85 css::uno::Reference
< css::uno::XInterface
> ref(
86 static_cast< css::uno::XInterface
* >(this));
87 return css::uno::Any(&ref
, type
);
89 if (type
== cppu::UnoType
<Interface1
>::get()) {
90 css::uno::Reference
< Interface1
> ref(this);
91 return css::uno::Any(&ref
, type
);
93 return css::uno::Any();
96 virtual void SAL_CALL
acquire() noexcept override
{
100 virtual void SAL_CALL
release() noexcept override
{
105 class Impl2
: public Interface2a
, public Interface3
, private Base
{
107 virtual css::uno::Any SAL_CALL
queryInterface(css::uno::Type
const & type
) override
109 if (type
== cppu::UnoType
<css::uno::XInterface
>::get()) {
110 css::uno::Reference
< css::uno::XInterface
> ref(
111 static_cast< css::uno::XInterface
* >(
112 static_cast< Interface2a
* >(this)));
113 return css::uno::Any(&ref
, type
);
115 if (type
== cppu::UnoType
<Interface2
>::get()) {
116 css::uno::Reference
< Interface2
> ref(this);
117 return css::uno::Any(&ref
, type
);
119 if (type
== cppu::UnoType
<Interface2a
>::get()) {
120 css::uno::Reference
< Interface2a
> ref(this);
121 return css::uno::Any(&ref
, type
);
123 if (type
== cppu::UnoType
<Interface3
>::get()) {
124 css::uno::Reference
< Interface3
> ref(this);
125 return css::uno::Any(&ref
, type
);
127 return css::uno::Any();
130 virtual void SAL_CALL
acquire() noexcept override
{
134 virtual void SAL_CALL
release() noexcept override
{
139 class Impl2b
: public Interface2b
, private Base
{
141 virtual css::uno::Any SAL_CALL
queryInterface(css::uno::Type
const & type
) override
143 if (type
== cppu::UnoType
<css::uno::XInterface
>::get()) {
144 css::uno::Reference
< css::uno::XInterface
> ref(
145 static_cast< css::uno::XInterface
* >(
146 static_cast< Interface2a
* >(this)));
147 return css::uno::Any(&ref
, type
);
149 if (type
== cppu::UnoType
<Interface2
>::get()) {
150 css::uno::Reference
< Interface2
> ref(this);
151 return css::uno::Any(&ref
, type
);
153 if (type
== cppu::UnoType
<Interface2a
>::get()) {
154 css::uno::Reference
< Interface2a
> ref(this);
155 return css::uno::Any(&ref
, type
);
157 if (type
== cppu::UnoType
<Interface2b
>::get()) {
158 css::uno::Reference
< Interface2b
> ref(this);
159 return css::uno::Any(&ref
, type
);
161 return css::uno::Any();
164 virtual void SAL_CALL
acquire() noexcept override
{
168 virtual void SAL_CALL
release() noexcept override
{
173 class Test
: public CppUnit::TestFixture
{
179 void testUnsignedShort();
181 void testUnsignedLong();
183 void testUnsignedHyper();
193 void testException();
194 void testInterface();
197 CPPUNIT_TEST_SUITE(Test
);
198 CPPUNIT_TEST(testVoid
);
199 CPPUNIT_TEST(testBoolean
);
200 CPPUNIT_TEST(testByte
);
201 CPPUNIT_TEST(testShort
);
202 CPPUNIT_TEST(testUnsignedShort
);
203 CPPUNIT_TEST(testLong
);
204 CPPUNIT_TEST(testUnsignedLong
);
205 CPPUNIT_TEST(testHyper
);
206 CPPUNIT_TEST(testUnsignedHyper
);
207 CPPUNIT_TEST(testFloat
);
208 CPPUNIT_TEST(testDouble
);
209 CPPUNIT_TEST(testChar
);
210 CPPUNIT_TEST(testString
);
211 CPPUNIT_TEST(testType
);
212 CPPUNIT_TEST(testSequence
);
213 CPPUNIT_TEST(testEnum
);
214 CPPUNIT_TEST(testStruct
);
215 CPPUNIT_TEST(testPoly
);
216 CPPUNIT_TEST(testException
);
217 CPPUNIT_TEST(testInterface
);
218 CPPUNIT_TEST(testNull
);
219 CPPUNIT_TEST_SUITE_END();
222 void Test::testVoid() {
224 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<void>::get()));
227 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
228 CPPUNIT_ASSERT_MESSAGE("bool", b
);
231 // [-loplugin:fakebool] false positive:
233 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
234 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
238 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
239 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
243 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
244 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
248 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
249 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
253 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
254 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
258 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
259 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
263 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
264 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
268 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
269 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
273 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
274 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", 2.0f
, b
);
278 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
279 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
283 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
284 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
288 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
289 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
292 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
293 CPPUNIT_ASSERT_MESSAGE(
296 CPPUNIT_ASSERT_EQUAL_MESSAGE(
298 cppu::UnoType
<OUString
>::get(), b
);
301 css::uno::Sequence
< OUString
> b(2);
302 CPPUNIT_ASSERT_MESSAGE(
303 "css::uno::Sequence<OUString>", !(a
>>= b
));
304 CPPUNIT_ASSERT_EQUAL_MESSAGE(
305 "css::uno::Sequence<OUString>", sal_Int32(2), b
.getLength());
309 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
310 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
314 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
315 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
319 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
320 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
321 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
324 css::uno::Reference
< Interface1
> i(new Impl1
);
325 css::uno::Reference
< Interface1
> b(i
);
326 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
327 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
331 void Test::testBoolean() {
332 css::uno::Any
a(false);
333 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<bool>::get()));
336 CPPUNIT_ASSERT_MESSAGE("bool", (a
>>= b
));
337 CPPUNIT_ASSERT_MESSAGE("bool", !b
);
340 // [-loplugin:fakebool] false positive:
342 CPPUNIT_ASSERT_MESSAGE("sal_Bool", (a
>>= b
));
343 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !b
);
347 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
348 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
352 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
353 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
357 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
358 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
362 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
363 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
367 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
368 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
372 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
373 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
377 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
378 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
382 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
383 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", 2.0f
, b
);
387 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
388 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
392 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
393 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
397 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
398 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
401 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
402 CPPUNIT_ASSERT_MESSAGE(
405 CPPUNIT_ASSERT_EQUAL_MESSAGE(
407 cppu::UnoType
<OUString
>::get(), b
);
410 css::uno::Sequence
< OUString
> b(2);
411 CPPUNIT_ASSERT_MESSAGE(
412 "css::uno::Sequence<OUString>",
414 CPPUNIT_ASSERT_EQUAL_MESSAGE(
415 "css::uno::Sequence<OUString>",
416 sal_Int32(2), b
.getLength());
420 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
421 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
425 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
426 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
430 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
431 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
432 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
435 css::uno::Reference
< Interface1
> i(new Impl1
);
436 css::uno::Reference
< Interface1
> b(i
);
437 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
438 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
442 void Test::testByte() {
443 css::uno::Any
a(static_cast< sal_Int8
>(1));
444 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_Int8
>::get()));
447 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
448 CPPUNIT_ASSERT_MESSAGE("bool", b
);
451 // [-loplugin:fakebool] false positive:
453 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
454 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
458 CPPUNIT_ASSERT_MESSAGE("sal_Int8", (a
>>= b
));
459 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(1), b
);
463 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a
>>= b
));
464 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(1), b
);
468 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a
>>= b
));
469 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(1), b
);
473 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a
>>= b
));
474 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b
);
478 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a
>>= b
));
479 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b
);
483 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
));
484 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b
);
488 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
));
489 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b
);
493 CPPUNIT_ASSERT_MESSAGE("float", (a
>>= b
));
494 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b
);
498 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
));
499 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b
);
503 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
504 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
508 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
509 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
512 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
513 CPPUNIT_ASSERT_MESSAGE(
516 CPPUNIT_ASSERT_EQUAL_MESSAGE(
518 cppu::UnoType
<OUString
>::get(), b
);
521 css::uno::Sequence
< OUString
> b(2);
522 CPPUNIT_ASSERT_MESSAGE(
523 "css::uno::Sequence<OUString>",
525 CPPUNIT_ASSERT_EQUAL_MESSAGE(
526 "css::uno::Sequence<OUString>",
527 sal_Int32(2), b
.getLength());
531 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
532 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
536 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
537 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
541 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
542 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
543 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
546 css::uno::Reference
< Interface1
> i(new Impl1
);
547 css::uno::Reference
< Interface1
> b(i
);
548 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
549 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
553 void Test::testShort() {
554 css::uno::Any
a(static_cast< sal_Int16
>(1));
555 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_Int16
>::get()));
558 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
559 CPPUNIT_ASSERT_MESSAGE("bool", b
);
562 // [-loplugin:fakebool] false positive:
564 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
565 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
569 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
570 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
574 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a
>>= b
));
575 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(1), b
);
579 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a
>>= b
));
580 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(1), b
);
584 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a
>>= b
));
585 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b
);
589 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a
>>= b
));
590 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b
);
594 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
));
595 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b
);
599 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
));
600 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b
);
604 CPPUNIT_ASSERT_MESSAGE("float", (a
>>= b
));
605 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b
);
609 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
));
610 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b
);
614 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
615 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
619 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
620 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
623 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
624 CPPUNIT_ASSERT_MESSAGE(
627 CPPUNIT_ASSERT_EQUAL_MESSAGE(
629 cppu::UnoType
<OUString
>::get(), b
);
632 css::uno::Sequence
< OUString
> b(2);
633 CPPUNIT_ASSERT_MESSAGE(
634 "css::uno::Sequence<OUString>",
636 CPPUNIT_ASSERT_EQUAL_MESSAGE(
637 "css::uno::Sequence<OUString>",
638 sal_Int32(2), b
.getLength());
642 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
643 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
647 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
648 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
652 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
653 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
654 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
657 css::uno::Reference
< Interface1
> i(new Impl1
);
658 css::uno::Reference
< Interface1
> b(i
);
659 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
660 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
664 void Test::testUnsignedShort() {
666 css::uno::Any
a(&n
, cppu::UnoType
<cppu::UnoUnsignedShortType
>::get());
668 bool(a
.getValueType() == cppu::UnoType
<cppu::UnoUnsignedShortType
>::get()));
671 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
672 CPPUNIT_ASSERT_MESSAGE("bool", b
);
675 // [-loplugin:fakebool] false positive:
677 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
678 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
682 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
683 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
687 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a
>>= b
));
688 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(1), b
);
692 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a
>>= b
));
693 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(1), b
);
697 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a
>>= b
));
698 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b
);
702 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a
>>= b
));
703 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b
);
707 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
));
708 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b
);
712 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
));
713 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b
);
717 CPPUNIT_ASSERT_MESSAGE("float", (a
>>= b
));
718 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b
);
722 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
));
723 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b
);
727 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
728 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
732 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
733 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
736 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
737 CPPUNIT_ASSERT_MESSAGE(
740 CPPUNIT_ASSERT_EQUAL_MESSAGE(
742 cppu::UnoType
<OUString
>::get(), b
);
745 css::uno::Sequence
< OUString
> b(2);
746 CPPUNIT_ASSERT_MESSAGE(
747 "css::uno::Sequence<OUString>",
749 CPPUNIT_ASSERT_EQUAL_MESSAGE(
750 "css::uno::Sequence<OUString>",
751 sal_Int32(2), b
.getLength());
755 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
756 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
760 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
761 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
765 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
766 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
767 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
770 css::uno::Reference
< Interface1
> i(new Impl1
);
771 css::uno::Reference
< Interface1
> b(i
);
772 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
773 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
777 void Test::testLong() {
778 css::uno::Any
a(static_cast< sal_Int32
>(1));
779 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_Int32
>::get()));
782 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
783 CPPUNIT_ASSERT_MESSAGE("bool", b
);
786 // [-loplugin:fakebool] false positive:
788 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
789 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
793 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
794 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
798 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
799 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
803 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
804 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
808 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a
>>= b
));
809 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b
);
813 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a
>>= b
));
814 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b
);
818 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
));
819 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b
);
823 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
));
824 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b
);
828 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
829 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
833 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
));
834 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b
);
838 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
839 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
843 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
844 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
847 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
848 CPPUNIT_ASSERT_MESSAGE(
851 CPPUNIT_ASSERT_EQUAL_MESSAGE(
853 cppu::UnoType
<OUString
>::get(), b
);
856 css::uno::Sequence
< OUString
> b(2);
857 CPPUNIT_ASSERT_MESSAGE(
858 "css::uno::Sequence<OUString>",
860 CPPUNIT_ASSERT_EQUAL_MESSAGE(
861 "css::uno::Sequence<OUString>",
862 sal_Int32(2), b
.getLength());
866 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
867 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
871 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
872 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
876 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
877 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
878 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
881 css::uno::Reference
< Interface1
> i(new Impl1
);
882 css::uno::Reference
< Interface1
> b(i
);
883 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
884 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
888 void Test::testUnsignedLong() {
889 css::uno::Any
a(static_cast< sal_uInt32
>(1));
890 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_uInt32
>::get()));
893 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
894 CPPUNIT_ASSERT_MESSAGE("bool", b
);
897 // [-loplugin:fakebool] false positive:
899 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
900 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
904 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
905 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
909 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
910 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
914 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
915 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
919 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a
>>= b
));
920 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b
);
924 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a
>>= b
));
925 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b
);
929 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
));
930 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b
);
934 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
));
935 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b
);
939 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
940 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
944 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
));
945 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b
);
949 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
950 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
954 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
955 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
958 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
959 CPPUNIT_ASSERT_MESSAGE(
962 CPPUNIT_ASSERT_EQUAL_MESSAGE(
964 cppu::UnoType
<OUString
>::get(), b
);
967 css::uno::Sequence
< OUString
> b(2);
968 CPPUNIT_ASSERT_MESSAGE(
969 "css::uno::Sequence<OUString>",
971 CPPUNIT_ASSERT_EQUAL_MESSAGE(
972 "css::uno::Sequence<OUString>",
973 sal_Int32(2), b
.getLength());
977 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
978 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
982 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
983 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
987 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
988 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
989 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
992 css::uno::Reference
< Interface1
> i(new Impl1
);
993 css::uno::Reference
< Interface1
> b(i
);
994 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
995 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
999 void Test::testHyper() {
1000 css::uno::Any
a(static_cast< sal_Int64
>(1));
1001 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_Int64
>::get()));
1004 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
1005 CPPUNIT_ASSERT_MESSAGE("bool", b
);
1008 // [-loplugin:fakebool] false positive:
1010 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
1011 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
1015 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
1016 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
1020 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
1021 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
1025 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
1026 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
1030 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
1031 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
1035 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
1036 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
1040 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
));
1041 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b
);
1045 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
));
1046 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b
);
1050 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
1051 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
1055 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
1056 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
1059 sal_Unicode b
= '2';
1060 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
1061 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
1065 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
1066 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
1069 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1070 CPPUNIT_ASSERT_MESSAGE(
1073 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1075 cppu::UnoType
<OUString
>::get(), b
);
1078 css::uno::Sequence
< OUString
> b(2);
1079 CPPUNIT_ASSERT_MESSAGE(
1080 "css::uno::Sequence<OUString>",
1082 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1083 "css::uno::Sequence<OUString>",
1084 sal_Int32(2), b
.getLength());
1088 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
1089 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
1093 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
1094 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
1098 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1099 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
1100 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
1103 css::uno::Reference
< Interface1
> i(new Impl1
);
1104 css::uno::Reference
< Interface1
> b(i
);
1105 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
1106 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
1110 void Test::testUnsignedHyper() {
1111 css::uno::Any
a(static_cast< sal_uInt64
>(1));
1112 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_uInt64
>::get()));
1115 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
1116 CPPUNIT_ASSERT_MESSAGE("bool", b
);
1119 // [-loplugin:fakebool] false positive:
1121 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
1122 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
1126 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
1127 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
1131 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
1132 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
1136 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
1137 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
1141 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
1142 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
1146 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
1147 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
1151 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
));
1152 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b
);
1156 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
));
1157 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b
);
1161 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
1162 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
1166 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
1167 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
1170 sal_Unicode b
= '2';
1171 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
1172 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
1176 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
1177 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
1180 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1181 CPPUNIT_ASSERT_MESSAGE(
1184 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1186 cppu::UnoType
<OUString
>::get(), b
);
1189 css::uno::Sequence
< OUString
> b(2);
1190 CPPUNIT_ASSERT_MESSAGE(
1191 "css::uno::Sequence<OUString>",
1193 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1194 "css::uno::Sequence<OUString>",
1195 sal_Int32(2), b
.getLength());
1199 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
1200 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
1204 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
1205 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
1209 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1210 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
1211 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
1214 css::uno::Reference
< Interface1
> i(new Impl1
);
1215 css::uno::Reference
< Interface1
> b(i
);
1216 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
1217 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
1221 void Test::testFloat() {
1222 css::uno::Any
a(1.f
);
1223 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<float>::get()));
1226 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
1227 CPPUNIT_ASSERT_MESSAGE("bool", b
);
1230 // [-loplugin:fakebool] false positive:
1232 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
1233 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
1237 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
1238 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
1242 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
1243 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
1247 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
1248 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
1252 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
1253 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
1257 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
1258 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
1262 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
1263 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
1267 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
1268 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
1272 CPPUNIT_ASSERT_MESSAGE("float", (a
>>= b
));
1273 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b
);
1277 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
));
1278 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b
);
1281 sal_Unicode b
= '2';
1282 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
1283 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
1287 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
1288 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
1291 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1292 CPPUNIT_ASSERT_MESSAGE(
1295 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1297 cppu::UnoType
<OUString
>::get(), b
);
1300 css::uno::Sequence
< OUString
> b(2);
1301 CPPUNIT_ASSERT_MESSAGE(
1302 "css::uno::Sequence<OUString>",
1304 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1305 "css::uno::Sequence<OUString>",
1306 sal_Int32(2), b
.getLength());
1310 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
1311 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
1315 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
1316 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
1320 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1321 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
1322 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
1325 css::uno::Reference
< Interface1
> i(new Impl1
);
1326 css::uno::Reference
< Interface1
> b(i
);
1327 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
1328 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
1332 void Test::testDouble() {
1333 css::uno::Any
a(1.);
1334 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<double>::get()));
1337 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
1338 CPPUNIT_ASSERT_MESSAGE("bool", b
);
1341 // [-loplugin:fakebool] false positive:
1343 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
1344 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
1348 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
1349 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
1353 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
1354 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
1358 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
1359 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
1363 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
1364 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
1368 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
1369 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
1373 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
1374 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
1378 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
1379 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
1383 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
1384 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
1388 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
));
1389 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b
);
1392 sal_Unicode b
= '2';
1393 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
1394 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
1398 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
1399 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
1402 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1403 CPPUNIT_ASSERT_MESSAGE(
1406 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1408 cppu::UnoType
<OUString
>::get(), b
);
1411 css::uno::Sequence
< OUString
> b(2);
1412 CPPUNIT_ASSERT_MESSAGE(
1413 "css::uno::Sequence<OUString>",
1415 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1416 "css::uno::Sequence<OUString>",
1417 sal_Int32(2), b
.getLength());
1421 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
1422 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
1426 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
1427 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
1431 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1432 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
1433 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
1436 css::uno::Reference
< Interface1
> i(new Impl1
);
1437 css::uno::Reference
< Interface1
> b(i
);
1438 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
1439 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
1443 void Test::testChar() {
1444 sal_Unicode c
= '1';
1445 css::uno::Any
a(&c
, cppu::UnoType
<cppu::UnoCharType
>::get());
1446 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<cppu::UnoCharType
>::get()));
1449 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
1450 CPPUNIT_ASSERT_MESSAGE("bool", b
);
1453 // [-loplugin:fakebool] false positive:
1455 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
1456 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
1460 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
1461 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
1465 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
1466 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
1470 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
1471 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
1475 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
1476 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
1480 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
1481 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
1485 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
1486 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
1490 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
1491 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
1495 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
1496 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
1500 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
1501 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
1504 sal_Unicode b
= '2';
1505 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", (a
>>= b
));
1506 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'1', b
);
1510 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
1511 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
1514 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1515 CPPUNIT_ASSERT_MESSAGE(
1518 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1520 cppu::UnoType
<OUString
>::get(), b
);
1523 css::uno::Sequence
< OUString
> b(2);
1524 CPPUNIT_ASSERT_MESSAGE(
1525 "css::uno::Sequence<OUString>",
1527 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1528 "css::uno::Sequence<OUString>",
1529 sal_Int32(2), b
.getLength());
1533 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
1534 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
1538 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
1539 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
1543 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1544 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
1545 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
1548 css::uno::Reference
< Interface1
> i(new Impl1
);
1549 css::uno::Reference
< Interface1
> b(i
);
1550 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
1551 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
1555 void Test::testString() {
1556 css::uno::Any
a(OUString("1"));
1557 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<OUString
>::get()));
1560 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
1561 CPPUNIT_ASSERT_MESSAGE("bool", b
);
1564 // [-loplugin:fakebool] false positive:
1566 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
1567 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
1571 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
1572 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
1576 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
1577 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
1581 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
1582 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
1586 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
1587 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
1591 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
1592 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
1596 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
1597 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
1601 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
1602 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
1606 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
1607 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
1611 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
1612 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
1615 sal_Unicode b
= '2';
1616 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
1617 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
1621 CPPUNIT_ASSERT_MESSAGE( "OUString", (a
>>= b
) );
1622 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("1"), b
);
1625 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1626 CPPUNIT_ASSERT_MESSAGE(
1629 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1631 cppu::UnoType
<OUString
>::get(), b
);
1634 css::uno::Sequence
< OUString
> b(2);
1635 CPPUNIT_ASSERT_MESSAGE(
1636 "css::uno::Sequence<OUString>",
1638 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1639 "css::uno::Sequence<OUString>",
1640 sal_Int32(2), b
.getLength());
1644 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
1645 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
1649 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
1650 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
1654 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1655 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
1656 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
1659 css::uno::Reference
< Interface1
> i(new Impl1
);
1660 css::uno::Reference
< Interface1
> b(i
);
1661 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
1662 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
1666 void Test::testType() {
1667 css::uno::Any
a(cppu::UnoType
<sal_Int32
>::get());
1668 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<css::uno::Type
>::get()));
1671 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
1672 CPPUNIT_ASSERT_MESSAGE("bool", b
);
1675 // [-loplugin:fakebool] false positive:
1677 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
1678 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
1682 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
1683 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
1687 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
1688 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
1692 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
1693 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
1697 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
1698 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
1702 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
1703 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
1707 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
1708 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
1712 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
1713 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
1717 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
1718 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
1722 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
1723 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
1726 sal_Unicode b
= '2';
1727 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
1728 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
1732 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
1733 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
1736 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1737 CPPUNIT_ASSERT_MESSAGE(
1738 "css::uno::Type", (a
>>= b
));
1739 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1740 "css::uno::Type", cppu::UnoType
<sal_Int32
>::get(), b
);
1743 css::uno::Sequence
< OUString
> b(2);
1744 CPPUNIT_ASSERT_MESSAGE(
1745 "css::uno::Sequence<OUString>",
1747 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1748 "css::uno::Sequence<OUString>",
1749 sal_Int32(2), b
.getLength());
1753 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
1754 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
1758 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
1759 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
1763 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1764 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
1765 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
1768 css::uno::Reference
< Interface1
> i(new Impl1
);
1769 css::uno::Reference
< Interface1
> b(i
);
1770 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
1771 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
1775 void Test::testSequence() {
1777 css::uno::Any
a(css::uno::Sequence
< sal_Int32
>(&n
, 1));
1779 bool(a
.getValueType()
1780 == cppu::UnoType
<css::uno::Sequence
<sal_Int32
>>::get()));
1783 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
1784 CPPUNIT_ASSERT_MESSAGE("bool", b
);
1787 // [-loplugin:fakebool] false positive:
1789 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
1790 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
1794 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
1795 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
1799 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
1800 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
1804 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
1805 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
1809 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
1810 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
1814 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
1815 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
1819 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
1820 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
1824 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
1825 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
1829 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
1830 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
1834 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
1835 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
1838 sal_Unicode b
= '2';
1839 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
1840 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
1844 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
1845 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
1848 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1849 CPPUNIT_ASSERT_MESSAGE(
1852 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1854 cppu::UnoType
<OUString
>::get(), b
);
1857 css::uno::Sequence
< OUString
> b(2);
1858 CPPUNIT_ASSERT_MESSAGE(
1859 "css::uno::Sequence<OUString>",
1861 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1862 "css::uno::Sequence<OUString>",
1863 sal_Int32(2), b
.getLength());
1866 css::uno::Sequence
< sal_Int32
> b(2);
1867 CPPUNIT_ASSERT_MESSAGE(
1868 "css::uno::Sequence<sal_Int32>",
1870 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1871 "css::uno::Sequence<sal_Int32>",
1872 sal_Int32(1), b
.getLength());
1873 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1874 "css::uno::Sequence<sal_Int32>",
1875 sal_Int32(1), b
[0]);
1879 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
1880 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
1884 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
1885 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
1889 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1890 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
1891 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
1894 css::uno::Reference
< Interface1
> i(new Impl1
);
1895 css::uno::Reference
< Interface1
> b(i
);
1896 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
1897 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
1900 // The two default-constructed sequences both refer to the same static cppu::g_emptySeq
1901 css::uno::Sequence
<sal_Int32
> aEmptyIntSequence
;
1902 css::uno::Sequence
<OUString
> aEmptyStringSequence
;
1903 a
<<= aEmptyStringSequence
;
1904 CPPUNIT_ASSERT(!(a
>>= aEmptyIntSequence
));
1908 void Test::testEnum() {
1909 css::uno::Any
a(Enum2_M1
);
1910 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<Enum2
>::get()));
1913 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
1914 CPPUNIT_ASSERT_MESSAGE("bool", b
);
1917 // [-loplugin:fakebool] false positive:
1919 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
1920 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
1924 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
1925 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
1929 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
1930 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
1934 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
1935 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
1939 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
1940 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
1944 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
1945 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
1949 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
1950 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
1954 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
1955 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
1959 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
1960 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
1964 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
1965 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
1968 sal_Unicode b
= '2';
1969 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
1970 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
1974 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
1975 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
1978 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1979 CPPUNIT_ASSERT_MESSAGE(
1982 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1984 cppu::UnoType
<OUString
>::get(), b
);
1987 css::uno::Sequence
< OUString
> b(2);
1988 CPPUNIT_ASSERT_MESSAGE(
1989 "css::uno::Sequence<OUString>",
1991 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1992 "css::uno::Sequence<OUString>",
1993 sal_Int32(2), b
.getLength());
1997 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
1998 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
2002 CPPUNIT_ASSERT_MESSAGE("Enum2", (a
>>= b
));
2003 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum2", Enum2_M1
, b
);
2007 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
2008 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
2012 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
2013 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
2014 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
2017 css::uno::Reference
< Interface1
> i(new Impl1
);
2018 css::uno::Reference
< Interface1
> b(i
);
2019 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
2020 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
2024 void Test::testStruct() {
2025 css::uno::Any
a(Struct2a(1, 3));
2026 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<Struct2a
>::get()));
2029 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
2030 CPPUNIT_ASSERT_MESSAGE("bool", b
);
2033 // [-loplugin:fakebool] false positive:
2035 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
2036 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
2040 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
2041 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
2045 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
2046 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
2050 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
2051 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
2055 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
2056 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
2060 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
2061 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
2065 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
2066 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
2070 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
2071 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
2075 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
2076 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
2080 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
2081 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
2084 sal_Unicode b
= '2';
2085 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
2086 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
2090 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
2091 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
2094 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
2095 CPPUNIT_ASSERT_MESSAGE(
2098 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2100 cppu::UnoType
<OUString
>::get(), b
);
2103 css::uno::Sequence
< OUString
> b(2);
2104 CPPUNIT_ASSERT_MESSAGE(
2105 "css::uno::Sequence<OUString>",
2107 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2108 "css::uno::Sequence<OUString>",
2109 sal_Int32(2), b
.getLength());
2113 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
2114 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
2118 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
2119 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
2123 CPPUNIT_ASSERT_MESSAGE("Struct2", (a
>>= b
));
2124 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct2", sal_Int32(1), b
.member
);
2128 CPPUNIT_ASSERT_MESSAGE(
2129 "Struct2a", (a
>>= b
));
2130 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2131 "Struct2a", sal_Int32(1), b
.member
);
2132 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2133 "Struct2a", sal_Int32(3), b
.member2
);
2136 Struct2b
b(2, 2, 2);
2137 CPPUNIT_ASSERT_MESSAGE("Struct2b", !(a
>>= b
));
2138 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct2b", sal_Int32(2), b
.member
);
2142 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
2143 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
2144 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
2147 css::uno::Reference
< Interface1
> i(new Impl1
);
2148 css::uno::Reference
< Interface1
> b(i
);
2149 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
2150 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
2154 void Test::testPoly() {
2156 a
<<= Poly
< css::uno::Sequence
< ::sal_Unicode
> >();
2157 CPPUNIT_ASSERT_EQUAL_MESSAGE( "type name", OUString("Poly<[]char>"), a
.getValueType().getTypeName() );
2158 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2160 css::uno::Any(Poly
< css::uno::Sequence
< ::sal_Unicode
> >()), a
);
2163 void Test::testException() {
2166 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 1,
2168 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<Exception2a
>::get()));
2171 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
2172 CPPUNIT_ASSERT_MESSAGE("bool", b
);
2175 // [-loplugin:fakebool] false positive:
2177 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
2178 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
2182 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
2183 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
2187 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
2188 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
2192 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
2193 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
2197 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
2198 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
2202 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
2203 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
2207 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
2208 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
2212 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
2213 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
2217 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
2218 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
2222 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
2223 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
2226 sal_Unicode b
= '2';
2227 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
2228 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
2232 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
2233 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
2236 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
2237 CPPUNIT_ASSERT_MESSAGE(
2240 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2242 cppu::UnoType
<OUString
>::get(), b
);
2245 css::uno::Sequence
< OUString
> b(2);
2246 CPPUNIT_ASSERT_MESSAGE(
2247 "css::uno::Sequence<OUString>",
2249 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2250 "css::uno::Sequence<OUString>",
2251 sal_Int32(2), b
.getLength());
2255 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
2256 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
2260 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
2261 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
2265 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
2266 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
2267 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
2271 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
2272 CPPUNIT_ASSERT_MESSAGE("Exception2", (a
>>= b
));
2273 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception2", sal_Int32(1), b
.member
);
2277 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2,
2279 CPPUNIT_ASSERT_MESSAGE(
2280 "Exception2a", (a
>>= b
));
2281 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2282 "Exception2a", sal_Int32(1), b
.member
);
2283 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2284 "Exception2a", sal_Int32(3), b
.member2
);
2288 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2,
2290 CPPUNIT_ASSERT_MESSAGE("Exception2b", !(a
>>= b
));
2291 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception2b", sal_Int32(2), b
.member
);
2294 css::uno::Reference
< Interface1
> i(new Impl1
);
2295 css::uno::Reference
< Interface1
> b(i
);
2296 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
2297 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
2301 void Test::testInterface() {
2302 css::uno::Reference
< Interface2a
> i2(new Impl2
);
2303 css::uno::Any
a(i2
);
2304 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<Interface2a
>::get()));
2307 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
2308 CPPUNIT_ASSERT_MESSAGE("bool", b
);
2311 // [-loplugin:fakebool] false positive:
2313 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
2314 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
2318 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
2319 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
2323 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
2324 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
2328 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
2329 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
2333 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
2334 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
2338 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
2339 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
2343 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
2344 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
2348 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
2349 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
2353 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
2354 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
2358 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
2359 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
2362 sal_Unicode b
= '2';
2363 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
2364 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
2368 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
2369 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
2372 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
2373 CPPUNIT_ASSERT_MESSAGE(
2376 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2378 cppu::UnoType
<OUString
>::get(), b
);
2381 css::uno::Sequence
< OUString
> b(2);
2382 CPPUNIT_ASSERT_MESSAGE(
2383 "css::uno::Sequence<OUString>",
2385 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2386 "css::uno::Sequence<OUString>",
2387 sal_Int32(2), b
.getLength());
2391 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
2392 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
2396 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
2397 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
2401 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
2402 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
2403 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
2406 css::uno::Reference
< Interface1
> i(new Impl1
);
2407 css::uno::Reference
< Interface1
> b(i
);
2408 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
2409 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
2412 css::uno::Reference
< Interface2
> b(new Impl2
);
2413 CPPUNIT_ASSERT_MESSAGE("Interface2", (a
>>= b
));
2414 CPPUNIT_ASSERT_MESSAGE("Interface2", b
.operator ==(i2
));
2417 css::uno::Reference
< Interface2a
> b(new Impl2
);
2418 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a
>>= b
));
2419 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface2a", i2
, b
);
2422 css::uno::Reference
< Interface2b
> i(new Impl2b
);
2423 css::uno::Reference
< Interface2b
> b(i
);
2424 CPPUNIT_ASSERT_MESSAGE("Interface2b", !(a
>>= b
));
2425 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface2b", i
, b
);
2428 css::uno::Reference
< Interface3
> b(new Impl2
);
2429 CPPUNIT_ASSERT_MESSAGE("Interface3", (a
>>= b
));
2430 CPPUNIT_ASSERT_MESSAGE("Interface3", b
.operator ==(i2
));
2434 void Test::testNull() {
2435 css::uno::Any a
{ css::uno::Reference
< Interface2a
>() };
2436 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<Interface2a
>::get()));
2439 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
2440 CPPUNIT_ASSERT_MESSAGE("bool", b
);
2443 // [-loplugin:fakebool] false positive:
2445 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
2446 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
2450 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
2451 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
2455 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
2456 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
2460 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
2461 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
2465 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
2466 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
2470 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
2471 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
2475 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
2476 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
2480 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
2481 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
2485 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
2486 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b
);
2490 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
2491 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
2494 sal_Unicode b
= '2';
2495 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
2496 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
2500 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
2501 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
2504 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
2505 CPPUNIT_ASSERT_MESSAGE(
2508 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2510 cppu::UnoType
<OUString
>::get(), b
);
2513 css::uno::Sequence
< OUString
> b(2);
2514 CPPUNIT_ASSERT_MESSAGE(
2515 "css::uno::Sequence<OUString>",
2517 CPPUNIT_ASSERT_EQUAL_MESSAGE(
2518 "css::uno::Sequence<OUString>",
2519 sal_Int32(2), b
.getLength());
2523 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
2524 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
2528 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
2529 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
2533 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
2534 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
2535 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
2538 css::uno::Reference
< Interface1
> b(new Impl1
);
2539 CPPUNIT_ASSERT_MESSAGE(
2540 "Interface1", (a
>>= b
));
2541 CPPUNIT_ASSERT_MESSAGE(
2542 "Interface1", !b
.is());
2545 css::uno::Reference
< Interface2
> b(new Impl2
);
2546 CPPUNIT_ASSERT_MESSAGE(
2547 "Interface2", (a
>>= b
));
2548 CPPUNIT_ASSERT_MESSAGE(
2549 "Interface2", !b
.is());
2552 css::uno::Reference
< Interface2a
> b(new Impl2
);
2553 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a
>>= b
));
2554 CPPUNIT_ASSERT_MESSAGE("Interface2a", !b
.is());
2557 css::uno::Reference
< Interface2b
> b(new Impl2b
);
2558 CPPUNIT_ASSERT_MESSAGE(
2559 "Interface2b", (a
>>= b
));
2560 CPPUNIT_ASSERT_MESSAGE(
2561 "Interface2b", !b
.is());
2564 css::uno::Reference
< Interface3
> b(new Impl2
);
2565 CPPUNIT_ASSERT_MESSAGE(
2566 "Interface3", (a
>>= b
));
2567 CPPUNIT_ASSERT_MESSAGE(
2568 "Interface3", !b
.is());
2572 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
2576 CPPUNIT_PLUGIN_IMPLEMENT();
2578 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */