update dev300-m58
[ooovba.git] / cppu / qa / test_any.cxx
blob8171cf09f47f7117af801891b12b6a8918fd0c55
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: test_any.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_cppu.hxx"
34 #include "sal/config.h"
36 #include <stdlib.h> // wntmsci10 does not like <cstdlib>
38 #include "Enum1.hpp"
39 #include "Enum2.hpp"
40 #include "Exception1.hpp"
41 #include "Exception2.hpp"
42 #include "Exception2a.hpp"
43 #include "Exception2b.hpp"
44 #include "Interface1.hpp"
45 #include "Interface2.hpp"
46 #include "Interface2a.hpp"
47 #include "Interface2b.hpp"
48 #include "Interface3.hpp"
49 #include "Poly.hpp"
50 #include "Struct1.hpp"
51 #include "Struct2.hpp"
52 #include "Struct2a.hpp"
53 #include "Struct2b.hpp"
54 #include "boost/type_traits/is_same.hpp"
55 #include "com/sun/star/uno/Any.hxx"
56 #include "com/sun/star/uno/Reference.hxx"
57 #include "com/sun/star/uno/RuntimeException.hpp"
58 #include "com/sun/star/uno/Sequence.hxx"
59 #include "com/sun/star/uno/Type.hxx"
60 #include "com/sun/star/uno/XInterface.hpp"
61 #include "cppunit/simpleheader.hxx"
62 #include "osl/diagnose.h"
63 #include "osl/interlck.h"
64 #include "rtl/string.h"
65 #include "rtl/ustring.h"
66 #include "rtl/ustring.hxx"
67 #include "sal/types.h"
69 namespace {
71 namespace css = com::sun::star;
73 class Base {
74 public:
75 Base(): m_count(0) {}
77 void acquire() {
78 if (osl_incrementInterlockedCount(&m_count) == SAL_MAX_INT32) {
79 abort();
83 void release() {
84 if (osl_decrementInterlockedCount(&m_count) == 0) {
85 delete this;
89 protected:
90 virtual ~Base() {}
92 private:
93 Base(Base &); // not declared
94 void operator =(Base &); // not declared
96 oslInterlockedCount m_count;
99 class Impl1: public Interface1, private Base {
100 public:
101 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
102 throw (css::uno::RuntimeException)
104 if (type
105 == getCppuType< css::uno::Reference< css::uno::XInterface > >())
107 css::uno::Reference< css::uno::XInterface > ref(
108 static_cast< css::uno::XInterface * >(this));
109 return css::uno::Any(&ref, type);
110 } else if (type == getCppuType< css::uno::Reference< Interface1 > >()) {
111 css::uno::Reference< Interface1 > ref(this);
112 return css::uno::Any(&ref, type);
113 } else {
114 return css::uno::Any();
118 virtual void SAL_CALL acquire() throw () {
119 Base::acquire();
122 virtual void SAL_CALL release() throw () {
123 Base::release();
127 class Impl2: public Interface2a, public Interface3, private Base {
128 public:
129 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
130 throw (css::uno::RuntimeException)
132 if (type
133 == getCppuType< css::uno::Reference< css::uno::XInterface > >())
135 css::uno::Reference< css::uno::XInterface > ref(
136 static_cast< css::uno::XInterface * >(
137 static_cast< Interface2a * >(this)));
138 return css::uno::Any(&ref, type);
139 } else if (type == getCppuType< css::uno::Reference< Interface2 > >()) {
140 css::uno::Reference< Interface2 > ref(this);
141 return css::uno::Any(&ref, type);
142 } else if (type == getCppuType< css::uno::Reference< Interface2a > >())
144 css::uno::Reference< Interface2a > ref(this);
145 return css::uno::Any(&ref, type);
146 } else if (type == getCppuType< css::uno::Reference< Interface3 > >()) {
147 css::uno::Reference< Interface3 > ref(this);
148 return css::uno::Any(&ref, type);
149 } else {
150 return css::uno::Any();
154 virtual void SAL_CALL acquire() throw () {
155 Base::acquire();
158 virtual void SAL_CALL release() throw () {
159 Base::release();
163 class Impl2b: public Interface2b, private Base {
164 public:
165 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
166 throw (css::uno::RuntimeException)
168 if (type
169 == getCppuType< css::uno::Reference< css::uno::XInterface > >())
171 css::uno::Reference< css::uno::XInterface > ref(
172 static_cast< css::uno::XInterface * >(
173 static_cast< Interface2a * >(this)));
174 return css::uno::Any(&ref, type);
175 } else if (type == getCppuType< css::uno::Reference< Interface2 > >()) {
176 css::uno::Reference< Interface2 > ref(this);
177 return css::uno::Any(&ref, type);
178 } else if (type == getCppuType< css::uno::Reference< Interface2a > >())
180 css::uno::Reference< Interface2a > ref(this);
181 return css::uno::Any(&ref, type);
182 } else if (type == getCppuType< css::uno::Reference< Interface2b > >())
184 css::uno::Reference< Interface2b > ref(this);
185 return css::uno::Any(&ref, type);
186 } else {
187 return css::uno::Any();
191 virtual void SAL_CALL acquire() throw () {
192 Base::acquire();
195 virtual void SAL_CALL release() throw () {
196 Base::release();
200 class Test: public CppUnit::TestFixture {
201 public:
202 void testVoid();
204 void testBoolean();
206 void testByte();
208 void testShort();
210 void testUnsignedShort();
212 void testLong();
214 void testUnsignedLong();
216 void testHyper();
218 void testUnsignedHyper();
220 void testFloat();
222 void testDouble();
224 void testChar();
226 void testString();
228 void testType();
230 void testSequence();
232 void testEnum();
234 void testStruct();
236 void testPoly();
238 void testException();
240 void testInterface();
242 void testNull();
244 CPPUNIT_TEST_SUITE(Test);
245 CPPUNIT_TEST(testVoid);
246 CPPUNIT_TEST(testBoolean);
247 CPPUNIT_TEST(testByte);
248 CPPUNIT_TEST(testShort);
249 CPPUNIT_TEST(testUnsignedShort);
250 CPPUNIT_TEST(testLong);
251 CPPUNIT_TEST(testUnsignedLong);
252 CPPUNIT_TEST(testHyper);
253 CPPUNIT_TEST(testUnsignedHyper);
254 CPPUNIT_TEST(testFloat);
255 CPPUNIT_TEST(testDouble);
256 CPPUNIT_TEST(testChar);
257 CPPUNIT_TEST(testString);
258 CPPUNIT_TEST(testType);
259 CPPUNIT_TEST(testSequence);
260 CPPUNIT_TEST(testEnum);
261 CPPUNIT_TEST(testStruct);
262 CPPUNIT_TEST(testPoly);
263 CPPUNIT_TEST(testException);
264 CPPUNIT_TEST(testInterface);
265 CPPUNIT_TEST(testNull);
266 CPPUNIT_TEST_SUITE_END();
269 void Test::testVoid() {
270 css::uno::Any a;
271 CPPUNIT_ASSERT(a.getValueType() == getVoidCppuType());
273 bool b = true;
274 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
277 sal_Bool b = true;
278 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
281 sal_Int8 b = 2;
282 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
285 sal_uInt8 b = 2;
286 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
289 sal_Int16 b = 2;
290 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
293 sal_uInt16 b = 2;
294 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
297 sal_Int32 b = 2;
298 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
301 sal_uInt32 b = 2;
302 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
305 sal_Int64 b = 2;
306 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
309 sal_uInt64 b = 2;
310 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
313 float b = 2;
314 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
317 double b = 2;
318 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
321 sal_Unicode b = '2';
322 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
325 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
326 CPPUNIT_ASSERT_MESSAGE(
327 "rtl::OUString",
328 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
331 css::uno::Type b(getCppuType< rtl::OUString >());
332 CPPUNIT_ASSERT_MESSAGE(
333 "css::uno::Type",
334 !(a >>= b) && b == getCppuType< rtl::OUString >());
337 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
338 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
341 css::uno::Sequence< rtl::OUString > b(2);
342 CPPUNIT_ASSERT_MESSAGE(
343 "css::uno::Sequence<rtl::OUString>", !(a >>= b) && b.getLength() == 2);
346 Enum1 b = Enum1_M2;
347 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
350 Struct1 b(2);
351 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
354 Exception1 b(
355 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
356 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
359 css::uno::Reference< Interface1 > i(new Impl1);
360 css::uno::Reference< Interface1 > b(i);
361 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
365 void Test::testBoolean() {
366 css::uno::Any a(false);
367 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Bool >());
369 bool b = true;
370 CPPUNIT_ASSERT_MESSAGE("bool", (a >>= b) && !b);
373 sal_Bool b = true;
374 CPPUNIT_ASSERT_MESSAGE("sal_Bool", (a >>= b) && !b);
377 sal_Int8 b = 2;
378 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
381 sal_uInt8 b = 2;
382 if (boost::is_same< sal_uInt8, sal_Bool >::value) {
383 CPPUNIT_ASSERT_MESSAGE("@sal_uInt8", (a >>= b) && b == 0);
384 } else {
385 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
389 sal_Int16 b = 2;
390 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
393 sal_uInt16 b = 2;
394 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
397 sal_Int32 b = 2;
398 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
401 sal_uInt32 b = 2;
402 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
405 sal_Int64 b = 2;
406 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
409 sal_uInt64 b = 2;
410 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
413 float b = 2;
414 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
417 double b = 2;
418 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
421 sal_Unicode b = '2';
422 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
425 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
426 CPPUNIT_ASSERT_MESSAGE(
427 "rtl::OUString",
428 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
431 css::uno::Type b(getCppuType< rtl::OUString >());
432 CPPUNIT_ASSERT_MESSAGE(
433 "css::uno::Type",
434 !(a >>= b) && b == getCppuType< rtl::OUString >());
437 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
438 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
441 css::uno::Sequence< rtl::OUString > b(2);
442 CPPUNIT_ASSERT_MESSAGE(
443 "css::uno::Sequence<rtl::OUString>",
444 !(a >>= b) && b.getLength() == 2);
447 Enum1 b = Enum1_M2;
448 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
451 Struct1 b(2);
452 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
455 Exception1 b(
456 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
457 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
460 css::uno::Reference< Interface1 > i(new Impl1);
461 css::uno::Reference< Interface1 > b(i);
462 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
466 void Test::testByte() {
467 css::uno::Any a(static_cast< sal_Int8 >(1));
468 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int8 >());
470 bool b = true;
471 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
474 sal_Bool b = true;
475 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
478 sal_Int8 b = 2;
479 CPPUNIT_ASSERT_MESSAGE("sal_Int8", (a >>= b) && b == 1);
482 sal_uInt8 b = 2;
483 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
486 sal_Int16 b = 2;
487 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
490 sal_uInt16 b = 2;
491 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
494 sal_Int32 b = 2;
495 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
498 sal_uInt32 b = 2;
499 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
502 sal_Int64 b = 2;
503 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
506 sal_uInt64 b = 2;
507 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
510 float b = 2;
511 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
514 double b = 2;
515 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
518 sal_Unicode b = '2';
519 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
520 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
521 } else {
522 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
526 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
527 CPPUNIT_ASSERT_MESSAGE(
528 "rtl::OUString",
529 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
532 css::uno::Type b(getCppuType< rtl::OUString >());
533 CPPUNIT_ASSERT_MESSAGE(
534 "css::uno::Type",
535 !(a >>= b) && b == getCppuType< rtl::OUString >());
538 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
539 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
542 css::uno::Sequence< rtl::OUString > b(2);
543 CPPUNIT_ASSERT_MESSAGE(
544 "css::uno::Sequence<rtl::OUString>",
545 !(a >>= b) && b.getLength() == 2);
548 Enum1 b = Enum1_M2;
549 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
552 Struct1 b(2);
553 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
556 Exception1 b(
557 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
558 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
561 css::uno::Reference< Interface1 > i(new Impl1);
562 css::uno::Reference< Interface1 > b(i);
563 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
567 void Test::testShort() {
568 css::uno::Any a(static_cast< sal_Int16 >(1));
569 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int16 >());
571 bool b = true;
572 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
575 sal_Bool b = true;
576 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
579 sal_Int8 b = 2;
580 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
583 sal_uInt8 b = 2;
584 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
587 sal_Int16 b = 2;
588 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
591 sal_uInt16 b = 2;
592 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
595 sal_Int32 b = 2;
596 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
599 sal_uInt32 b = 2;
600 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
603 sal_Int64 b = 2;
604 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
607 sal_uInt64 b = 2;
608 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
611 float b = 2;
612 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
615 double b = 2;
616 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
619 sal_Unicode b = '2';
620 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
621 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
622 } else {
623 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
627 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
628 CPPUNIT_ASSERT_MESSAGE(
629 "rtl::OUString",
630 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
633 css::uno::Type b(getCppuType< rtl::OUString >());
634 CPPUNIT_ASSERT_MESSAGE(
635 "css::uno::Type",
636 !(a >>= b) && b == getCppuType< rtl::OUString >());
639 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
640 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
643 css::uno::Sequence< rtl::OUString > b(2);
644 CPPUNIT_ASSERT_MESSAGE(
645 "css::uno::Sequence<rtl::OUString>",
646 !(a >>= b) && b.getLength() == 2);
649 Enum1 b = Enum1_M2;
650 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
653 Struct1 b(2);
654 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
657 Exception1 b(
658 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
659 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
662 css::uno::Reference< Interface1 > i(new Impl1);
663 css::uno::Reference< Interface1 > b(i);
664 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
668 void Test::testUnsignedShort() {
669 sal_uInt16 n = 1;
670 css::uno::Any a(&n, getCppuType(static_cast< sal_uInt16 const * >(0)));
671 CPPUNIT_ASSERT(
672 a.getValueType() == getCppuType(static_cast< sal_uInt16 const * >(0)));
674 bool b = true;
675 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
678 sal_Bool b = true;
679 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
682 sal_Int8 b = 2;
683 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
686 sal_uInt8 b = 2;
687 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
690 sal_Int16 b = 2;
691 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
694 sal_uInt16 b = 2;
695 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
698 sal_Int32 b = 2;
699 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
702 sal_uInt32 b = 2;
703 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
706 sal_Int64 b = 2;
707 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
710 sal_uInt64 b = 2;
711 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
714 float b = 2;
715 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
718 double b = 2;
719 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
722 sal_Unicode b = '2';
723 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
724 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
725 } else {
726 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
730 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
731 CPPUNIT_ASSERT_MESSAGE(
732 "rtl::OUString",
733 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
736 css::uno::Type b(getCppuType< rtl::OUString >());
737 CPPUNIT_ASSERT_MESSAGE(
738 "css::uno::Type",
739 !(a >>= b) && b == getCppuType< rtl::OUString >());
742 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
743 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
746 css::uno::Sequence< rtl::OUString > b(2);
747 CPPUNIT_ASSERT_MESSAGE(
748 "css::uno::Sequence<rtl::OUString>",
749 !(a >>= b) && b.getLength() == 2);
752 Enum1 b = Enum1_M2;
753 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
756 Struct1 b(2);
757 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
760 Exception1 b(
761 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
762 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
765 css::uno::Reference< Interface1 > i(new Impl1);
766 css::uno::Reference< Interface1 > b(i);
767 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
771 void Test::testLong() {
772 css::uno::Any a(static_cast< sal_Int32 >(1));
773 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int32 >());
775 bool b = true;
776 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
779 sal_Bool b = true;
780 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
783 sal_Int8 b = 2;
784 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
787 sal_uInt8 b = 2;
788 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
791 sal_Int16 b = 2;
792 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
795 sal_uInt16 b = 2;
796 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
799 sal_Int32 b = 2;
800 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
803 sal_uInt32 b = 2;
804 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
807 sal_Int64 b = 2;
808 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
811 sal_uInt64 b = 2;
812 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
815 float b = 2;
816 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
819 double b = 2;
820 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
823 sal_Unicode b = '2';
824 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
827 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
828 CPPUNIT_ASSERT_MESSAGE(
829 "rtl::OUString",
830 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
833 css::uno::Type b(getCppuType< rtl::OUString >());
834 CPPUNIT_ASSERT_MESSAGE(
835 "css::uno::Type",
836 !(a >>= b) && b == getCppuType< rtl::OUString >());
839 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
840 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
843 css::uno::Sequence< rtl::OUString > b(2);
844 CPPUNIT_ASSERT_MESSAGE(
845 "css::uno::Sequence<rtl::OUString>",
846 !(a >>= b) && b.getLength() == 2);
849 Enum1 b = Enum1_M2;
850 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
853 Struct1 b(2);
854 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
857 Exception1 b(
858 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
859 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
862 css::uno::Reference< Interface1 > i(new Impl1);
863 css::uno::Reference< Interface1 > b(i);
864 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
868 void Test::testUnsignedLong() {
869 css::uno::Any a(static_cast< sal_uInt32 >(1));
870 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_uInt32 >());
872 bool b = true;
873 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
876 sal_Bool b = true;
877 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
880 sal_Int8 b = 2;
881 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
884 sal_uInt8 b = 2;
885 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
888 sal_Int16 b = 2;
889 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
892 sal_uInt16 b = 2;
893 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
896 sal_Int32 b = 2;
897 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
900 sal_uInt32 b = 2;
901 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
904 sal_Int64 b = 2;
905 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
908 sal_uInt64 b = 2;
909 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
912 float b = 2;
913 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
916 double b = 2;
917 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
920 sal_Unicode b = '2';
921 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
924 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
925 CPPUNIT_ASSERT_MESSAGE(
926 "rtl::OUString",
927 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
930 css::uno::Type b(getCppuType< rtl::OUString >());
931 CPPUNIT_ASSERT_MESSAGE(
932 "css::uno::Type",
933 !(a >>= b) && b == getCppuType< rtl::OUString >());
936 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
937 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
940 css::uno::Sequence< rtl::OUString > b(2);
941 CPPUNIT_ASSERT_MESSAGE(
942 "css::uno::Sequence<rtl::OUString>",
943 !(a >>= b) && b.getLength() == 2);
946 Enum1 b = Enum1_M2;
947 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
950 Struct1 b(2);
951 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
954 Exception1 b(
955 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
956 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
959 css::uno::Reference< Interface1 > i(new Impl1);
960 css::uno::Reference< Interface1 > b(i);
961 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
965 void Test::testHyper() {
966 css::uno::Any a(static_cast< sal_Int64 >(1));
967 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int64 >());
969 bool b = true;
970 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
973 sal_Bool b = true;
974 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
977 sal_Int8 b = 2;
978 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
981 sal_uInt8 b = 2;
982 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
985 sal_Int16 b = 2;
986 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
989 sal_uInt16 b = 2;
990 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
993 sal_Int32 b = 2;
994 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
997 sal_uInt32 b = 2;
998 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1001 sal_Int64 b = 2;
1002 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
1005 sal_uInt64 b = 2;
1006 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
1009 float b = 2;
1010 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1013 double b = 2;
1014 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1017 sal_Unicode b = '2';
1018 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1021 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1022 CPPUNIT_ASSERT_MESSAGE(
1023 "rtl::OUString",
1024 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1027 css::uno::Type b(getCppuType< rtl::OUString >());
1028 CPPUNIT_ASSERT_MESSAGE(
1029 "css::uno::Type",
1030 !(a >>= b) && b == getCppuType< rtl::OUString >());
1033 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1034 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1037 css::uno::Sequence< rtl::OUString > b(2);
1038 CPPUNIT_ASSERT_MESSAGE(
1039 "css::uno::Sequence<rtl::OUString>",
1040 !(a >>= b) && b.getLength() == 2);
1043 Enum1 b = Enum1_M2;
1044 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1047 Struct1 b(2);
1048 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1051 Exception1 b(
1052 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1053 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1056 css::uno::Reference< Interface1 > i(new Impl1);
1057 css::uno::Reference< Interface1 > b(i);
1058 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1062 void Test::testUnsignedHyper() {
1063 css::uno::Any a(static_cast< sal_uInt64 >(1));
1064 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_uInt64 >());
1066 bool b = true;
1067 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1070 sal_Bool b = true;
1071 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1074 sal_Int8 b = 2;
1075 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1078 sal_uInt8 b = 2;
1079 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1082 sal_Int16 b = 2;
1083 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1086 sal_uInt16 b = 2;
1087 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1090 sal_Int32 b = 2;
1091 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1094 sal_uInt32 b = 2;
1095 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1098 sal_Int64 b = 2;
1099 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
1102 sal_uInt64 b = 2;
1103 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
1106 float b = 2;
1107 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1110 double b = 2;
1111 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1114 sal_Unicode b = '2';
1115 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1118 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1119 CPPUNIT_ASSERT_MESSAGE(
1120 "rtl::OUString",
1121 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1124 css::uno::Type b(getCppuType< rtl::OUString >());
1125 CPPUNIT_ASSERT_MESSAGE(
1126 "css::uno::Type",
1127 !(a >>= b) && b == getCppuType< rtl::OUString >());
1130 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1131 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1134 css::uno::Sequence< rtl::OUString > b(2);
1135 CPPUNIT_ASSERT_MESSAGE(
1136 "css::uno::Sequence<rtl::OUString>",
1137 !(a >>= b) && b.getLength() == 2);
1140 Enum1 b = Enum1_M2;
1141 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1144 Struct1 b(2);
1145 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1148 Exception1 b(
1149 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1150 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1153 css::uno::Reference< Interface1 > i(new Impl1);
1154 css::uno::Reference< Interface1 > b(i);
1155 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1159 void Test::testFloat() {
1160 css::uno::Any a(1.f);
1161 CPPUNIT_ASSERT(a.getValueType() == getCppuType< float >());
1163 bool b = true;
1164 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1167 sal_Bool b = true;
1168 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1171 sal_Int8 b = 2;
1172 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1175 sal_uInt8 b = 2;
1176 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1179 sal_Int16 b = 2;
1180 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1183 sal_uInt16 b = 2;
1184 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1187 sal_Int32 b = 2;
1188 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1191 sal_uInt32 b = 2;
1192 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1195 sal_Int64 b = 2;
1196 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1199 sal_uInt64 b = 2;
1200 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1203 float b = 2;
1204 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
1207 double b = 2;
1208 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1211 sal_Unicode b = '2';
1212 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1215 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1216 CPPUNIT_ASSERT_MESSAGE(
1217 "rtl::OUString",
1218 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1221 css::uno::Type b(getCppuType< rtl::OUString >());
1222 CPPUNIT_ASSERT_MESSAGE(
1223 "css::uno::Type",
1224 !(a >>= b) && b == getCppuType< rtl::OUString >());
1227 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1228 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1231 css::uno::Sequence< rtl::OUString > b(2);
1232 CPPUNIT_ASSERT_MESSAGE(
1233 "css::uno::Sequence<rtl::OUString>",
1234 !(a >>= b) && b.getLength() == 2);
1237 Enum1 b = Enum1_M2;
1238 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1241 Struct1 b(2);
1242 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1245 Exception1 b(
1246 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1247 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1250 css::uno::Reference< Interface1 > i(new Impl1);
1251 css::uno::Reference< Interface1 > b(i);
1252 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1256 void Test::testDouble() {
1257 css::uno::Any a(1.);
1258 CPPUNIT_ASSERT(a.getValueType() == getCppuType< double >());
1260 bool b = true;
1261 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1264 sal_Bool b = true;
1265 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1268 sal_Int8 b = 2;
1269 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1272 sal_uInt8 b = 2;
1273 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1276 sal_Int16 b = 2;
1277 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1280 sal_uInt16 b = 2;
1281 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1284 sal_Int32 b = 2;
1285 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1288 sal_uInt32 b = 2;
1289 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1292 sal_Int64 b = 2;
1293 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1296 sal_uInt64 b = 2;
1297 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1300 float b = 2;
1301 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1304 double b = 2;
1305 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1308 sal_Unicode b = '2';
1309 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1312 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1313 CPPUNIT_ASSERT_MESSAGE(
1314 "rtl::OUString",
1315 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1318 css::uno::Type b(getCppuType< rtl::OUString >());
1319 CPPUNIT_ASSERT_MESSAGE(
1320 "css::uno::Type",
1321 !(a >>= b) && b == getCppuType< rtl::OUString >());
1324 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1325 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1328 css::uno::Sequence< rtl::OUString > b(2);
1329 CPPUNIT_ASSERT_MESSAGE(
1330 "css::uno::Sequence<rtl::OUString>",
1331 !(a >>= b) && b.getLength() == 2);
1334 Enum1 b = Enum1_M2;
1335 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1338 Struct1 b(2);
1339 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1342 Exception1 b(
1343 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1344 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1347 css::uno::Reference< Interface1 > i(new Impl1);
1348 css::uno::Reference< Interface1 > b(i);
1349 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1353 void Test::testChar() {
1354 sal_Unicode c = '1';
1355 css::uno::Any a(&c, getCppuType< sal_Unicode >());
1356 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Unicode >());
1358 bool b = true;
1359 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1362 sal_Bool b = true;
1363 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1366 sal_Int8 b = 2;
1367 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1370 sal_uInt8 b = 2;
1371 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1374 sal_Int16 b = 2;
1375 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1378 sal_uInt16 b = 2;
1379 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1382 sal_Int32 b = 2;
1383 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1386 sal_uInt32 b = 2;
1387 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1390 sal_Int64 b = 2;
1391 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1394 sal_uInt64 b = 2;
1395 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1398 float b = 2;
1399 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1402 double b = 2;
1403 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1406 sal_Unicode b = '2';
1407 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
1408 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", !(a >>= b) && b == '2');
1409 } else {
1410 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", (a >>= b) && b == '1');
1414 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1415 CPPUNIT_ASSERT_MESSAGE(
1416 "rtl::OUString",
1417 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1420 css::uno::Type b(getCppuType< rtl::OUString >());
1421 CPPUNIT_ASSERT_MESSAGE(
1422 "css::uno::Type",
1423 !(a >>= b) && b == getCppuType< rtl::OUString >());
1426 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1427 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1430 css::uno::Sequence< rtl::OUString > b(2);
1431 CPPUNIT_ASSERT_MESSAGE(
1432 "css::uno::Sequence<rtl::OUString>",
1433 !(a >>= b) && b.getLength() == 2);
1436 Enum1 b = Enum1_M2;
1437 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1440 Struct1 b(2);
1441 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1444 Exception1 b(
1445 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1446 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1449 css::uno::Reference< Interface1 > i(new Impl1);
1450 css::uno::Reference< Interface1 > b(i);
1451 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1455 void Test::testString() {
1456 css::uno::Any a(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1")));
1457 CPPUNIT_ASSERT(a.getValueType() == getCppuType< rtl::OUString >());
1459 bool b = true;
1460 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1463 sal_Bool b = true;
1464 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1467 sal_Int8 b = 2;
1468 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1471 sal_uInt8 b = 2;
1472 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1475 sal_Int16 b = 2;
1476 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1479 sal_uInt16 b = 2;
1480 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1483 sal_Int32 b = 2;
1484 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1487 sal_uInt32 b = 2;
1488 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1491 sal_Int64 b = 2;
1492 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1495 sal_uInt64 b = 2;
1496 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1499 float b = 2;
1500 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1503 double b = 2;
1504 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1507 sal_Unicode b = '2';
1508 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1511 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1512 CPPUNIT_ASSERT_MESSAGE(
1513 "rtl::OUString",
1514 (a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("1")));
1517 css::uno::Type b(getCppuType< rtl::OUString >());
1518 CPPUNIT_ASSERT_MESSAGE(
1519 "css::uno::Type",
1520 !(a >>= b) && b == getCppuType< rtl::OUString >());
1523 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1524 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1527 css::uno::Sequence< rtl::OUString > b(2);
1528 CPPUNIT_ASSERT_MESSAGE(
1529 "css::uno::Sequence<rtl::OUString>",
1530 !(a >>= b) && b.getLength() == 2);
1533 Enum1 b = Enum1_M2;
1534 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1537 Struct1 b(2);
1538 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1541 Exception1 b(
1542 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1543 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1546 css::uno::Reference< Interface1 > i(new Impl1);
1547 css::uno::Reference< Interface1 > b(i);
1548 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1552 void Test::testType() {
1553 css::uno::Any a(getCppuType< sal_Int32 >());
1554 CPPUNIT_ASSERT(a.getValueType() == getCppuType< css::uno::Type >());
1556 bool b = true;
1557 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1560 sal_Bool b = true;
1561 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1564 sal_Int8 b = 2;
1565 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1568 sal_uInt8 b = 2;
1569 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1572 sal_Int16 b = 2;
1573 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1576 sal_uInt16 b = 2;
1577 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1580 sal_Int32 b = 2;
1581 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1584 sal_uInt32 b = 2;
1585 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1588 sal_Int64 b = 2;
1589 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1592 sal_uInt64 b = 2;
1593 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1596 float b = 2;
1597 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1600 double b = 2;
1601 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1604 sal_Unicode b = '2';
1605 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1608 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1609 CPPUNIT_ASSERT_MESSAGE(
1610 "rtl::OUString",
1611 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1614 css::uno::Type b(getCppuType< rtl::OUString >());
1615 CPPUNIT_ASSERT_MESSAGE(
1616 "css::uno::Type", (a >>= b) && b == getCppuType< sal_Int32 >());
1619 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1620 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1623 css::uno::Sequence< rtl::OUString > b(2);
1624 CPPUNIT_ASSERT_MESSAGE(
1625 "css::uno::Sequence<rtl::OUString>",
1626 !(a >>= b) && b.getLength() == 2);
1629 Enum1 b = Enum1_M2;
1630 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1633 Struct1 b(2);
1634 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1637 Exception1 b(
1638 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1639 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1642 css::uno::Reference< Interface1 > i(new Impl1);
1643 css::uno::Reference< Interface1 > b(i);
1644 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1648 void Test::testSequence() {
1649 sal_Int32 n = 1;
1650 css::uno::Any a(css::uno::Sequence< sal_Int32 >(&n, 1));
1651 CPPUNIT_ASSERT(
1652 a.getValueType() == getCppuType< css::uno::Sequence< sal_Int32 > >());
1654 bool b = true;
1655 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1658 sal_Bool b = true;
1659 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1662 sal_Int8 b = 2;
1663 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1666 sal_uInt8 b = 2;
1667 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1670 sal_Int16 b = 2;
1671 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1674 sal_uInt16 b = 2;
1675 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1678 sal_Int32 b = 2;
1679 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1682 sal_uInt32 b = 2;
1683 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1686 sal_Int64 b = 2;
1687 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1690 sal_uInt64 b = 2;
1691 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1694 float b = 2;
1695 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1698 double b = 2;
1699 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1702 sal_Unicode b = '2';
1703 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1706 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1707 CPPUNIT_ASSERT_MESSAGE(
1708 "rtl::OUString",
1709 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1712 css::uno::Type b(getCppuType< rtl::OUString >());
1713 CPPUNIT_ASSERT_MESSAGE(
1714 "css::uno::Type",
1715 !(a >>= b) && b == getCppuType< rtl::OUString >());
1718 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1719 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1722 css::uno::Sequence< rtl::OUString > b(2);
1723 CPPUNIT_ASSERT_MESSAGE(
1724 "css::uno::Sequence<rtl::OUString>",
1725 !(a >>= b) && b.getLength() == 2);
1728 css::uno::Sequence< sal_Int32 > b(2);
1729 CPPUNIT_ASSERT_MESSAGE(
1730 "css::uno::Sequence<sal_Int32>",
1731 (a >>= b) && b.getLength() == 1 && b[0] == 1);
1734 Enum1 b = Enum1_M2;
1735 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1738 Struct1 b(2);
1739 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1742 Exception1 b(
1743 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1744 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1747 css::uno::Reference< Interface1 > i(new Impl1);
1748 css::uno::Reference< Interface1 > b(i);
1749 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1753 void Test::testEnum() {
1754 css::uno::Any a(Enum2_M1);
1755 CPPUNIT_ASSERT(a.getValueType() == getCppuType< Enum2 >());
1757 bool b = true;
1758 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1761 sal_Bool b = true;
1762 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1765 sal_Int8 b = 2;
1766 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1769 sal_uInt8 b = 2;
1770 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1773 sal_Int16 b = 2;
1774 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1777 sal_uInt16 b = 2;
1778 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1781 sal_Int32 b = 2;
1782 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1785 sal_uInt32 b = 2;
1786 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1789 sal_Int64 b = 2;
1790 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1793 sal_uInt64 b = 2;
1794 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1797 float b = 2;
1798 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1801 double b = 2;
1802 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1805 sal_Unicode b = '2';
1806 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1809 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1810 CPPUNIT_ASSERT_MESSAGE(
1811 "rtl::OUString",
1812 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1815 css::uno::Type b(getCppuType< rtl::OUString >());
1816 CPPUNIT_ASSERT_MESSAGE(
1817 "css::uno::Type",
1818 !(a >>= b) && b == getCppuType< rtl::OUString >());
1821 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1822 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1825 css::uno::Sequence< rtl::OUString > b(2);
1826 CPPUNIT_ASSERT_MESSAGE(
1827 "css::uno::Sequence<rtl::OUString>",
1828 !(a >>= b) && b.getLength() == 2);
1831 Enum1 b = Enum1_M2;
1832 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1835 Enum2 b = Enum2_M2;
1836 CPPUNIT_ASSERT_MESSAGE("Enum2", (a >>= b) && b == Enum2_M1);
1839 Struct1 b(2);
1840 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1843 Exception1 b(
1844 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1845 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1848 css::uno::Reference< Interface1 > i(new Impl1);
1849 css::uno::Reference< Interface1 > b(i);
1850 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1854 void Test::testStruct() {
1855 css::uno::Any a(Struct2a(1, 3));
1856 CPPUNIT_ASSERT(a.getValueType() == getCppuType< Struct2a >());
1858 bool b = true;
1859 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1862 sal_Bool b = true;
1863 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1866 sal_Int8 b = 2;
1867 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1870 sal_uInt8 b = 2;
1871 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1874 sal_Int16 b = 2;
1875 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1878 sal_uInt16 b = 2;
1879 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1882 sal_Int32 b = 2;
1883 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1886 sal_uInt32 b = 2;
1887 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1890 sal_Int64 b = 2;
1891 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1894 sal_uInt64 b = 2;
1895 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1898 float b = 2;
1899 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1902 double b = 2;
1903 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1906 sal_Unicode b = '2';
1907 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1910 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1911 CPPUNIT_ASSERT_MESSAGE(
1912 "rtl::OUString",
1913 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1916 css::uno::Type b(getCppuType< rtl::OUString >());
1917 CPPUNIT_ASSERT_MESSAGE(
1918 "css::uno::Type",
1919 !(a >>= b) && b == getCppuType< rtl::OUString >());
1922 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1923 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1926 css::uno::Sequence< rtl::OUString > b(2);
1927 CPPUNIT_ASSERT_MESSAGE(
1928 "css::uno::Sequence<rtl::OUString>",
1929 !(a >>= b) && b.getLength() == 2);
1932 Enum1 b = Enum1_M2;
1933 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1936 Struct1 b(2);
1937 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1940 Struct2 b(2);
1941 CPPUNIT_ASSERT_MESSAGE("Struct2", (a >>= b) && b.member == 1);
1944 Struct2a b(2, 2);
1945 CPPUNIT_ASSERT_MESSAGE(
1946 "Struct2a", (a >>= b) && b.member == 1 && b.member2 == 3);
1949 Struct2b b(2, 2, 2);
1950 CPPUNIT_ASSERT_MESSAGE("Struct2b", !(a >>= b) && b.member == 2);
1953 Exception1 b(
1954 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1955 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1958 css::uno::Reference< Interface1 > i(new Impl1);
1959 css::uno::Reference< Interface1 > b(i);
1960 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1964 void Test::testPoly() {
1965 css::uno::Any a;
1966 a <<= Poly< css::uno::Sequence< ::sal_Unicode > >();
1967 CPPUNIT_ASSERT_MESSAGE(
1968 "type name",
1969 a.getValueType().getTypeName().equalsAsciiL(
1970 RTL_CONSTASCII_STRINGPARAM("Poly<[]char>")));
1971 CPPUNIT_ASSERT_MESSAGE(
1972 "constructor",
1973 a == css::uno::Any(Poly< css::uno::Sequence< ::sal_Unicode > >()));
1976 void Test::testException() {
1977 css::uno::Any a(
1978 Exception2a(
1979 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 1,
1980 3));
1981 CPPUNIT_ASSERT(a.getValueType() == getCppuType< Exception2a >());
1983 bool b = true;
1984 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1987 sal_Bool b = true;
1988 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1991 sal_Int8 b = 2;
1992 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1995 sal_uInt8 b = 2;
1996 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1999 sal_Int16 b = 2;
2000 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2003 sal_uInt16 b = 2;
2004 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2007 sal_Int32 b = 2;
2008 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2011 sal_uInt32 b = 2;
2012 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2015 sal_Int64 b = 2;
2016 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2019 sal_uInt64 b = 2;
2020 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2023 float b = 2;
2024 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2027 double b = 2;
2028 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2031 sal_Unicode b = '2';
2032 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2035 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
2036 CPPUNIT_ASSERT_MESSAGE(
2037 "rtl::OUString",
2038 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
2041 css::uno::Type b(getCppuType< rtl::OUString >());
2042 CPPUNIT_ASSERT_MESSAGE(
2043 "css::uno::Type",
2044 !(a >>= b) && b == getCppuType< rtl::OUString >());
2047 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
2048 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2051 css::uno::Sequence< rtl::OUString > b(2);
2052 CPPUNIT_ASSERT_MESSAGE(
2053 "css::uno::Sequence<rtl::OUString>",
2054 !(a >>= b) && b.getLength() == 2);
2057 Enum1 b = Enum1_M2;
2058 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2061 Struct1 b(2);
2062 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2065 Exception1 b(
2066 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2067 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2070 Exception2 b(
2071 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2072 CPPUNIT_ASSERT_MESSAGE("Exception2", (a >>= b) && b.member == 1);
2075 Exception2a b(
2076 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2078 CPPUNIT_ASSERT_MESSAGE(
2079 "Exception2a", (a >>= b) && b.member == 1 && b.member2 == 3);
2082 Exception2b b(
2083 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2085 CPPUNIT_ASSERT_MESSAGE("Exception2b", !(a >>= b) && b.member == 2);
2088 css::uno::Reference< Interface1 > i(new Impl1);
2089 css::uno::Reference< Interface1 > b(i);
2090 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2094 void Test::testInterface() {
2095 css::uno::Reference< Interface2a > i2(new Impl2);
2096 css::uno::Any a(i2);
2097 CPPUNIT_ASSERT(
2098 a.getValueType()
2099 == getCppuType< css::uno::Reference< Interface2a > >());
2101 bool b = true;
2102 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2105 sal_Bool b = true;
2106 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2109 sal_Int8 b = 2;
2110 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2113 sal_uInt8 b = 2;
2114 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2117 sal_Int16 b = 2;
2118 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2121 sal_uInt16 b = 2;
2122 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2125 sal_Int32 b = 2;
2126 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2129 sal_uInt32 b = 2;
2130 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2133 sal_Int64 b = 2;
2134 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2137 sal_uInt64 b = 2;
2138 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2141 float b = 2;
2142 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2145 double b = 2;
2146 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2149 sal_Unicode b = '2';
2150 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2153 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
2154 CPPUNIT_ASSERT_MESSAGE(
2155 "rtl::OUString",
2156 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
2159 css::uno::Type b(getCppuType< rtl::OUString >());
2160 CPPUNIT_ASSERT_MESSAGE(
2161 "css::uno::Type",
2162 !(a >>= b) && b == getCppuType< rtl::OUString >());
2165 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
2166 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2169 css::uno::Sequence< rtl::OUString > b(2);
2170 CPPUNIT_ASSERT_MESSAGE(
2171 "css::uno::Sequence<rtl::OUString>",
2172 !(a >>= b) && b.getLength() == 2);
2175 Enum1 b = Enum1_M2;
2176 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2179 Struct1 b(2);
2180 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2183 Exception1 b(
2184 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2185 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2188 css::uno::Reference< Interface1 > i(new Impl1);
2189 css::uno::Reference< Interface1 > b(i);
2190 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2193 css::uno::Reference< Interface2 > b(new Impl2);
2194 CPPUNIT_ASSERT_MESSAGE("Interface2", (a >>= b) && b == i2);
2197 css::uno::Reference< Interface2a > b(new Impl2);
2198 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && b == i2);
2201 css::uno::Reference< Interface2b > i(new Impl2b);
2202 css::uno::Reference< Interface2b > b(i);
2203 CPPUNIT_ASSERT_MESSAGE("Interface2b", !(a >>= b) && b == i);
2206 css::uno::Reference< Interface3 > b(new Impl2);
2207 CPPUNIT_ASSERT_MESSAGE("Interface3", (a >>= b) && b == i2);
2211 void Test::testNull() {
2212 css::uno::Any a = css::uno::Any(css::uno::Reference< Interface2a >());
2213 CPPUNIT_ASSERT(
2214 a.getValueType()
2215 == getCppuType< css::uno::Reference< Interface2a > >());
2217 bool b = true;
2218 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2221 sal_Bool b = true;
2222 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2225 sal_Int8 b = 2;
2226 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2229 sal_uInt8 b = 2;
2230 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2233 sal_Int16 b = 2;
2234 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2237 sal_uInt16 b = 2;
2238 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2241 sal_Int32 b = 2;
2242 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2245 sal_uInt32 b = 2;
2246 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2249 sal_Int64 b = 2;
2250 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2253 sal_uInt64 b = 2;
2254 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2257 float b = 2;
2258 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2261 double b = 2;
2262 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2265 sal_Unicode b = '2';
2266 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2269 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
2270 CPPUNIT_ASSERT_MESSAGE(
2271 "rtl::OUString",
2272 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
2275 css::uno::Type b(getCppuType< rtl::OUString >());
2276 CPPUNIT_ASSERT_MESSAGE(
2277 "css::uno::Type",
2278 !(a >>= b) && b == getCppuType< rtl::OUString >());
2281 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
2282 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2285 css::uno::Sequence< rtl::OUString > b(2);
2286 CPPUNIT_ASSERT_MESSAGE(
2287 "css::uno::Sequence<rtl::OUString>",
2288 !(a >>= b) && b.getLength() == 2);
2291 Enum1 b = Enum1_M2;
2292 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2295 Struct1 b(2);
2296 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2299 Exception1 b(
2300 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2301 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2304 css::uno::Reference< Interface1 > b(new Impl1);
2305 CPPUNIT_ASSERT_MESSAGE(
2306 "Interface1", (a >>= b) && !b.is());
2309 css::uno::Reference< Interface2 > b(new Impl2);
2310 CPPUNIT_ASSERT_MESSAGE(
2311 "Interface2", (a >>= b) && !b.is());
2314 css::uno::Reference< Interface2a > b(new Impl2);
2315 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && !b.is());
2318 css::uno::Reference< Interface2b > b(new Impl2b);
2319 CPPUNIT_ASSERT_MESSAGE(
2320 "Interface2b", (a >>= b) && !b.is());
2323 css::uno::Reference< Interface3 > b(new Impl2);
2324 CPPUNIT_ASSERT_MESSAGE(
2325 "Interface3", (a >>= b) && !b.is());
2329 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(Test, "alltests");
2333 NOADDITIONAL;