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>
23 #include <type_traits>
25 #include <cppunit/TestFixture.h>
26 #include <cppunit/plugin/TestPlugIn.h>
27 #include <cppunit/extensions/HelperMacros.h>
31 #include <Exception1.hpp>
32 #include <Exception2.hpp>
33 #include <Exception2a.hpp>
34 #include <Exception2b.hpp>
35 #include <Interface1.hpp>
36 #include <Interface2.hpp>
37 #include <Interface2a.hpp>
38 #include <Interface2b.hpp>
39 #include <Interface3.hpp>
41 #include <Struct1.hpp>
42 #include <Struct2.hpp>
43 #include <Struct2a.hpp>
44 #include <Struct2b.hpp>
45 #include <com/sun/star/uno/Any.hxx>
46 #include <com/sun/star/uno/Reference.hxx>
47 #include <com/sun/star/uno/Sequence.hxx>
48 #include <com/sun/star/uno/Type.hxx>
49 #include <o3tl/cppunittraitshelper.hxx>
50 #include <osl/interlck.h>
51 #include <rtl/ustring.hxx>
59 Base(const Base
&) = delete;
60 const Base
& operator=(const Base
&) = delete;
63 if (osl_atomic_increment(&m_count
) == SAL_MAX_INT32
) {
69 if (osl_atomic_decrement(&m_count
) == 0) {
78 oslInterlockedCount m_count
;
81 class Impl1
: public Interface1
, private Base
{
83 virtual css::uno::Any SAL_CALL
queryInterface(css::uno::Type
const & type
) override
85 if (type
== cppu::UnoType
<css::uno::XInterface
>::get()) {
86 css::uno::Reference
< css::uno::XInterface
> ref(
87 static_cast< css::uno::XInterface
* >(this));
88 return css::uno::Any(&ref
, type
);
90 if (type
== cppu::UnoType
<Interface1
>::get()) {
91 css::uno::Reference
< Interface1
> ref(this);
92 return css::uno::Any(&ref
, type
);
94 return css::uno::Any();
97 virtual void SAL_CALL
acquire() throw () override
{
101 virtual void SAL_CALL
release() throw () override
{
106 class Impl2
: public Interface2a
, public Interface3
, private Base
{
108 virtual css::uno::Any SAL_CALL
queryInterface(css::uno::Type
const & type
) override
110 if (type
== cppu::UnoType
<css::uno::XInterface
>::get()) {
111 css::uno::Reference
< css::uno::XInterface
> ref(
112 static_cast< css::uno::XInterface
* >(
113 static_cast< Interface2a
* >(this)));
114 return css::uno::Any(&ref
, type
);
116 if (type
== cppu::UnoType
<Interface2
>::get()) {
117 css::uno::Reference
< Interface2
> ref(this);
118 return css::uno::Any(&ref
, type
);
120 if (type
== cppu::UnoType
<Interface2a
>::get()) {
121 css::uno::Reference
< Interface2a
> ref(this);
122 return css::uno::Any(&ref
, type
);
124 if (type
== cppu::UnoType
<Interface3
>::get()) {
125 css::uno::Reference
< Interface3
> ref(this);
126 return css::uno::Any(&ref
, type
);
128 return css::uno::Any();
131 virtual void SAL_CALL
acquire() throw () override
{
135 virtual void SAL_CALL
release() throw () override
{
140 class Impl2b
: public Interface2b
, private Base
{
142 virtual css::uno::Any SAL_CALL
queryInterface(css::uno::Type
const & type
) override
144 if (type
== cppu::UnoType
<css::uno::XInterface
>::get()) {
145 css::uno::Reference
< css::uno::XInterface
> ref(
146 static_cast< css::uno::XInterface
* >(
147 static_cast< Interface2a
* >(this)));
148 return css::uno::Any(&ref
, type
);
150 if (type
== cppu::UnoType
<Interface2
>::get()) {
151 css::uno::Reference
< Interface2
> ref(this);
152 return css::uno::Any(&ref
, type
);
154 if (type
== cppu::UnoType
<Interface2a
>::get()) {
155 css::uno::Reference
< Interface2a
> ref(this);
156 return css::uno::Any(&ref
, type
);
158 if (type
== cppu::UnoType
<Interface2b
>::get()) {
159 css::uno::Reference
< Interface2b
> ref(this);
160 return css::uno::Any(&ref
, type
);
162 return css::uno::Any();
165 virtual void SAL_CALL
acquire() throw () override
{
169 virtual void SAL_CALL
release() throw () override
{
174 class Test
: public CppUnit::TestFixture
{
180 void testUnsignedShort();
182 void testUnsignedLong();
184 void testUnsignedHyper();
194 void testException();
195 void testInterface();
198 CPPUNIT_TEST_SUITE(Test
);
199 CPPUNIT_TEST(testVoid
);
200 CPPUNIT_TEST(testBoolean
);
201 CPPUNIT_TEST(testByte
);
202 CPPUNIT_TEST(testShort
);
203 CPPUNIT_TEST(testUnsignedShort
);
204 CPPUNIT_TEST(testLong
);
205 CPPUNIT_TEST(testUnsignedLong
);
206 CPPUNIT_TEST(testHyper
);
207 CPPUNIT_TEST(testUnsignedHyper
);
208 CPPUNIT_TEST(testFloat
);
209 CPPUNIT_TEST(testDouble
);
210 CPPUNIT_TEST(testChar
);
211 CPPUNIT_TEST(testString
);
212 CPPUNIT_TEST(testType
);
213 CPPUNIT_TEST(testSequence
);
214 CPPUNIT_TEST(testEnum
);
215 CPPUNIT_TEST(testStruct
);
216 CPPUNIT_TEST(testPoly
);
217 CPPUNIT_TEST(testException
);
218 CPPUNIT_TEST(testInterface
);
219 CPPUNIT_TEST(testNull
);
220 CPPUNIT_TEST_SUITE_END();
223 void Test::testVoid() {
225 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<void>::get()));
228 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
229 CPPUNIT_ASSERT_MESSAGE("bool", b
);
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
);
341 CPPUNIT_ASSERT_MESSAGE("sal_Bool", (a
>>= b
));
342 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !b
);
346 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
));
347 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b
);
351 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
));
352 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b
);
356 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
));
357 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b
);
361 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
));
362 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b
);
366 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
));
367 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b
);
371 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
));
372 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b
);
376 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
));
377 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b
);
381 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
));
382 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", 2.0f
, b
);
386 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
));
387 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b
);
391 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
));
392 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u
'2', b
);
396 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) );
397 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b
);
400 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
401 CPPUNIT_ASSERT_MESSAGE(
404 CPPUNIT_ASSERT_EQUAL_MESSAGE(
406 cppu::UnoType
<OUString
>::get(), b
);
409 css::uno::Sequence
< OUString
> b(2);
410 CPPUNIT_ASSERT_MESSAGE(
411 "css::uno::Sequence<OUString>",
413 CPPUNIT_ASSERT_EQUAL_MESSAGE(
414 "css::uno::Sequence<OUString>",
415 sal_Int32(2), b
.getLength());
419 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
));
420 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2
, b
);
424 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
));
425 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b
.member
);
429 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
430 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
));
431 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b
.member
);
434 css::uno::Reference
< Interface1
> i(new Impl1
);
435 css::uno::Reference
< Interface1
> b(i
);
436 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
));
437 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i
, b
);
441 void Test::testByte() {
442 css::uno::Any
a(static_cast< sal_Int8
>(1));
443 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_Int8
>::get()));
446 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
));
447 CPPUNIT_ASSERT_MESSAGE("bool", b
);
451 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
));
452 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b
);
456 CPPUNIT_ASSERT_MESSAGE("sal_Int8", (a
>>= b
));
457 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(1), b
);
461 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a
>>= b
) && b
== 1);
465 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a
>>= b
) && b
== 1);
469 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a
>>= b
) && b
== 1);
473 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a
>>= b
) && b
== 1);
477 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
) && b
== 1);
481 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
) && b
== 1);
485 CPPUNIT_ASSERT_MESSAGE("float", (a
>>= b
) && b
== 1);
489 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
) && b
== 1);
493 if (std::is_same
< sal_Unicode
, sal_uInt16
>::value
) {
494 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a
>>= b
) && b
== 1);
496 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
501 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
504 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
505 CPPUNIT_ASSERT_MESSAGE(
507 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
510 css::uno::Sequence
< OUString
> b(2);
511 CPPUNIT_ASSERT_MESSAGE(
512 "css::uno::Sequence<OUString>",
513 !(a
>>= b
) && b
.getLength() == 2);
517 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
521 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
525 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
526 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
529 css::uno::Reference
< Interface1
> i(new Impl1
);
530 css::uno::Reference
< Interface1
> b(i
);
531 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
535 void Test::testShort() {
536 css::uno::Any
a(static_cast< sal_Int16
>(1));
537 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_Int16
>::get()));
540 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
544 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
548 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
552 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a
>>= b
) && b
== 1);
556 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a
>>= b
) && b
== 1);
560 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a
>>= b
) && b
== 1);
564 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a
>>= b
) && b
== 1);
568 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
) && b
== 1);
572 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
) && b
== 1);
576 CPPUNIT_ASSERT_MESSAGE("float", (a
>>= b
) && b
== 1);
580 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
) && b
== 1);
584 if (std::is_same
< sal_Unicode
, sal_uInt16
>::value
) {
585 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a
>>= b
) && b
== 1);
587 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
592 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
595 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
596 CPPUNIT_ASSERT_MESSAGE(
598 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
601 css::uno::Sequence
< OUString
> b(2);
602 CPPUNIT_ASSERT_MESSAGE(
603 "css::uno::Sequence<OUString>",
604 !(a
>>= b
) && b
.getLength() == 2);
608 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
612 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
616 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
617 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
620 css::uno::Reference
< Interface1
> i(new Impl1
);
621 css::uno::Reference
< Interface1
> b(i
);
622 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
626 void Test::testUnsignedShort() {
628 css::uno::Any
a(&n
, cppu::UnoType
<cppu::UnoUnsignedShortType
>::get());
630 bool(a
.getValueType() == cppu::UnoType
<cppu::UnoUnsignedShortType
>::get()));
633 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
637 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
641 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
645 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a
>>= b
) && b
== 1);
649 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a
>>= b
) && b
== 1);
653 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a
>>= b
) && b
== 1);
657 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a
>>= b
) && b
== 1);
661 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
) && b
== 1);
665 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
) && b
== 1);
669 CPPUNIT_ASSERT_MESSAGE("float", (a
>>= b
) && b
== 1);
673 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
) && b
== 1);
677 if (std::is_same
< sal_Unicode
, sal_uInt16
>::value
) {
678 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a
>>= b
) && b
== 1);
680 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
685 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
688 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
689 CPPUNIT_ASSERT_MESSAGE(
691 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
694 css::uno::Sequence
< OUString
> b(2);
695 CPPUNIT_ASSERT_MESSAGE(
696 "css::uno::Sequence<OUString>",
697 !(a
>>= b
) && b
.getLength() == 2);
701 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
705 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
709 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
710 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
713 css::uno::Reference
< Interface1
> i(new Impl1
);
714 css::uno::Reference
< Interface1
> b(i
);
715 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
719 void Test::testLong() {
720 css::uno::Any
a(static_cast< sal_Int32
>(1));
721 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_Int32
>::get()));
724 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
728 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
732 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
736 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
740 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
744 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a
>>= b
) && b
== 1);
748 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a
>>= b
) && b
== 1);
752 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
) && b
== 1);
756 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
) && b
== 1);
760 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
764 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
) && b
== 1);
768 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
772 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
775 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
776 CPPUNIT_ASSERT_MESSAGE(
778 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
781 css::uno::Sequence
< OUString
> b(2);
782 CPPUNIT_ASSERT_MESSAGE(
783 "css::uno::Sequence<OUString>",
784 !(a
>>= b
) && b
.getLength() == 2);
788 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
792 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
796 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
797 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
800 css::uno::Reference
< Interface1
> i(new Impl1
);
801 css::uno::Reference
< Interface1
> b(i
);
802 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
806 void Test::testUnsignedLong() {
807 css::uno::Any
a(static_cast< sal_uInt32
>(1));
808 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_uInt32
>::get()));
811 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
815 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
819 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
823 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
827 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
831 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a
>>= b
) && b
== 1);
835 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a
>>= b
) && b
== 1);
839 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
) && b
== 1);
843 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
) && b
== 1);
847 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
851 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
) && b
== 1);
855 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
859 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
862 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
863 CPPUNIT_ASSERT_MESSAGE(
865 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
868 css::uno::Sequence
< OUString
> b(2);
869 CPPUNIT_ASSERT_MESSAGE(
870 "css::uno::Sequence<OUString>",
871 !(a
>>= b
) && b
.getLength() == 2);
875 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
879 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
883 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
884 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
887 css::uno::Reference
< Interface1
> i(new Impl1
);
888 css::uno::Reference
< Interface1
> b(i
);
889 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
893 void Test::testHyper() {
894 css::uno::Any
a(static_cast< sal_Int64
>(1));
895 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_Int64
>::get()));
898 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
902 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
906 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
910 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
914 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
918 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
922 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
926 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
) && b
== 1);
930 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
) && b
== 1);
934 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
938 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
) && b
== 2);
942 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
946 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
949 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
950 CPPUNIT_ASSERT_MESSAGE(
952 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
955 css::uno::Sequence
< OUString
> b(2);
956 CPPUNIT_ASSERT_MESSAGE(
957 "css::uno::Sequence<OUString>",
958 !(a
>>= b
) && b
.getLength() == 2);
962 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
966 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
970 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
971 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
974 css::uno::Reference
< Interface1
> i(new Impl1
);
975 css::uno::Reference
< Interface1
> b(i
);
976 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
980 void Test::testUnsignedHyper() {
981 css::uno::Any
a(static_cast< sal_uInt64
>(1));
982 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<sal_uInt64
>::get()));
985 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
989 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
993 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
997 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
1001 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
1005 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
1009 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
1013 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a
>>= b
) && b
== 1);
1017 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a
>>= b
) && b
== 1);
1021 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
1025 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
) && b
== 2);
1028 sal_Unicode b
= '2';
1029 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
1033 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
1036 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1037 CPPUNIT_ASSERT_MESSAGE(
1039 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
1042 css::uno::Sequence
< OUString
> b(2);
1043 CPPUNIT_ASSERT_MESSAGE(
1044 "css::uno::Sequence<OUString>",
1045 !(a
>>= b
) && b
.getLength() == 2);
1049 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
1053 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
1057 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1058 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
1061 css::uno::Reference
< Interface1
> i(new Impl1
);
1062 css::uno::Reference
< Interface1
> b(i
);
1063 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
1067 void Test::testFloat() {
1068 css::uno::Any
a(1.f
);
1069 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<float>::get()));
1072 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
1076 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
1080 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
1084 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
1088 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
1092 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
1096 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
1100 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
) && b
== 2);
1104 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
) && b
== 2);
1108 CPPUNIT_ASSERT_MESSAGE("float", (a
>>= b
) && b
== 1);
1112 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
) && b
== 1);
1115 sal_Unicode b
= '2';
1116 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
1120 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
1123 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1124 CPPUNIT_ASSERT_MESSAGE(
1126 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
1129 css::uno::Sequence
< OUString
> b(2);
1130 CPPUNIT_ASSERT_MESSAGE(
1131 "css::uno::Sequence<OUString>",
1132 !(a
>>= b
) && b
.getLength() == 2);
1136 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
1140 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
1144 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1145 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
1148 css::uno::Reference
< Interface1
> i(new Impl1
);
1149 css::uno::Reference
< Interface1
> b(i
);
1150 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
1154 void Test::testDouble() {
1155 css::uno::Any
a(1.);
1156 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<double>::get()));
1159 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
1163 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
1167 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
1171 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
1175 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
1179 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
1183 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
1187 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
) && b
== 2);
1191 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
) && b
== 2);
1195 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
1199 CPPUNIT_ASSERT_MESSAGE("double", (a
>>= b
) && b
== 1);
1202 sal_Unicode b
= '2';
1203 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
1207 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
1210 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1211 CPPUNIT_ASSERT_MESSAGE(
1213 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
1216 css::uno::Sequence
< OUString
> b(2);
1217 CPPUNIT_ASSERT_MESSAGE(
1218 "css::uno::Sequence<OUString>",
1219 !(a
>>= b
) && b
.getLength() == 2);
1223 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
1227 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
1231 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1232 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
1235 css::uno::Reference
< Interface1
> i(new Impl1
);
1236 css::uno::Reference
< Interface1
> b(i
);
1237 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
1241 void Test::testChar() {
1242 sal_Unicode c
= '1';
1243 css::uno::Any
a(&c
, cppu::UnoType
<cppu::UnoCharType
>::get());
1244 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<cppu::UnoCharType
>::get()));
1247 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
1251 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
1255 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
1259 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
1263 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
1267 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
1271 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
1275 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
) && b
== 2);
1279 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
) && b
== 2);
1283 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
1287 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
) && b
== 2);
1290 sal_Unicode b
= '2';
1291 if (std::is_same
< sal_Unicode
, sal_uInt16
>::value
) {
1292 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", !(a
>>= b
) && b
== '2');
1294 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", (a
>>= b
) && b
== '1');
1299 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
1302 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1303 CPPUNIT_ASSERT_MESSAGE(
1305 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
1308 css::uno::Sequence
< OUString
> b(2);
1309 CPPUNIT_ASSERT_MESSAGE(
1310 "css::uno::Sequence<OUString>",
1311 !(a
>>= b
) && b
.getLength() == 2);
1315 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
1319 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
1323 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1324 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
1327 css::uno::Reference
< Interface1
> i(new Impl1
);
1328 css::uno::Reference
< Interface1
> b(i
);
1329 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
1333 void Test::testString() {
1334 css::uno::Any
a(OUString("1"));
1335 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<OUString
>::get()));
1338 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
1342 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
1346 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
1350 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
1354 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
1358 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
1362 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
1366 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
) && b
== 2);
1370 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
) && b
== 2);
1374 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
1378 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
) && b
== 2);
1381 sal_Unicode b
= '2';
1382 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
1386 CPPUNIT_ASSERT_MESSAGE( "OUString", (a
>>= b
) && b
== "1" );
1389 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1390 CPPUNIT_ASSERT_MESSAGE(
1392 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
1395 css::uno::Sequence
< OUString
> b(2);
1396 CPPUNIT_ASSERT_MESSAGE(
1397 "css::uno::Sequence<OUString>",
1398 !(a
>>= b
) && b
.getLength() == 2);
1402 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
1406 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
1410 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1411 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
1414 css::uno::Reference
< Interface1
> i(new Impl1
);
1415 css::uno::Reference
< Interface1
> b(i
);
1416 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
1420 void Test::testType() {
1421 css::uno::Any
a(cppu::UnoType
<sal_Int32
>::get());
1422 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<css::uno::Type
>::get()));
1425 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
1429 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
1433 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
1437 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
1441 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
1445 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
1449 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
1453 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
) && b
== 2);
1457 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
) && b
== 2);
1461 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
1465 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
) && b
== 2);
1468 sal_Unicode b
= '2';
1469 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
1473 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
1476 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1477 CPPUNIT_ASSERT_MESSAGE(
1478 "css::uno::Type", (a
>>= b
) && b
== cppu::UnoType
<sal_Int32
>::get());
1481 css::uno::Sequence
< OUString
> b(2);
1482 CPPUNIT_ASSERT_MESSAGE(
1483 "css::uno::Sequence<OUString>",
1484 !(a
>>= b
) && b
.getLength() == 2);
1488 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
1492 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
1496 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1497 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
1500 css::uno::Reference
< Interface1
> i(new Impl1
);
1501 css::uno::Reference
< Interface1
> b(i
);
1502 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
1506 void Test::testSequence() {
1508 css::uno::Any
a(css::uno::Sequence
< sal_Int32
>(&n
, 1));
1510 bool(a
.getValueType()
1511 == cppu::UnoType
<css::uno::Sequence
<sal_Int32
>>::get()));
1514 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
1518 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
1522 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
1526 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
1530 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
1534 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
1538 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
1542 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
) && b
== 2);
1546 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
) && b
== 2);
1550 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
1554 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
) && b
== 2);
1557 sal_Unicode b
= '2';
1558 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
1562 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
1565 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1566 CPPUNIT_ASSERT_MESSAGE(
1568 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
1571 css::uno::Sequence
< OUString
> b(2);
1572 CPPUNIT_ASSERT_MESSAGE(
1573 "css::uno::Sequence<OUString>",
1574 !(a
>>= b
) && b
.getLength() == 2);
1577 css::uno::Sequence
< sal_Int32
> b(2);
1578 CPPUNIT_ASSERT_MESSAGE(
1579 "css::uno::Sequence<sal_Int32>",
1580 (a
>>= b
) && b
.getLength() == 1 && b
[0] == 1);
1584 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
1588 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
1592 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1593 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
1596 css::uno::Reference
< Interface1
> i(new Impl1
);
1597 css::uno::Reference
< Interface1
> b(i
);
1598 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
1602 void Test::testEnum() {
1603 css::uno::Any
a(Enum2_M1
);
1604 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<Enum2
>::get()));
1607 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
1611 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
1615 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
1619 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
1623 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
1627 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
1631 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
1635 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
) && b
== 2);
1639 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
) && b
== 2);
1643 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
1647 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
) && b
== 2);
1650 sal_Unicode b
= '2';
1651 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
1655 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
1658 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1659 CPPUNIT_ASSERT_MESSAGE(
1661 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
1664 css::uno::Sequence
< OUString
> b(2);
1665 CPPUNIT_ASSERT_MESSAGE(
1666 "css::uno::Sequence<OUString>",
1667 !(a
>>= b
) && b
.getLength() == 2);
1671 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
1675 CPPUNIT_ASSERT_MESSAGE("Enum2", (a
>>= b
) && b
== Enum2_M1
);
1679 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
1683 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1684 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
1687 css::uno::Reference
< Interface1
> i(new Impl1
);
1688 css::uno::Reference
< Interface1
> b(i
);
1689 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
1693 void Test::testStruct() {
1694 css::uno::Any
a(Struct2a(1, 3));
1695 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<Struct2a
>::get()));
1698 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
1702 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
1706 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
1710 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
1714 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
1718 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
1722 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
1726 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
) && b
== 2);
1730 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
) && b
== 2);
1734 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
1738 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
) && b
== 2);
1741 sal_Unicode b
= '2';
1742 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
1746 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
1749 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1750 CPPUNIT_ASSERT_MESSAGE(
1752 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
1755 css::uno::Sequence
< OUString
> b(2);
1756 CPPUNIT_ASSERT_MESSAGE(
1757 "css::uno::Sequence<OUString>",
1758 !(a
>>= b
) && b
.getLength() == 2);
1762 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
1766 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
1770 CPPUNIT_ASSERT_MESSAGE("Struct2", (a
>>= b
) && b
.member
== 1);
1774 CPPUNIT_ASSERT_MESSAGE(
1775 "Struct2a", (a
>>= b
) && b
.member
== 1 && b
.member2
== 3);
1778 Struct2b
b(2, 2, 2);
1779 CPPUNIT_ASSERT_MESSAGE("Struct2b", !(a
>>= b
) && b
.member
== 2);
1783 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1784 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
1787 css::uno::Reference
< Interface1
> i(new Impl1
);
1788 css::uno::Reference
< Interface1
> b(i
);
1789 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
1793 void Test::testPoly() {
1795 a
<<= Poly
< css::uno::Sequence
< ::sal_Unicode
> >();
1796 CPPUNIT_ASSERT_EQUAL_MESSAGE( "type name", OUString("Poly<[]char>"), a
.getValueType().getTypeName() );
1797 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1799 css::uno::Any(Poly
< css::uno::Sequence
< ::sal_Unicode
> >()), a
);
1802 void Test::testException() {
1805 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 1,
1807 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<Exception2a
>::get()));
1810 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
1814 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
1818 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
1822 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
1826 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
1830 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
1834 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
1838 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
) && b
== 2);
1842 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
) && b
== 2);
1846 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
1850 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
) && b
== 2);
1853 sal_Unicode b
= '2';
1854 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
1858 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
1861 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1862 CPPUNIT_ASSERT_MESSAGE(
1864 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
1867 css::uno::Sequence
< OUString
> b(2);
1868 CPPUNIT_ASSERT_MESSAGE(
1869 "css::uno::Sequence<OUString>",
1870 !(a
>>= b
) && b
.getLength() == 2);
1874 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
1878 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
1882 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1883 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
1887 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1888 CPPUNIT_ASSERT_MESSAGE("Exception2", (a
>>= b
) && b
.member
== 1);
1892 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2,
1894 CPPUNIT_ASSERT_MESSAGE(
1895 "Exception2a", (a
>>= b
) && b
.member
== 1 && b
.member2
== 3);
1899 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2,
1901 CPPUNIT_ASSERT_MESSAGE("Exception2b", !(a
>>= b
) && b
.member
== 2);
1904 css::uno::Reference
< Interface1
> i(new Impl1
);
1905 css::uno::Reference
< Interface1
> b(i
);
1906 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
1910 void Test::testInterface() {
1911 css::uno::Reference
< Interface2a
> i2(new Impl2
);
1912 css::uno::Any
a(i2
);
1913 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<Interface2a
>::get()));
1916 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
1920 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
1924 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
1928 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
1932 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
1936 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
1940 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
1944 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
) && b
== 2);
1948 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
) && b
== 2);
1952 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
1956 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
) && b
== 2);
1959 sal_Unicode b
= '2';
1960 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
1964 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
1967 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
1968 CPPUNIT_ASSERT_MESSAGE(
1970 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
1973 css::uno::Sequence
< OUString
> b(2);
1974 CPPUNIT_ASSERT_MESSAGE(
1975 "css::uno::Sequence<OUString>",
1976 !(a
>>= b
) && b
.getLength() == 2);
1980 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
1984 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
1988 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
1989 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
1992 css::uno::Reference
< Interface1
> i(new Impl1
);
1993 css::uno::Reference
< Interface1
> b(i
);
1994 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a
>>= b
) && b
== i
);
1997 css::uno::Reference
< Interface2
> b(new Impl2
);
1998 CPPUNIT_ASSERT_MESSAGE("Interface2", (a
>>= b
) && b
== i2
);
2001 css::uno::Reference
< Interface2a
> b(new Impl2
);
2002 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a
>>= b
) && b
== i2
);
2005 css::uno::Reference
< Interface2b
> i(new Impl2b
);
2006 css::uno::Reference
< Interface2b
> b(i
);
2007 CPPUNIT_ASSERT_MESSAGE("Interface2b", !(a
>>= b
) && b
== i
);
2010 css::uno::Reference
< Interface3
> b(new Impl2
);
2011 CPPUNIT_ASSERT_MESSAGE("Interface3", (a
>>= b
) && b
== i2
);
2015 void Test::testNull() {
2016 css::uno::Any a
{ css::uno::Reference
< Interface2a
>() };
2017 CPPUNIT_ASSERT(bool(a
.getValueType() == cppu::UnoType
<Interface2a
>::get()));
2020 CPPUNIT_ASSERT_MESSAGE("bool", !(a
>>= b
) && b
);
2024 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a
>>= b
) && b
);
2028 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a
>>= b
) && b
== 2);
2032 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a
>>= b
) && b
== 2);
2036 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a
>>= b
) && b
== 2);
2040 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a
>>= b
) && b
== 2);
2044 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a
>>= b
) && b
== 2);
2048 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a
>>= b
) && b
== 2);
2052 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a
>>= b
) && b
== 2);
2056 CPPUNIT_ASSERT_MESSAGE("float", !(a
>>= b
) && b
== 2);
2060 CPPUNIT_ASSERT_MESSAGE("double", !(a
>>= b
) && b
== 2);
2063 sal_Unicode b
= '2';
2064 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a
>>= b
) && b
== '2');
2068 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a
>>= b
) && b
== "2" );
2071 css::uno::Type
b(cppu::UnoType
<OUString
>::get());
2072 CPPUNIT_ASSERT_MESSAGE(
2074 !(a
>>= b
) && b
== cppu::UnoType
<OUString
>::get());
2077 css::uno::Sequence
< OUString
> b(2);
2078 CPPUNIT_ASSERT_MESSAGE(
2079 "css::uno::Sequence<OUString>",
2080 !(a
>>= b
) && b
.getLength() == 2);
2084 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a
>>= b
) && b
== Enum1_M2
);
2088 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a
>>= b
) && b
.member
== 2);
2092 OUString(), css::uno::Reference
< css::uno::XInterface
>(), 2);
2093 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a
>>= b
) && b
.member
== 2);
2096 css::uno::Reference
< Interface1
> b(new Impl1
);
2097 CPPUNIT_ASSERT_MESSAGE(
2098 "Interface1", (a
>>= b
) && !b
.is());
2101 css::uno::Reference
< Interface2
> b(new Impl2
);
2102 CPPUNIT_ASSERT_MESSAGE(
2103 "Interface2", (a
>>= b
) && !b
.is());
2106 css::uno::Reference
< Interface2a
> b(new Impl2
);
2107 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a
>>= b
) && !b
.is());
2110 css::uno::Reference
< Interface2b
> b(new Impl2b
);
2111 CPPUNIT_ASSERT_MESSAGE(
2112 "Interface2b", (a
>>= b
) && !b
.is());
2115 css::uno::Reference
< Interface3
> b(new Impl2
);
2116 CPPUNIT_ASSERT_MESSAGE(
2117 "Interface3", (a
>>= b
) && !b
.is());
2121 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
2125 CPPUNIT_PLUGIN_IMPLEMENT();
2127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */