Make the README.cross a bit more copy&paste proof
[LibreOffice.git] / cppu / qa / test_any.cxx
blobddee0fbc03ae38593481981c76a41af1f5a0064c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 // MARKER(update_precomp.py): autogen include statement, do not remove
30 #include "precompiled_cppu.hxx"
31 #include "sal/config.h"
32 #include "sal/precppunit.hxx"
34 #ifdef IOS
35 #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTest_qa_cppu_any
36 #endif
38 #include <stdlib.h> // wntmsci10 does not like <cstdlib>
40 #include <cppunit/TestSuite.h>
41 #include <cppunit/TestFixture.h>
42 #include <cppunit/TestCase.h>
43 #include <cppunit/plugin/TestPlugIn.h>
44 #include <cppunit/extensions/HelperMacros.h>
46 #include "Enum1.hpp"
47 #include "Enum2.hpp"
48 #include "Exception1.hpp"
49 #include "Exception2.hpp"
50 #include "Exception2a.hpp"
51 #include "Exception2b.hpp"
52 #include "Interface1.hpp"
53 #include "Interface2.hpp"
54 #include "Interface2a.hpp"
55 #include "Interface2b.hpp"
56 #include "Interface3.hpp"
57 #include "Poly.hpp"
58 #include "Struct1.hpp"
59 #include "Struct2.hpp"
60 #include "Struct2a.hpp"
61 #include "Struct2b.hpp"
62 #include "boost/type_traits/is_same.hpp"
63 #include "com/sun/star/uno/Any.hxx"
64 #include "com/sun/star/uno/Reference.hxx"
65 #include "com/sun/star/uno/RuntimeException.hpp"
66 #include "com/sun/star/uno/Sequence.hxx"
67 #include "com/sun/star/uno/Type.hxx"
68 #include "com/sun/star/uno/XInterface.hpp"
69 #include "osl/diagnose.h"
70 #include "osl/interlck.h"
71 #include "rtl/string.h"
72 #include "rtl/ustring.h"
73 #include "rtl/ustring.hxx"
74 #include "sal/types.h"
76 namespace {
78 namespace css = com::sun::star;
80 class Base {
81 public:
82 Base(): m_count(0) {}
84 void acquire() {
85 if (osl_incrementInterlockedCount(&m_count) == SAL_MAX_INT32) {
86 abort();
90 void release() {
91 if (osl_decrementInterlockedCount(&m_count) == 0) {
92 delete this;
96 protected:
97 virtual ~Base() {}
99 private:
100 Base(Base &); // not declared
101 void operator =(Base &); // not declared
103 oslInterlockedCount m_count;
106 class Impl1: public Interface1, private Base {
107 public:
108 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
109 throw (css::uno::RuntimeException)
111 if (type
112 == getCppuType< css::uno::Reference< css::uno::XInterface > >())
114 css::uno::Reference< css::uno::XInterface > ref(
115 static_cast< css::uno::XInterface * >(this));
116 return css::uno::Any(&ref, type);
117 } else if (type == getCppuType< css::uno::Reference< Interface1 > >()) {
118 css::uno::Reference< Interface1 > ref(this);
119 return css::uno::Any(&ref, type);
120 } else {
121 return css::uno::Any();
125 virtual void SAL_CALL acquire() throw () {
126 Base::acquire();
129 virtual void SAL_CALL release() throw () {
130 Base::release();
134 class Impl2: public Interface2a, public Interface3, private Base {
135 public:
136 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
137 throw (css::uno::RuntimeException)
139 if (type
140 == getCppuType< css::uno::Reference< css::uno::XInterface > >())
142 css::uno::Reference< css::uno::XInterface > ref(
143 static_cast< css::uno::XInterface * >(
144 static_cast< Interface2a * >(this)));
145 return css::uno::Any(&ref, type);
146 } else if (type == getCppuType< css::uno::Reference< Interface2 > >()) {
147 css::uno::Reference< Interface2 > ref(this);
148 return css::uno::Any(&ref, type);
149 } else if (type == getCppuType< css::uno::Reference< Interface2a > >())
151 css::uno::Reference< Interface2a > ref(this);
152 return css::uno::Any(&ref, type);
153 } else if (type == getCppuType< css::uno::Reference< Interface3 > >()) {
154 css::uno::Reference< Interface3 > ref(this);
155 return css::uno::Any(&ref, type);
156 } else {
157 return css::uno::Any();
161 virtual void SAL_CALL acquire() throw () {
162 Base::acquire();
165 virtual void SAL_CALL release() throw () {
166 Base::release();
170 class Impl2b: public Interface2b, private Base {
171 public:
172 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
173 throw (css::uno::RuntimeException)
175 if (type
176 == getCppuType< css::uno::Reference< css::uno::XInterface > >())
178 css::uno::Reference< css::uno::XInterface > ref(
179 static_cast< css::uno::XInterface * >(
180 static_cast< Interface2a * >(this)));
181 return css::uno::Any(&ref, type);
182 } else if (type == getCppuType< css::uno::Reference< Interface2 > >()) {
183 css::uno::Reference< Interface2 > ref(this);
184 return css::uno::Any(&ref, type);
185 } else if (type == getCppuType< css::uno::Reference< Interface2a > >())
187 css::uno::Reference< Interface2a > ref(this);
188 return css::uno::Any(&ref, type);
189 } else if (type == getCppuType< css::uno::Reference< Interface2b > >())
191 css::uno::Reference< Interface2b > ref(this);
192 return css::uno::Any(&ref, type);
193 } else {
194 return css::uno::Any();
198 virtual void SAL_CALL acquire() throw () {
199 Base::acquire();
202 virtual void SAL_CALL release() throw () {
203 Base::release();
207 class Test: public CppUnit::TestFixture {
208 public:
209 void testVoid();
210 void testBoolean();
211 void testByte();
212 void testShort();
213 void testUnsignedShort();
214 void testLong();
215 void testUnsignedLong();
216 void testHyper();
217 void testUnsignedHyper();
218 void testFloat();
219 void testDouble();
220 void testChar();
221 void testString();
222 void testType();
223 void testSequence();
224 void testEnum();
225 void testStruct();
226 void testPoly();
227 void testException();
228 void testInterface();
229 void testNull();
231 CPPUNIT_TEST_SUITE(Test);
232 CPPUNIT_TEST(testVoid);
233 CPPUNIT_TEST(testBoolean);
234 CPPUNIT_TEST(testByte);
235 CPPUNIT_TEST(testShort);
236 CPPUNIT_TEST(testUnsignedShort);
237 CPPUNIT_TEST(testLong);
238 CPPUNIT_TEST(testUnsignedLong);
239 CPPUNIT_TEST(testHyper);
240 CPPUNIT_TEST(testUnsignedHyper);
241 CPPUNIT_TEST(testFloat);
242 CPPUNIT_TEST(testDouble);
243 CPPUNIT_TEST(testChar);
244 CPPUNIT_TEST(testString);
245 CPPUNIT_TEST(testType);
246 CPPUNIT_TEST(testSequence);
247 CPPUNIT_TEST(testEnum);
248 CPPUNIT_TEST(testStruct);
249 CPPUNIT_TEST(testPoly);
250 CPPUNIT_TEST(testException);
251 CPPUNIT_TEST(testInterface);
252 CPPUNIT_TEST(testNull);
253 CPPUNIT_TEST_SUITE_END();
256 void Test::testVoid() {
257 css::uno::Any a;
258 CPPUNIT_ASSERT(a.getValueType() == getVoidCppuType());
260 bool b = true;
261 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
264 sal_Bool b = true;
265 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
268 sal_Int8 b = 2;
269 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
272 sal_uInt8 b = 2;
273 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
276 sal_Int16 b = 2;
277 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
280 sal_uInt16 b = 2;
281 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
284 sal_Int32 b = 2;
285 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
288 sal_uInt32 b = 2;
289 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
292 sal_Int64 b = 2;
293 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
296 sal_uInt64 b = 2;
297 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
300 float b = 2;
301 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
304 double b = 2;
305 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
308 sal_Unicode b = '2';
309 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
312 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
313 CPPUNIT_ASSERT_MESSAGE(
314 "rtl::OUString",
315 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
318 css::uno::Type b(getCppuType< rtl::OUString >());
319 CPPUNIT_ASSERT_MESSAGE(
320 "css::uno::Type",
321 !(a >>= b) && b == getCppuType< rtl::OUString >());
324 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
325 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
328 css::uno::Sequence< rtl::OUString > b(2);
329 CPPUNIT_ASSERT_MESSAGE(
330 "css::uno::Sequence<rtl::OUString>", !(a >>= b) && b.getLength() == 2);
333 Enum1 b = Enum1_M2;
334 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
337 Struct1 b(2);
338 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
341 Exception1 b(
342 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
343 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
346 css::uno::Reference< Interface1 > i(new Impl1);
347 css::uno::Reference< Interface1 > b(i);
348 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
352 void Test::testBoolean() {
353 css::uno::Any a(false);
354 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Bool >());
356 bool b = true;
357 CPPUNIT_ASSERT_MESSAGE("bool", (a >>= b) && !b);
360 sal_Bool b = true;
361 CPPUNIT_ASSERT_MESSAGE("sal_Bool", (a >>= b) && !b);
364 sal_Int8 b = 2;
365 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
368 sal_uInt8 b = 2;
369 if (boost::is_same< sal_uInt8, sal_Bool >::value) {
370 CPPUNIT_ASSERT_MESSAGE("@sal_uInt8", (a >>= b) && b == 0);
371 } else {
372 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
376 sal_Int16 b = 2;
377 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
380 sal_uInt16 b = 2;
381 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
384 sal_Int32 b = 2;
385 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
388 sal_uInt32 b = 2;
389 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
392 sal_Int64 b = 2;
393 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
396 sal_uInt64 b = 2;
397 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
400 float b = 2;
401 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
404 double b = 2;
405 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
408 sal_Unicode b = '2';
409 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
412 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
413 CPPUNIT_ASSERT_MESSAGE(
414 "rtl::OUString",
415 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
418 css::uno::Type b(getCppuType< rtl::OUString >());
419 CPPUNIT_ASSERT_MESSAGE(
420 "css::uno::Type",
421 !(a >>= b) && b == getCppuType< rtl::OUString >());
424 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
425 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
428 css::uno::Sequence< rtl::OUString > b(2);
429 CPPUNIT_ASSERT_MESSAGE(
430 "css::uno::Sequence<rtl::OUString>",
431 !(a >>= b) && b.getLength() == 2);
434 Enum1 b = Enum1_M2;
435 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
438 Struct1 b(2);
439 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
442 Exception1 b(
443 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
444 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
447 css::uno::Reference< Interface1 > i(new Impl1);
448 css::uno::Reference< Interface1 > b(i);
449 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
453 void Test::testByte() {
454 css::uno::Any a(static_cast< sal_Int8 >(1));
455 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int8 >());
457 bool b = true;
458 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
461 sal_Bool b = true;
462 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
465 sal_Int8 b = 2;
466 CPPUNIT_ASSERT_MESSAGE("sal_Int8", (a >>= b) && b == 1);
469 sal_uInt8 b = 2;
470 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
473 sal_Int16 b = 2;
474 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
477 sal_uInt16 b = 2;
478 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
481 sal_Int32 b = 2;
482 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
485 sal_uInt32 b = 2;
486 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
489 sal_Int64 b = 2;
490 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
493 sal_uInt64 b = 2;
494 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
497 float b = 2;
498 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
501 double b = 2;
502 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
505 sal_Unicode b = '2';
506 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
507 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
508 } else {
509 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
513 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
514 CPPUNIT_ASSERT_MESSAGE(
515 "rtl::OUString",
516 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
519 css::uno::Type b(getCppuType< rtl::OUString >());
520 CPPUNIT_ASSERT_MESSAGE(
521 "css::uno::Type",
522 !(a >>= b) && b == getCppuType< rtl::OUString >());
525 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
526 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
529 css::uno::Sequence< rtl::OUString > b(2);
530 CPPUNIT_ASSERT_MESSAGE(
531 "css::uno::Sequence<rtl::OUString>",
532 !(a >>= b) && b.getLength() == 2);
535 Enum1 b = Enum1_M2;
536 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
539 Struct1 b(2);
540 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
543 Exception1 b(
544 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
545 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
548 css::uno::Reference< Interface1 > i(new Impl1);
549 css::uno::Reference< Interface1 > b(i);
550 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
554 void Test::testShort() {
555 css::uno::Any a(static_cast< sal_Int16 >(1));
556 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int16 >());
558 bool b = true;
559 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
562 sal_Bool b = true;
563 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
566 sal_Int8 b = 2;
567 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
570 sal_uInt8 b = 2;
571 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
574 sal_Int16 b = 2;
575 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
578 sal_uInt16 b = 2;
579 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
582 sal_Int32 b = 2;
583 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
586 sal_uInt32 b = 2;
587 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
590 sal_Int64 b = 2;
591 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
594 sal_uInt64 b = 2;
595 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
598 float b = 2;
599 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
602 double b = 2;
603 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
606 sal_Unicode b = '2';
607 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
608 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
609 } else {
610 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
614 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
615 CPPUNIT_ASSERT_MESSAGE(
616 "rtl::OUString",
617 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
620 css::uno::Type b(getCppuType< rtl::OUString >());
621 CPPUNIT_ASSERT_MESSAGE(
622 "css::uno::Type",
623 !(a >>= b) && b == getCppuType< rtl::OUString >());
626 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
627 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
630 css::uno::Sequence< rtl::OUString > b(2);
631 CPPUNIT_ASSERT_MESSAGE(
632 "css::uno::Sequence<rtl::OUString>",
633 !(a >>= b) && b.getLength() == 2);
636 Enum1 b = Enum1_M2;
637 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
640 Struct1 b(2);
641 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
644 Exception1 b(
645 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
646 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
649 css::uno::Reference< Interface1 > i(new Impl1);
650 css::uno::Reference< Interface1 > b(i);
651 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
655 void Test::testUnsignedShort() {
656 sal_uInt16 n = 1;
657 css::uno::Any a(&n, getCppuType(static_cast< sal_uInt16 const * >(0)));
658 CPPUNIT_ASSERT(
659 a.getValueType() == getCppuType(static_cast< sal_uInt16 const * >(0)));
661 bool b = true;
662 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
665 sal_Bool b = true;
666 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
669 sal_Int8 b = 2;
670 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
673 sal_uInt8 b = 2;
674 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
677 sal_Int16 b = 2;
678 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
681 sal_uInt16 b = 2;
682 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
685 sal_Int32 b = 2;
686 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
689 sal_uInt32 b = 2;
690 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
693 sal_Int64 b = 2;
694 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
697 sal_uInt64 b = 2;
698 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
701 float b = 2;
702 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
705 double b = 2;
706 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
709 sal_Unicode b = '2';
710 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
711 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
712 } else {
713 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
717 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
718 CPPUNIT_ASSERT_MESSAGE(
719 "rtl::OUString",
720 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
723 css::uno::Type b(getCppuType< rtl::OUString >());
724 CPPUNIT_ASSERT_MESSAGE(
725 "css::uno::Type",
726 !(a >>= b) && b == getCppuType< rtl::OUString >());
729 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
730 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
733 css::uno::Sequence< rtl::OUString > b(2);
734 CPPUNIT_ASSERT_MESSAGE(
735 "css::uno::Sequence<rtl::OUString>",
736 !(a >>= b) && b.getLength() == 2);
739 Enum1 b = Enum1_M2;
740 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
743 Struct1 b(2);
744 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
747 Exception1 b(
748 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
749 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
752 css::uno::Reference< Interface1 > i(new Impl1);
753 css::uno::Reference< Interface1 > b(i);
754 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
758 void Test::testLong() {
759 css::uno::Any a(static_cast< sal_Int32 >(1));
760 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int32 >());
762 bool b = true;
763 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
766 sal_Bool b = true;
767 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
770 sal_Int8 b = 2;
771 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
774 sal_uInt8 b = 2;
775 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
778 sal_Int16 b = 2;
779 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
782 sal_uInt16 b = 2;
783 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
786 sal_Int32 b = 2;
787 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
790 sal_uInt32 b = 2;
791 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
794 sal_Int64 b = 2;
795 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
798 sal_uInt64 b = 2;
799 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
802 float b = 2;
803 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
806 double b = 2;
807 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
810 sal_Unicode b = '2';
811 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
814 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
815 CPPUNIT_ASSERT_MESSAGE(
816 "rtl::OUString",
817 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
820 css::uno::Type b(getCppuType< rtl::OUString >());
821 CPPUNIT_ASSERT_MESSAGE(
822 "css::uno::Type",
823 !(a >>= b) && b == getCppuType< rtl::OUString >());
826 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
827 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
830 css::uno::Sequence< rtl::OUString > b(2);
831 CPPUNIT_ASSERT_MESSAGE(
832 "css::uno::Sequence<rtl::OUString>",
833 !(a >>= b) && b.getLength() == 2);
836 Enum1 b = Enum1_M2;
837 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
840 Struct1 b(2);
841 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
844 Exception1 b(
845 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
846 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
849 css::uno::Reference< Interface1 > i(new Impl1);
850 css::uno::Reference< Interface1 > b(i);
851 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
855 void Test::testUnsignedLong() {
856 css::uno::Any a(static_cast< sal_uInt32 >(1));
857 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_uInt32 >());
859 bool b = true;
860 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
863 sal_Bool b = true;
864 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
867 sal_Int8 b = 2;
868 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
871 sal_uInt8 b = 2;
872 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
875 sal_Int16 b = 2;
876 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
879 sal_uInt16 b = 2;
880 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
883 sal_Int32 b = 2;
884 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
887 sal_uInt32 b = 2;
888 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
891 sal_Int64 b = 2;
892 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
895 sal_uInt64 b = 2;
896 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
899 float b = 2;
900 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
903 double b = 2;
904 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
907 sal_Unicode b = '2';
908 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
911 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
912 CPPUNIT_ASSERT_MESSAGE(
913 "rtl::OUString",
914 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
917 css::uno::Type b(getCppuType< rtl::OUString >());
918 CPPUNIT_ASSERT_MESSAGE(
919 "css::uno::Type",
920 !(a >>= b) && b == getCppuType< rtl::OUString >());
923 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
924 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
927 css::uno::Sequence< rtl::OUString > b(2);
928 CPPUNIT_ASSERT_MESSAGE(
929 "css::uno::Sequence<rtl::OUString>",
930 !(a >>= b) && b.getLength() == 2);
933 Enum1 b = Enum1_M2;
934 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
937 Struct1 b(2);
938 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
941 Exception1 b(
942 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
943 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
946 css::uno::Reference< Interface1 > i(new Impl1);
947 css::uno::Reference< Interface1 > b(i);
948 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
952 void Test::testHyper() {
953 css::uno::Any a(static_cast< sal_Int64 >(1));
954 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int64 >());
956 bool b = true;
957 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
960 sal_Bool b = true;
961 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
964 sal_Int8 b = 2;
965 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
968 sal_uInt8 b = 2;
969 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
972 sal_Int16 b = 2;
973 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
976 sal_uInt16 b = 2;
977 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
980 sal_Int32 b = 2;
981 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
984 sal_uInt32 b = 2;
985 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
988 sal_Int64 b = 2;
989 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
992 sal_uInt64 b = 2;
993 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
996 float b = 2;
997 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1000 double b = 2;
1001 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1004 sal_Unicode b = '2';
1005 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1008 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1009 CPPUNIT_ASSERT_MESSAGE(
1010 "rtl::OUString",
1011 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1014 css::uno::Type b(getCppuType< rtl::OUString >());
1015 CPPUNIT_ASSERT_MESSAGE(
1016 "css::uno::Type",
1017 !(a >>= b) && b == getCppuType< rtl::OUString >());
1020 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1021 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1024 css::uno::Sequence< rtl::OUString > b(2);
1025 CPPUNIT_ASSERT_MESSAGE(
1026 "css::uno::Sequence<rtl::OUString>",
1027 !(a >>= b) && b.getLength() == 2);
1030 Enum1 b = Enum1_M2;
1031 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1034 Struct1 b(2);
1035 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1038 Exception1 b(
1039 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1040 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1043 css::uno::Reference< Interface1 > i(new Impl1);
1044 css::uno::Reference< Interface1 > b(i);
1045 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1049 void Test::testUnsignedHyper() {
1050 css::uno::Any a(static_cast< sal_uInt64 >(1));
1051 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_uInt64 >());
1053 bool b = true;
1054 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1057 sal_Bool b = true;
1058 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1061 sal_Int8 b = 2;
1062 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1065 sal_uInt8 b = 2;
1066 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1069 sal_Int16 b = 2;
1070 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1073 sal_uInt16 b = 2;
1074 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1077 sal_Int32 b = 2;
1078 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1081 sal_uInt32 b = 2;
1082 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1085 sal_Int64 b = 2;
1086 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
1089 sal_uInt64 b = 2;
1090 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
1093 float b = 2;
1094 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1097 double b = 2;
1098 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1101 sal_Unicode b = '2';
1102 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1105 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1106 CPPUNIT_ASSERT_MESSAGE(
1107 "rtl::OUString",
1108 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1111 css::uno::Type b(getCppuType< rtl::OUString >());
1112 CPPUNIT_ASSERT_MESSAGE(
1113 "css::uno::Type",
1114 !(a >>= b) && b == getCppuType< rtl::OUString >());
1117 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1118 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1121 css::uno::Sequence< rtl::OUString > b(2);
1122 CPPUNIT_ASSERT_MESSAGE(
1123 "css::uno::Sequence<rtl::OUString>",
1124 !(a >>= b) && b.getLength() == 2);
1127 Enum1 b = Enum1_M2;
1128 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1131 Struct1 b(2);
1132 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1135 Exception1 b(
1136 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1137 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1140 css::uno::Reference< Interface1 > i(new Impl1);
1141 css::uno::Reference< Interface1 > b(i);
1142 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1146 void Test::testFloat() {
1147 css::uno::Any a(1.f);
1148 CPPUNIT_ASSERT(a.getValueType() == getCppuType< float >());
1150 bool b = true;
1151 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1154 sal_Bool b = true;
1155 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1158 sal_Int8 b = 2;
1159 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1162 sal_uInt8 b = 2;
1163 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1166 sal_Int16 b = 2;
1167 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1170 sal_uInt16 b = 2;
1171 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1174 sal_Int32 b = 2;
1175 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1178 sal_uInt32 b = 2;
1179 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1182 sal_Int64 b = 2;
1183 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1186 sal_uInt64 b = 2;
1187 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1190 float b = 2;
1191 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
1194 double b = 2;
1195 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1198 sal_Unicode b = '2';
1199 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1202 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1203 CPPUNIT_ASSERT_MESSAGE(
1204 "rtl::OUString",
1205 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1208 css::uno::Type b(getCppuType< rtl::OUString >());
1209 CPPUNIT_ASSERT_MESSAGE(
1210 "css::uno::Type",
1211 !(a >>= b) && b == getCppuType< rtl::OUString >());
1214 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1215 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1218 css::uno::Sequence< rtl::OUString > b(2);
1219 CPPUNIT_ASSERT_MESSAGE(
1220 "css::uno::Sequence<rtl::OUString>",
1221 !(a >>= b) && b.getLength() == 2);
1224 Enum1 b = Enum1_M2;
1225 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1228 Struct1 b(2);
1229 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1232 Exception1 b(
1233 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1234 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1237 css::uno::Reference< Interface1 > i(new Impl1);
1238 css::uno::Reference< Interface1 > b(i);
1239 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1243 void Test::testDouble() {
1244 css::uno::Any a(1.);
1245 CPPUNIT_ASSERT(a.getValueType() == getCppuType< double >());
1247 bool b = true;
1248 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1251 sal_Bool b = true;
1252 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1255 sal_Int8 b = 2;
1256 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1259 sal_uInt8 b = 2;
1260 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1263 sal_Int16 b = 2;
1264 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1267 sal_uInt16 b = 2;
1268 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1271 sal_Int32 b = 2;
1272 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1275 sal_uInt32 b = 2;
1276 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1279 sal_Int64 b = 2;
1280 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1283 sal_uInt64 b = 2;
1284 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1287 float b = 2;
1288 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1291 double b = 2;
1292 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1295 sal_Unicode b = '2';
1296 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1299 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1300 CPPUNIT_ASSERT_MESSAGE(
1301 "rtl::OUString",
1302 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1305 css::uno::Type b(getCppuType< rtl::OUString >());
1306 CPPUNIT_ASSERT_MESSAGE(
1307 "css::uno::Type",
1308 !(a >>= b) && b == getCppuType< rtl::OUString >());
1311 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1312 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1315 css::uno::Sequence< rtl::OUString > b(2);
1316 CPPUNIT_ASSERT_MESSAGE(
1317 "css::uno::Sequence<rtl::OUString>",
1318 !(a >>= b) && b.getLength() == 2);
1321 Enum1 b = Enum1_M2;
1322 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1325 Struct1 b(2);
1326 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1329 Exception1 b(
1330 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1331 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1334 css::uno::Reference< Interface1 > i(new Impl1);
1335 css::uno::Reference< Interface1 > b(i);
1336 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1340 void Test::testChar() {
1341 sal_Unicode c = '1';
1342 css::uno::Any a(&c, getCppuType< sal_Unicode >());
1343 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Unicode >());
1345 bool b = true;
1346 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1349 sal_Bool b = true;
1350 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1353 sal_Int8 b = 2;
1354 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1357 sal_uInt8 b = 2;
1358 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1361 sal_Int16 b = 2;
1362 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1365 sal_uInt16 b = 2;
1366 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1369 sal_Int32 b = 2;
1370 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1373 sal_uInt32 b = 2;
1374 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1377 sal_Int64 b = 2;
1378 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1381 sal_uInt64 b = 2;
1382 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1385 float b = 2;
1386 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1389 double b = 2;
1390 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1393 sal_Unicode b = '2';
1394 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
1395 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", !(a >>= b) && b == '2');
1396 } else {
1397 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", (a >>= b) && b == '1');
1401 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1402 CPPUNIT_ASSERT_MESSAGE(
1403 "rtl::OUString",
1404 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1407 css::uno::Type b(getCppuType< rtl::OUString >());
1408 CPPUNIT_ASSERT_MESSAGE(
1409 "css::uno::Type",
1410 !(a >>= b) && b == getCppuType< rtl::OUString >());
1413 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1414 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1417 css::uno::Sequence< rtl::OUString > b(2);
1418 CPPUNIT_ASSERT_MESSAGE(
1419 "css::uno::Sequence<rtl::OUString>",
1420 !(a >>= b) && b.getLength() == 2);
1423 Enum1 b = Enum1_M2;
1424 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1427 Struct1 b(2);
1428 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1431 Exception1 b(
1432 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1433 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1436 css::uno::Reference< Interface1 > i(new Impl1);
1437 css::uno::Reference< Interface1 > b(i);
1438 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1442 void Test::testString() {
1443 css::uno::Any a(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("1")));
1444 CPPUNIT_ASSERT(a.getValueType() == getCppuType< rtl::OUString >());
1446 bool b = true;
1447 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1450 sal_Bool b = true;
1451 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1454 sal_Int8 b = 2;
1455 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1458 sal_uInt8 b = 2;
1459 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1462 sal_Int16 b = 2;
1463 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1466 sal_uInt16 b = 2;
1467 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1470 sal_Int32 b = 2;
1471 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1474 sal_uInt32 b = 2;
1475 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1478 sal_Int64 b = 2;
1479 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1482 sal_uInt64 b = 2;
1483 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1486 float b = 2;
1487 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1490 double b = 2;
1491 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1494 sal_Unicode b = '2';
1495 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1498 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1499 CPPUNIT_ASSERT_MESSAGE(
1500 "rtl::OUString",
1501 (a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("1")));
1504 css::uno::Type b(getCppuType< rtl::OUString >());
1505 CPPUNIT_ASSERT_MESSAGE(
1506 "css::uno::Type",
1507 !(a >>= b) && b == getCppuType< rtl::OUString >());
1510 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1511 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1514 css::uno::Sequence< rtl::OUString > b(2);
1515 CPPUNIT_ASSERT_MESSAGE(
1516 "css::uno::Sequence<rtl::OUString>",
1517 !(a >>= b) && b.getLength() == 2);
1520 Enum1 b = Enum1_M2;
1521 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1524 Struct1 b(2);
1525 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1528 Exception1 b(
1529 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1530 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1533 css::uno::Reference< Interface1 > i(new Impl1);
1534 css::uno::Reference< Interface1 > b(i);
1535 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1539 void Test::testType() {
1540 css::uno::Any a(getCppuType< sal_Int32 >());
1541 CPPUNIT_ASSERT(a.getValueType() == getCppuType< css::uno::Type >());
1543 bool b = true;
1544 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1547 sal_Bool b = true;
1548 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1551 sal_Int8 b = 2;
1552 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1555 sal_uInt8 b = 2;
1556 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1559 sal_Int16 b = 2;
1560 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1563 sal_uInt16 b = 2;
1564 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1567 sal_Int32 b = 2;
1568 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1571 sal_uInt32 b = 2;
1572 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1575 sal_Int64 b = 2;
1576 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1579 sal_uInt64 b = 2;
1580 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1583 float b = 2;
1584 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1587 double b = 2;
1588 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1591 sal_Unicode b = '2';
1592 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1595 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1596 CPPUNIT_ASSERT_MESSAGE(
1597 "rtl::OUString",
1598 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1601 css::uno::Type b(getCppuType< rtl::OUString >());
1602 CPPUNIT_ASSERT_MESSAGE(
1603 "css::uno::Type", (a >>= b) && b == getCppuType< sal_Int32 >());
1606 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1607 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1610 css::uno::Sequence< rtl::OUString > b(2);
1611 CPPUNIT_ASSERT_MESSAGE(
1612 "css::uno::Sequence<rtl::OUString>",
1613 !(a >>= b) && b.getLength() == 2);
1616 Enum1 b = Enum1_M2;
1617 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1620 Struct1 b(2);
1621 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1624 Exception1 b(
1625 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1626 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1629 css::uno::Reference< Interface1 > i(new Impl1);
1630 css::uno::Reference< Interface1 > b(i);
1631 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1635 void Test::testSequence() {
1636 sal_Int32 n = 1;
1637 css::uno::Any a(css::uno::Sequence< sal_Int32 >(&n, 1));
1638 CPPUNIT_ASSERT(
1639 a.getValueType() == getCppuType< css::uno::Sequence< sal_Int32 > >());
1641 bool b = true;
1642 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1645 sal_Bool b = true;
1646 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1649 sal_Int8 b = 2;
1650 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1653 sal_uInt8 b = 2;
1654 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1657 sal_Int16 b = 2;
1658 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1661 sal_uInt16 b = 2;
1662 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1665 sal_Int32 b = 2;
1666 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1669 sal_uInt32 b = 2;
1670 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1673 sal_Int64 b = 2;
1674 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1677 sal_uInt64 b = 2;
1678 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1681 float b = 2;
1682 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1685 double b = 2;
1686 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1689 sal_Unicode b = '2';
1690 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1693 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1694 CPPUNIT_ASSERT_MESSAGE(
1695 "rtl::OUString",
1696 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1699 css::uno::Type b(getCppuType< rtl::OUString >());
1700 CPPUNIT_ASSERT_MESSAGE(
1701 "css::uno::Type",
1702 !(a >>= b) && b == getCppuType< rtl::OUString >());
1705 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1706 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1709 css::uno::Sequence< rtl::OUString > b(2);
1710 CPPUNIT_ASSERT_MESSAGE(
1711 "css::uno::Sequence<rtl::OUString>",
1712 !(a >>= b) && b.getLength() == 2);
1715 css::uno::Sequence< sal_Int32 > b(2);
1716 CPPUNIT_ASSERT_MESSAGE(
1717 "css::uno::Sequence<sal_Int32>",
1718 (a >>= b) && b.getLength() == 1 && b[0] == 1);
1721 Enum1 b = Enum1_M2;
1722 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1725 Struct1 b(2);
1726 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1729 Exception1 b(
1730 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1731 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1734 css::uno::Reference< Interface1 > i(new Impl1);
1735 css::uno::Reference< Interface1 > b(i);
1736 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1740 void Test::testEnum() {
1741 css::uno::Any a(Enum2_M1);
1742 CPPUNIT_ASSERT(a.getValueType() == getCppuType< Enum2 >());
1744 bool b = true;
1745 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1748 sal_Bool b = true;
1749 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1752 sal_Int8 b = 2;
1753 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1756 sal_uInt8 b = 2;
1757 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1760 sal_Int16 b = 2;
1761 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1764 sal_uInt16 b = 2;
1765 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1768 sal_Int32 b = 2;
1769 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1772 sal_uInt32 b = 2;
1773 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1776 sal_Int64 b = 2;
1777 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1780 sal_uInt64 b = 2;
1781 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1784 float b = 2;
1785 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1788 double b = 2;
1789 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1792 sal_Unicode b = '2';
1793 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1796 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1797 CPPUNIT_ASSERT_MESSAGE(
1798 "rtl::OUString",
1799 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1802 css::uno::Type b(getCppuType< rtl::OUString >());
1803 CPPUNIT_ASSERT_MESSAGE(
1804 "css::uno::Type",
1805 !(a >>= b) && b == getCppuType< rtl::OUString >());
1808 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1809 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1812 css::uno::Sequence< rtl::OUString > b(2);
1813 CPPUNIT_ASSERT_MESSAGE(
1814 "css::uno::Sequence<rtl::OUString>",
1815 !(a >>= b) && b.getLength() == 2);
1818 Enum1 b = Enum1_M2;
1819 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1822 Enum2 b = Enum2_M2;
1823 CPPUNIT_ASSERT_MESSAGE("Enum2", (a >>= b) && b == Enum2_M1);
1826 Struct1 b(2);
1827 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1830 Exception1 b(
1831 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1832 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1835 css::uno::Reference< Interface1 > i(new Impl1);
1836 css::uno::Reference< Interface1 > b(i);
1837 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1841 void Test::testStruct() {
1842 css::uno::Any a(Struct2a(1, 3));
1843 CPPUNIT_ASSERT(a.getValueType() == getCppuType< Struct2a >());
1845 bool b = true;
1846 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1849 sal_Bool b = true;
1850 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1853 sal_Int8 b = 2;
1854 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1857 sal_uInt8 b = 2;
1858 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1861 sal_Int16 b = 2;
1862 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1865 sal_uInt16 b = 2;
1866 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1869 sal_Int32 b = 2;
1870 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1873 sal_uInt32 b = 2;
1874 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1877 sal_Int64 b = 2;
1878 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1881 sal_uInt64 b = 2;
1882 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1885 float b = 2;
1886 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1889 double b = 2;
1890 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1893 sal_Unicode b = '2';
1894 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1897 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
1898 CPPUNIT_ASSERT_MESSAGE(
1899 "rtl::OUString",
1900 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
1903 css::uno::Type b(getCppuType< rtl::OUString >());
1904 CPPUNIT_ASSERT_MESSAGE(
1905 "css::uno::Type",
1906 !(a >>= b) && b == getCppuType< rtl::OUString >());
1909 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
1910 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1913 css::uno::Sequence< rtl::OUString > b(2);
1914 CPPUNIT_ASSERT_MESSAGE(
1915 "css::uno::Sequence<rtl::OUString>",
1916 !(a >>= b) && b.getLength() == 2);
1919 Enum1 b = Enum1_M2;
1920 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1923 Struct1 b(2);
1924 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1927 Struct2 b(2);
1928 CPPUNIT_ASSERT_MESSAGE("Struct2", (a >>= b) && b.member == 1);
1931 Struct2a b(2, 2);
1932 CPPUNIT_ASSERT_MESSAGE(
1933 "Struct2a", (a >>= b) && b.member == 1 && b.member2 == 3);
1936 Struct2b b(2, 2, 2);
1937 CPPUNIT_ASSERT_MESSAGE("Struct2b", !(a >>= b) && b.member == 2);
1940 Exception1 b(
1941 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1942 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1945 css::uno::Reference< Interface1 > i(new Impl1);
1946 css::uno::Reference< Interface1 > b(i);
1947 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1951 void Test::testPoly() {
1952 css::uno::Any a;
1953 a <<= Poly< css::uno::Sequence< ::sal_Unicode > >();
1954 CPPUNIT_ASSERT_MESSAGE(
1955 "type name",
1956 a.getValueType().getTypeName().equalsAsciiL(
1957 RTL_CONSTASCII_STRINGPARAM("Poly<[]char>")));
1958 CPPUNIT_ASSERT_MESSAGE(
1959 "constructor",
1960 a == css::uno::Any(Poly< css::uno::Sequence< ::sal_Unicode > >()));
1963 void Test::testException() {
1964 css::uno::Any a(
1965 Exception2a(
1966 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 1,
1967 3));
1968 CPPUNIT_ASSERT(a.getValueType() == getCppuType< Exception2a >());
1970 bool b = true;
1971 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1974 sal_Bool b = true;
1975 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1978 sal_Int8 b = 2;
1979 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1982 sal_uInt8 b = 2;
1983 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1986 sal_Int16 b = 2;
1987 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1990 sal_uInt16 b = 2;
1991 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1994 sal_Int32 b = 2;
1995 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1998 sal_uInt32 b = 2;
1999 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2002 sal_Int64 b = 2;
2003 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2006 sal_uInt64 b = 2;
2007 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2010 float b = 2;
2011 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2014 double b = 2;
2015 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2018 sal_Unicode b = '2';
2019 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2022 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
2023 CPPUNIT_ASSERT_MESSAGE(
2024 "rtl::OUString",
2025 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
2028 css::uno::Type b(getCppuType< rtl::OUString >());
2029 CPPUNIT_ASSERT_MESSAGE(
2030 "css::uno::Type",
2031 !(a >>= b) && b == getCppuType< rtl::OUString >());
2034 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
2035 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2038 css::uno::Sequence< rtl::OUString > b(2);
2039 CPPUNIT_ASSERT_MESSAGE(
2040 "css::uno::Sequence<rtl::OUString>",
2041 !(a >>= b) && b.getLength() == 2);
2044 Enum1 b = Enum1_M2;
2045 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2048 Struct1 b(2);
2049 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2052 Exception1 b(
2053 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2054 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2057 Exception2 b(
2058 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2059 CPPUNIT_ASSERT_MESSAGE("Exception2", (a >>= b) && b.member == 1);
2062 Exception2a b(
2063 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2065 CPPUNIT_ASSERT_MESSAGE(
2066 "Exception2a", (a >>= b) && b.member == 1 && b.member2 == 3);
2069 Exception2b b(
2070 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2072 CPPUNIT_ASSERT_MESSAGE("Exception2b", !(a >>= b) && b.member == 2);
2075 css::uno::Reference< Interface1 > i(new Impl1);
2076 css::uno::Reference< Interface1 > b(i);
2077 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2081 void Test::testInterface() {
2082 css::uno::Reference< Interface2a > i2(new Impl2);
2083 css::uno::Any a(i2);
2084 CPPUNIT_ASSERT(
2085 a.getValueType()
2086 == getCppuType< css::uno::Reference< Interface2a > >());
2088 bool b = true;
2089 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2092 sal_Bool b = true;
2093 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2096 sal_Int8 b = 2;
2097 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2100 sal_uInt8 b = 2;
2101 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2104 sal_Int16 b = 2;
2105 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2108 sal_uInt16 b = 2;
2109 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2112 sal_Int32 b = 2;
2113 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2116 sal_uInt32 b = 2;
2117 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2120 sal_Int64 b = 2;
2121 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2124 sal_uInt64 b = 2;
2125 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2128 float b = 2;
2129 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2132 double b = 2;
2133 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2136 sal_Unicode b = '2';
2137 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2140 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
2141 CPPUNIT_ASSERT_MESSAGE(
2142 "rtl::OUString",
2143 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
2146 css::uno::Type b(getCppuType< rtl::OUString >());
2147 CPPUNIT_ASSERT_MESSAGE(
2148 "css::uno::Type",
2149 !(a >>= b) && b == getCppuType< rtl::OUString >());
2152 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
2153 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2156 css::uno::Sequence< rtl::OUString > b(2);
2157 CPPUNIT_ASSERT_MESSAGE(
2158 "css::uno::Sequence<rtl::OUString>",
2159 !(a >>= b) && b.getLength() == 2);
2162 Enum1 b = Enum1_M2;
2163 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2166 Struct1 b(2);
2167 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2170 Exception1 b(
2171 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2172 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2175 css::uno::Reference< Interface1 > i(new Impl1);
2176 css::uno::Reference< Interface1 > b(i);
2177 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2180 css::uno::Reference< Interface2 > b(new Impl2);
2181 CPPUNIT_ASSERT_MESSAGE("Interface2", (a >>= b) && b == i2);
2184 css::uno::Reference< Interface2a > b(new Impl2);
2185 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && b == i2);
2188 css::uno::Reference< Interface2b > i(new Impl2b);
2189 css::uno::Reference< Interface2b > b(i);
2190 CPPUNIT_ASSERT_MESSAGE("Interface2b", !(a >>= b) && b == i);
2193 css::uno::Reference< Interface3 > b(new Impl2);
2194 CPPUNIT_ASSERT_MESSAGE("Interface3", (a >>= b) && b == i2);
2198 void Test::testNull() {
2199 css::uno::Any a = css::uno::Any(css::uno::Reference< Interface2a >());
2200 CPPUNIT_ASSERT(
2201 a.getValueType()
2202 == getCppuType< css::uno::Reference< Interface2a > >());
2204 bool b = true;
2205 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2208 sal_Bool b = true;
2209 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2212 sal_Int8 b = 2;
2213 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2216 sal_uInt8 b = 2;
2217 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2220 sal_Int16 b = 2;
2221 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2224 sal_uInt16 b = 2;
2225 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2228 sal_Int32 b = 2;
2229 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2232 sal_uInt32 b = 2;
2233 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2236 sal_Int64 b = 2;
2237 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2240 sal_uInt64 b = 2;
2241 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2244 float b = 2;
2245 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2248 double b = 2;
2249 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2252 sal_Unicode b = '2';
2253 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2256 rtl::OUString b(RTL_CONSTASCII_USTRINGPARAM("2"));
2257 CPPUNIT_ASSERT_MESSAGE(
2258 "rtl::OUString",
2259 !(a >>= b) && b.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("2")));
2262 css::uno::Type b(getCppuType< rtl::OUString >());
2263 CPPUNIT_ASSERT_MESSAGE(
2264 "css::uno::Type",
2265 !(a >>= b) && b == getCppuType< rtl::OUString >());
2268 css::uno::Any b(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("2")));
2269 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2272 css::uno::Sequence< rtl::OUString > b(2);
2273 CPPUNIT_ASSERT_MESSAGE(
2274 "css::uno::Sequence<rtl::OUString>",
2275 !(a >>= b) && b.getLength() == 2);
2278 Enum1 b = Enum1_M2;
2279 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2282 Struct1 b(2);
2283 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2286 Exception1 b(
2287 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2288 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2291 css::uno::Reference< Interface1 > b(new Impl1);
2292 CPPUNIT_ASSERT_MESSAGE(
2293 "Interface1", (a >>= b) && !b.is());
2296 css::uno::Reference< Interface2 > b(new Impl2);
2297 CPPUNIT_ASSERT_MESSAGE(
2298 "Interface2", (a >>= b) && !b.is());
2301 css::uno::Reference< Interface2a > b(new Impl2);
2302 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && !b.is());
2305 css::uno::Reference< Interface2b > b(new Impl2b);
2306 CPPUNIT_ASSERT_MESSAGE(
2307 "Interface2b", (a >>= b) && !b.is());
2310 css::uno::Reference< Interface3 > b(new Impl2);
2311 CPPUNIT_ASSERT_MESSAGE(
2312 "Interface3", (a >>= b) && !b.is());
2316 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
2320 CPPUNIT_PLUGIN_IMPLEMENT();
2322 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */