Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / cppu / qa / test_any.cxx
blobf9acf9dd23c9c4a3d434a940e5ff056b3ccb72db
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/types.h>
22 #include <stdlib.h>
24 #include <cppunit/TestSuite.h>
25 #include <cppunit/TestFixture.h>
26 #include <cppunit/TestCase.h>
27 #include <cppunit/plugin/TestPlugIn.h>
28 #include <cppunit/extensions/HelperMacros.h>
30 #include "Enum1.hpp"
31 #include "Enum2.hpp"
32 #include "Exception1.hpp"
33 #include "Exception2.hpp"
34 #include "Exception2a.hpp"
35 #include "Exception2b.hpp"
36 #include "Interface1.hpp"
37 #include "Interface2.hpp"
38 #include "Interface2a.hpp"
39 #include "Interface2b.hpp"
40 #include "Interface3.hpp"
41 #include "Poly.hpp"
42 #include "Struct1.hpp"
43 #include "Struct2.hpp"
44 #include "Struct2a.hpp"
45 #include "Struct2b.hpp"
46 #include "boost/type_traits/is_same.hpp"
47 #include "com/sun/star/uno/Any.hxx"
48 #include "com/sun/star/uno/Reference.hxx"
49 #include "com/sun/star/uno/RuntimeException.hpp"
50 #include "com/sun/star/uno/Sequence.hxx"
51 #include "com/sun/star/uno/Type.hxx"
52 #include "com/sun/star/uno/XInterface.hpp"
53 #include "osl/diagnose.h"
54 #include "osl/interlck.h"
55 #include "rtl/string.h"
56 #include "rtl/ustring.h"
57 #include "rtl/ustring.hxx"
58 #include "sal/types.h"
60 namespace {
62 class Base {
63 public:
64 Base(): m_count(0) {}
66 void acquire() {
67 if (osl_atomic_increment(&m_count) == SAL_MAX_INT32) {
68 abort();
72 void release() {
73 if (osl_atomic_decrement(&m_count) == 0) {
74 delete this;
78 protected:
79 virtual ~Base() {}
81 private:
82 Base(Base &); // not declared
83 void operator =(Base &); // not declared
85 oslInterlockedCount m_count;
88 class Impl1: public Interface1, private Base {
89 public:
90 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
91 throw (css::uno::RuntimeException)
93 if (type
94 == getCppuType< css::uno::Reference< css::uno::XInterface > >())
96 css::uno::Reference< css::uno::XInterface > ref(
97 static_cast< css::uno::XInterface * >(this));
98 return css::uno::Any(&ref, type);
99 } else if (type == getCppuType< css::uno::Reference< Interface1 > >()) {
100 css::uno::Reference< Interface1 > ref(this);
101 return css::uno::Any(&ref, type);
102 } else {
103 return css::uno::Any();
107 virtual void SAL_CALL acquire() throw () {
108 Base::acquire();
111 virtual void SAL_CALL release() throw () {
112 Base::release();
116 class Impl2: public Interface2a, public Interface3, private Base {
117 public:
118 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
119 throw (css::uno::RuntimeException)
121 if (type
122 == getCppuType< css::uno::Reference< css::uno::XInterface > >())
124 css::uno::Reference< css::uno::XInterface > ref(
125 static_cast< css::uno::XInterface * >(
126 static_cast< Interface2a * >(this)));
127 return css::uno::Any(&ref, type);
128 } else if (type == getCppuType< css::uno::Reference< Interface2 > >()) {
129 css::uno::Reference< Interface2 > ref(this);
130 return css::uno::Any(&ref, type);
131 } else if (type == getCppuType< css::uno::Reference< Interface2a > >())
133 css::uno::Reference< Interface2a > ref(this);
134 return css::uno::Any(&ref, type);
135 } else if (type == getCppuType< css::uno::Reference< Interface3 > >()) {
136 css::uno::Reference< Interface3 > ref(this);
137 return css::uno::Any(&ref, type);
138 } else {
139 return css::uno::Any();
143 virtual void SAL_CALL acquire() throw () {
144 Base::acquire();
147 virtual void SAL_CALL release() throw () {
148 Base::release();
152 class Impl2b: public Interface2b, private Base {
153 public:
154 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
155 throw (css::uno::RuntimeException)
157 if (type
158 == getCppuType< css::uno::Reference< css::uno::XInterface > >())
160 css::uno::Reference< css::uno::XInterface > ref(
161 static_cast< css::uno::XInterface * >(
162 static_cast< Interface2a * >(this)));
163 return css::uno::Any(&ref, type);
164 } else if (type == getCppuType< css::uno::Reference< Interface2 > >()) {
165 css::uno::Reference< Interface2 > ref(this);
166 return css::uno::Any(&ref, type);
167 } else if (type == getCppuType< css::uno::Reference< Interface2a > >())
169 css::uno::Reference< Interface2a > ref(this);
170 return css::uno::Any(&ref, type);
171 } else if (type == getCppuType< css::uno::Reference< Interface2b > >())
173 css::uno::Reference< Interface2b > ref(this);
174 return css::uno::Any(&ref, type);
175 } else {
176 return css::uno::Any();
180 virtual void SAL_CALL acquire() throw () {
181 Base::acquire();
184 virtual void SAL_CALL release() throw () {
185 Base::release();
189 class Test: public CppUnit::TestFixture {
190 public:
191 void testVoid();
192 void testBoolean();
193 void testByte();
194 void testShort();
195 void testUnsignedShort();
196 void testLong();
197 void testUnsignedLong();
198 void testHyper();
199 void testUnsignedHyper();
200 void testFloat();
201 void testDouble();
202 void testChar();
203 void testString();
204 void testType();
205 void testSequence();
206 void testEnum();
207 void testStruct();
208 void testPoly();
209 void testException();
210 void testInterface();
211 void testNull();
213 CPPUNIT_TEST_SUITE(Test);
214 CPPUNIT_TEST(testVoid);
215 CPPUNIT_TEST(testBoolean);
216 CPPUNIT_TEST(testByte);
217 CPPUNIT_TEST(testShort);
218 CPPUNIT_TEST(testUnsignedShort);
219 CPPUNIT_TEST(testLong);
220 CPPUNIT_TEST(testUnsignedLong);
221 CPPUNIT_TEST(testHyper);
222 CPPUNIT_TEST(testUnsignedHyper);
223 CPPUNIT_TEST(testFloat);
224 CPPUNIT_TEST(testDouble);
225 CPPUNIT_TEST(testChar);
226 CPPUNIT_TEST(testString);
227 CPPUNIT_TEST(testType);
228 CPPUNIT_TEST(testSequence);
229 CPPUNIT_TEST(testEnum);
230 CPPUNIT_TEST(testStruct);
231 CPPUNIT_TEST(testPoly);
232 CPPUNIT_TEST(testException);
233 CPPUNIT_TEST(testInterface);
234 CPPUNIT_TEST(testNull);
235 CPPUNIT_TEST_SUITE_END();
238 void Test::testVoid() {
239 css::uno::Any a;
240 CPPUNIT_ASSERT(a.getValueType() == getVoidCppuType());
242 bool b = true;
243 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
246 sal_Bool b = true;
247 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
250 sal_Int8 b = 2;
251 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
254 sal_uInt8 b = 2;
255 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
258 sal_Int16 b = 2;
259 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
262 sal_uInt16 b = 2;
263 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
266 sal_Int32 b = 2;
267 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
270 sal_uInt32 b = 2;
271 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
274 sal_Int64 b = 2;
275 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
278 sal_uInt64 b = 2;
279 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
282 float b = 2;
283 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
286 double b = 2;
287 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
290 sal_Unicode b = '2';
291 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
294 rtl::OUString b("2");
295 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
298 css::uno::Type b(getCppuType< rtl::OUString >());
299 CPPUNIT_ASSERT_MESSAGE(
300 "css::uno::Type",
301 !(a >>= b) && b == getCppuType< rtl::OUString >());
304 css::uno::Any b(rtl::OUString("2"));
305 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
308 css::uno::Sequence< rtl::OUString > b(2);
309 CPPUNIT_ASSERT_MESSAGE(
310 "css::uno::Sequence<rtl::OUString>", !(a >>= b) && b.getLength() == 2);
313 Enum1 b = Enum1_M2;
314 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
317 Struct1 b(2);
318 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
321 Exception1 b(
322 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
323 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
326 css::uno::Reference< Interface1 > i(new Impl1);
327 css::uno::Reference< Interface1 > b(i);
328 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
332 void Test::testBoolean() {
333 css::uno::Any a(false);
334 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Bool >());
336 bool b = true;
337 CPPUNIT_ASSERT_MESSAGE("bool", (a >>= b) && !b);
340 sal_Bool b = true;
341 CPPUNIT_ASSERT_MESSAGE("sal_Bool", (a >>= b) && !b);
344 sal_Int8 b = 2;
345 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
348 sal_uInt8 b = 2;
349 if (boost::is_same< sal_uInt8, sal_Bool >::value) {
350 CPPUNIT_ASSERT_MESSAGE("@sal_uInt8", (a >>= b) && b == 0);
351 } else {
352 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
356 sal_Int16 b = 2;
357 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
360 sal_uInt16 b = 2;
361 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
364 sal_Int32 b = 2;
365 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
368 sal_uInt32 b = 2;
369 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
372 sal_Int64 b = 2;
373 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
376 sal_uInt64 b = 2;
377 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
380 float b = 2;
381 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
384 double b = 2;
385 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
388 sal_Unicode b = '2';
389 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
392 rtl::OUString b("2");
393 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
396 css::uno::Type b(getCppuType< rtl::OUString >());
397 CPPUNIT_ASSERT_MESSAGE(
398 "css::uno::Type",
399 !(a >>= b) && b == getCppuType< rtl::OUString >());
402 css::uno::Any b(rtl::OUString("2"));
403 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
406 css::uno::Sequence< rtl::OUString > b(2);
407 CPPUNIT_ASSERT_MESSAGE(
408 "css::uno::Sequence<rtl::OUString>",
409 !(a >>= b) && b.getLength() == 2);
412 Enum1 b = Enum1_M2;
413 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
416 Struct1 b(2);
417 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
420 Exception1 b(
421 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
422 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
425 css::uno::Reference< Interface1 > i(new Impl1);
426 css::uno::Reference< Interface1 > b(i);
427 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
431 void Test::testByte() {
432 css::uno::Any a(static_cast< sal_Int8 >(1));
433 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int8 >());
435 bool b = true;
436 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
439 sal_Bool b = true;
440 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
443 sal_Int8 b = 2;
444 CPPUNIT_ASSERT_MESSAGE("sal_Int8", (a >>= b) && b == 1);
447 sal_uInt8 b = 2;
448 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
451 sal_Int16 b = 2;
452 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
455 sal_uInt16 b = 2;
456 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
459 sal_Int32 b = 2;
460 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
463 sal_uInt32 b = 2;
464 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
467 sal_Int64 b = 2;
468 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
471 sal_uInt64 b = 2;
472 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
475 float b = 2;
476 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
479 double b = 2;
480 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
483 sal_Unicode b = '2';
484 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
485 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
486 } else {
487 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
491 rtl::OUString b("2");
492 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
495 css::uno::Type b(getCppuType< rtl::OUString >());
496 CPPUNIT_ASSERT_MESSAGE(
497 "css::uno::Type",
498 !(a >>= b) && b == getCppuType< rtl::OUString >());
501 css::uno::Any b(rtl::OUString("2"));
502 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
505 css::uno::Sequence< rtl::OUString > b(2);
506 CPPUNIT_ASSERT_MESSAGE(
507 "css::uno::Sequence<rtl::OUString>",
508 !(a >>= b) && b.getLength() == 2);
511 Enum1 b = Enum1_M2;
512 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
515 Struct1 b(2);
516 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
519 Exception1 b(
520 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
521 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
524 css::uno::Reference< Interface1 > i(new Impl1);
525 css::uno::Reference< Interface1 > b(i);
526 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
530 void Test::testShort() {
531 css::uno::Any a(static_cast< sal_Int16 >(1));
532 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int16 >());
534 bool b = true;
535 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
538 sal_Bool b = true;
539 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
542 sal_Int8 b = 2;
543 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
546 sal_uInt8 b = 2;
547 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
550 sal_Int16 b = 2;
551 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
554 sal_uInt16 b = 2;
555 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
558 sal_Int32 b = 2;
559 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
562 sal_uInt32 b = 2;
563 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
566 sal_Int64 b = 2;
567 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
570 sal_uInt64 b = 2;
571 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
574 float b = 2;
575 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
578 double b = 2;
579 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
582 sal_Unicode b = '2';
583 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
584 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
585 } else {
586 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
590 rtl::OUString b("2");
591 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
594 css::uno::Type b(getCppuType< rtl::OUString >());
595 CPPUNIT_ASSERT_MESSAGE(
596 "css::uno::Type",
597 !(a >>= b) && b == getCppuType< rtl::OUString >());
600 css::uno::Any b(rtl::OUString("2"));
601 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
604 css::uno::Sequence< rtl::OUString > b(2);
605 CPPUNIT_ASSERT_MESSAGE(
606 "css::uno::Sequence<rtl::OUString>",
607 !(a >>= b) && b.getLength() == 2);
610 Enum1 b = Enum1_M2;
611 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
614 Struct1 b(2);
615 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
618 Exception1 b(
619 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
620 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
623 css::uno::Reference< Interface1 > i(new Impl1);
624 css::uno::Reference< Interface1 > b(i);
625 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
629 void Test::testUnsignedShort() {
630 sal_uInt16 n = 1;
631 css::uno::Any a(&n, getCppuType(static_cast< sal_uInt16 const * >(0)));
632 CPPUNIT_ASSERT(
633 a.getValueType() == getCppuType(static_cast< sal_uInt16 const * >(0)));
635 bool b = true;
636 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
639 sal_Bool b = true;
640 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
643 sal_Int8 b = 2;
644 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
647 sal_uInt8 b = 2;
648 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
651 sal_Int16 b = 2;
652 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
655 sal_uInt16 b = 2;
656 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
659 sal_Int32 b = 2;
660 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
663 sal_uInt32 b = 2;
664 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
667 sal_Int64 b = 2;
668 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
671 sal_uInt64 b = 2;
672 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
675 float b = 2;
676 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
679 double b = 2;
680 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
683 sal_Unicode b = '2';
684 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
685 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
686 } else {
687 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
691 rtl::OUString b("2");
692 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
695 css::uno::Type b(getCppuType< rtl::OUString >());
696 CPPUNIT_ASSERT_MESSAGE(
697 "css::uno::Type",
698 !(a >>= b) && b == getCppuType< rtl::OUString >());
701 css::uno::Any b(rtl::OUString("2"));
702 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
705 css::uno::Sequence< rtl::OUString > b(2);
706 CPPUNIT_ASSERT_MESSAGE(
707 "css::uno::Sequence<rtl::OUString>",
708 !(a >>= b) && b.getLength() == 2);
711 Enum1 b = Enum1_M2;
712 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
715 Struct1 b(2);
716 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
719 Exception1 b(
720 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
721 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
724 css::uno::Reference< Interface1 > i(new Impl1);
725 css::uno::Reference< Interface1 > b(i);
726 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
730 void Test::testLong() {
731 css::uno::Any a(static_cast< sal_Int32 >(1));
732 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int32 >());
734 bool b = true;
735 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
738 sal_Bool b = true;
739 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
742 sal_Int8 b = 2;
743 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
746 sal_uInt8 b = 2;
747 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
750 sal_Int16 b = 2;
751 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
754 sal_uInt16 b = 2;
755 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
758 sal_Int32 b = 2;
759 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
762 sal_uInt32 b = 2;
763 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
766 sal_Int64 b = 2;
767 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
770 sal_uInt64 b = 2;
771 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
774 float b = 2;
775 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
778 double b = 2;
779 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
782 sal_Unicode b = '2';
783 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
786 rtl::OUString b("2");
787 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
790 css::uno::Type b(getCppuType< rtl::OUString >());
791 CPPUNIT_ASSERT_MESSAGE(
792 "css::uno::Type",
793 !(a >>= b) && b == getCppuType< rtl::OUString >());
796 css::uno::Any b(rtl::OUString("2"));
797 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
800 css::uno::Sequence< rtl::OUString > b(2);
801 CPPUNIT_ASSERT_MESSAGE(
802 "css::uno::Sequence<rtl::OUString>",
803 !(a >>= b) && b.getLength() == 2);
806 Enum1 b = Enum1_M2;
807 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
810 Struct1 b(2);
811 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
814 Exception1 b(
815 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
816 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
819 css::uno::Reference< Interface1 > i(new Impl1);
820 css::uno::Reference< Interface1 > b(i);
821 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
825 void Test::testUnsignedLong() {
826 css::uno::Any a(static_cast< sal_uInt32 >(1));
827 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_uInt32 >());
829 bool b = true;
830 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
833 sal_Bool b = true;
834 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
837 sal_Int8 b = 2;
838 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
841 sal_uInt8 b = 2;
842 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
845 sal_Int16 b = 2;
846 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
849 sal_uInt16 b = 2;
850 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
853 sal_Int32 b = 2;
854 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
857 sal_uInt32 b = 2;
858 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
861 sal_Int64 b = 2;
862 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
865 sal_uInt64 b = 2;
866 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
869 float b = 2;
870 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
873 double b = 2;
874 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
877 sal_Unicode b = '2';
878 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
881 rtl::OUString b("2");
882 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
885 css::uno::Type b(getCppuType< rtl::OUString >());
886 CPPUNIT_ASSERT_MESSAGE(
887 "css::uno::Type",
888 !(a >>= b) && b == getCppuType< rtl::OUString >());
891 css::uno::Any b(rtl::OUString("2"));
892 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
895 css::uno::Sequence< rtl::OUString > b(2);
896 CPPUNIT_ASSERT_MESSAGE(
897 "css::uno::Sequence<rtl::OUString>",
898 !(a >>= b) && b.getLength() == 2);
901 Enum1 b = Enum1_M2;
902 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
905 Struct1 b(2);
906 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
909 Exception1 b(
910 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
911 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
914 css::uno::Reference< Interface1 > i(new Impl1);
915 css::uno::Reference< Interface1 > b(i);
916 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
920 void Test::testHyper() {
921 css::uno::Any a(static_cast< sal_Int64 >(1));
922 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Int64 >());
924 bool b = true;
925 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
928 sal_Bool b = true;
929 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
932 sal_Int8 b = 2;
933 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
936 sal_uInt8 b = 2;
937 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
940 sal_Int16 b = 2;
941 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
944 sal_uInt16 b = 2;
945 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
948 sal_Int32 b = 2;
949 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
952 sal_uInt32 b = 2;
953 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
956 sal_Int64 b = 2;
957 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
960 sal_uInt64 b = 2;
961 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
964 float b = 2;
965 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
968 double b = 2;
969 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
972 sal_Unicode b = '2';
973 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
976 rtl::OUString b("2");
977 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
980 css::uno::Type b(getCppuType< rtl::OUString >());
981 CPPUNIT_ASSERT_MESSAGE(
982 "css::uno::Type",
983 !(a >>= b) && b == getCppuType< rtl::OUString >());
986 css::uno::Any b(rtl::OUString("2"));
987 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
990 css::uno::Sequence< rtl::OUString > b(2);
991 CPPUNIT_ASSERT_MESSAGE(
992 "css::uno::Sequence<rtl::OUString>",
993 !(a >>= b) && b.getLength() == 2);
996 Enum1 b = Enum1_M2;
997 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1000 Struct1 b(2);
1001 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1004 Exception1 b(
1005 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1006 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1009 css::uno::Reference< Interface1 > i(new Impl1);
1010 css::uno::Reference< Interface1 > b(i);
1011 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1015 void Test::testUnsignedHyper() {
1016 css::uno::Any a(static_cast< sal_uInt64 >(1));
1017 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_uInt64 >());
1019 bool b = true;
1020 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1023 sal_Bool b = true;
1024 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1027 sal_Int8 b = 2;
1028 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1031 sal_uInt8 b = 2;
1032 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1035 sal_Int16 b = 2;
1036 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1039 sal_uInt16 b = 2;
1040 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1043 sal_Int32 b = 2;
1044 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1047 sal_uInt32 b = 2;
1048 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1051 sal_Int64 b = 2;
1052 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
1055 sal_uInt64 b = 2;
1056 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
1059 float b = 2;
1060 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1063 double b = 2;
1064 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1067 sal_Unicode b = '2';
1068 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1071 rtl::OUString b("2");
1072 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1075 css::uno::Type b(getCppuType< rtl::OUString >());
1076 CPPUNIT_ASSERT_MESSAGE(
1077 "css::uno::Type",
1078 !(a >>= b) && b == getCppuType< rtl::OUString >());
1081 css::uno::Any b(rtl::OUString("2"));
1082 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1085 css::uno::Sequence< rtl::OUString > b(2);
1086 CPPUNIT_ASSERT_MESSAGE(
1087 "css::uno::Sequence<rtl::OUString>",
1088 !(a >>= b) && b.getLength() == 2);
1091 Enum1 b = Enum1_M2;
1092 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1095 Struct1 b(2);
1096 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1099 Exception1 b(
1100 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1101 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1104 css::uno::Reference< Interface1 > i(new Impl1);
1105 css::uno::Reference< Interface1 > b(i);
1106 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1110 void Test::testFloat() {
1111 css::uno::Any a(1.f);
1112 CPPUNIT_ASSERT(a.getValueType() == getCppuType< float >());
1114 bool b = true;
1115 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1118 sal_Bool b = true;
1119 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1122 sal_Int8 b = 2;
1123 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1126 sal_uInt8 b = 2;
1127 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1130 sal_Int16 b = 2;
1131 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1134 sal_uInt16 b = 2;
1135 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1138 sal_Int32 b = 2;
1139 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1142 sal_uInt32 b = 2;
1143 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1146 sal_Int64 b = 2;
1147 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1150 sal_uInt64 b = 2;
1151 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1154 float b = 2;
1155 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
1158 double b = 2;
1159 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1162 sal_Unicode b = '2';
1163 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1166 rtl::OUString b("2");
1167 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1170 css::uno::Type b(getCppuType< rtl::OUString >());
1171 CPPUNIT_ASSERT_MESSAGE(
1172 "css::uno::Type",
1173 !(a >>= b) && b == getCppuType< rtl::OUString >());
1176 css::uno::Any b(rtl::OUString("2"));
1177 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1180 css::uno::Sequence< rtl::OUString > b(2);
1181 CPPUNIT_ASSERT_MESSAGE(
1182 "css::uno::Sequence<rtl::OUString>",
1183 !(a >>= b) && b.getLength() == 2);
1186 Enum1 b = Enum1_M2;
1187 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1190 Struct1 b(2);
1191 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1194 Exception1 b(
1195 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1196 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1199 css::uno::Reference< Interface1 > i(new Impl1);
1200 css::uno::Reference< Interface1 > b(i);
1201 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1205 void Test::testDouble() {
1206 css::uno::Any a(1.);
1207 CPPUNIT_ASSERT(a.getValueType() == getCppuType< double >());
1209 bool b = true;
1210 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1213 sal_Bool b = true;
1214 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1217 sal_Int8 b = 2;
1218 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1221 sal_uInt8 b = 2;
1222 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1225 sal_Int16 b = 2;
1226 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1229 sal_uInt16 b = 2;
1230 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1233 sal_Int32 b = 2;
1234 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1237 sal_uInt32 b = 2;
1238 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1241 sal_Int64 b = 2;
1242 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1245 sal_uInt64 b = 2;
1246 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1249 float b = 2;
1250 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1253 double b = 2;
1254 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1257 sal_Unicode b = '2';
1258 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1261 rtl::OUString b("2");
1262 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1265 css::uno::Type b(getCppuType< rtl::OUString >());
1266 CPPUNIT_ASSERT_MESSAGE(
1267 "css::uno::Type",
1268 !(a >>= b) && b == getCppuType< rtl::OUString >());
1271 css::uno::Any b(rtl::OUString("2"));
1272 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1275 css::uno::Sequence< rtl::OUString > b(2);
1276 CPPUNIT_ASSERT_MESSAGE(
1277 "css::uno::Sequence<rtl::OUString>",
1278 !(a >>= b) && b.getLength() == 2);
1281 Enum1 b = Enum1_M2;
1282 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1285 Struct1 b(2);
1286 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1289 Exception1 b(
1290 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1291 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1294 css::uno::Reference< Interface1 > i(new Impl1);
1295 css::uno::Reference< Interface1 > b(i);
1296 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1300 void Test::testChar() {
1301 sal_Unicode c = '1';
1302 css::uno::Any a(&c, getCppuType< sal_Unicode >());
1303 CPPUNIT_ASSERT(a.getValueType() == getCppuType< sal_Unicode >());
1305 bool b = true;
1306 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1309 sal_Bool b = true;
1310 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1313 sal_Int8 b = 2;
1314 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1317 sal_uInt8 b = 2;
1318 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1321 sal_Int16 b = 2;
1322 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1325 sal_uInt16 b = 2;
1326 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1329 sal_Int32 b = 2;
1330 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1333 sal_uInt32 b = 2;
1334 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1337 sal_Int64 b = 2;
1338 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1341 sal_uInt64 b = 2;
1342 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1345 float b = 2;
1346 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1349 double b = 2;
1350 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1353 sal_Unicode b = '2';
1354 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
1355 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", !(a >>= b) && b == '2');
1356 } else {
1357 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", (a >>= b) && b == '1');
1361 rtl::OUString b("2");
1362 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1365 css::uno::Type b(getCppuType< rtl::OUString >());
1366 CPPUNIT_ASSERT_MESSAGE(
1367 "css::uno::Type",
1368 !(a >>= b) && b == getCppuType< rtl::OUString >());
1371 css::uno::Any b(rtl::OUString("2"));
1372 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1375 css::uno::Sequence< rtl::OUString > b(2);
1376 CPPUNIT_ASSERT_MESSAGE(
1377 "css::uno::Sequence<rtl::OUString>",
1378 !(a >>= b) && b.getLength() == 2);
1381 Enum1 b = Enum1_M2;
1382 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1385 Struct1 b(2);
1386 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1389 Exception1 b(
1390 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1391 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1394 css::uno::Reference< Interface1 > i(new Impl1);
1395 css::uno::Reference< Interface1 > b(i);
1396 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1400 void Test::testString() {
1401 css::uno::Any a(rtl::OUString("1"));
1402 CPPUNIT_ASSERT(a.getValueType() == getCppuType< rtl::OUString >());
1404 bool b = true;
1405 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1408 sal_Bool b = true;
1409 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1412 sal_Int8 b = 2;
1413 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1416 sal_uInt8 b = 2;
1417 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1420 sal_Int16 b = 2;
1421 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1424 sal_uInt16 b = 2;
1425 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1428 sal_Int32 b = 2;
1429 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1432 sal_uInt32 b = 2;
1433 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1436 sal_Int64 b = 2;
1437 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1440 sal_uInt64 b = 2;
1441 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1444 float b = 2;
1445 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1448 double b = 2;
1449 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1452 sal_Unicode b = '2';
1453 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1456 rtl::OUString b("2");
1457 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", (a >>= b) && b == "1" );
1460 css::uno::Type b(getCppuType< rtl::OUString >());
1461 CPPUNIT_ASSERT_MESSAGE(
1462 "css::uno::Type",
1463 !(a >>= b) && b == getCppuType< rtl::OUString >());
1466 css::uno::Any b(rtl::OUString("2"));
1467 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1470 css::uno::Sequence< rtl::OUString > b(2);
1471 CPPUNIT_ASSERT_MESSAGE(
1472 "css::uno::Sequence<rtl::OUString>",
1473 !(a >>= b) && b.getLength() == 2);
1476 Enum1 b = Enum1_M2;
1477 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1480 Struct1 b(2);
1481 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1484 Exception1 b(
1485 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1486 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1489 css::uno::Reference< Interface1 > i(new Impl1);
1490 css::uno::Reference< Interface1 > b(i);
1491 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1495 void Test::testType() {
1496 css::uno::Any a(getCppuType< sal_Int32 >());
1497 CPPUNIT_ASSERT(a.getValueType() == getCppuType< css::uno::Type >());
1499 bool b = true;
1500 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1503 sal_Bool b = true;
1504 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1507 sal_Int8 b = 2;
1508 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1511 sal_uInt8 b = 2;
1512 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1515 sal_Int16 b = 2;
1516 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1519 sal_uInt16 b = 2;
1520 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1523 sal_Int32 b = 2;
1524 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1527 sal_uInt32 b = 2;
1528 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1531 sal_Int64 b = 2;
1532 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1535 sal_uInt64 b = 2;
1536 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1539 float b = 2;
1540 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1543 double b = 2;
1544 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1547 sal_Unicode b = '2';
1548 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1551 rtl::OUString b("2");
1552 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1555 css::uno::Type b(getCppuType< rtl::OUString >());
1556 CPPUNIT_ASSERT_MESSAGE(
1557 "css::uno::Type", (a >>= b) && b == getCppuType< sal_Int32 >());
1560 css::uno::Any b(rtl::OUString("2"));
1561 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1564 css::uno::Sequence< rtl::OUString > b(2);
1565 CPPUNIT_ASSERT_MESSAGE(
1566 "css::uno::Sequence<rtl::OUString>",
1567 !(a >>= b) && b.getLength() == 2);
1570 Enum1 b = Enum1_M2;
1571 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1574 Struct1 b(2);
1575 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1578 Exception1 b(
1579 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1580 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1583 css::uno::Reference< Interface1 > i(new Impl1);
1584 css::uno::Reference< Interface1 > b(i);
1585 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1589 void Test::testSequence() {
1590 sal_Int32 n = 1;
1591 css::uno::Any a(css::uno::Sequence< sal_Int32 >(&n, 1));
1592 CPPUNIT_ASSERT(
1593 a.getValueType() == getCppuType< css::uno::Sequence< sal_Int32 > >());
1595 bool b = true;
1596 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1599 sal_Bool b = true;
1600 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1603 sal_Int8 b = 2;
1604 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1607 sal_uInt8 b = 2;
1608 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1611 sal_Int16 b = 2;
1612 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1615 sal_uInt16 b = 2;
1616 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1619 sal_Int32 b = 2;
1620 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1623 sal_uInt32 b = 2;
1624 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1627 sal_Int64 b = 2;
1628 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1631 sal_uInt64 b = 2;
1632 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1635 float b = 2;
1636 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1639 double b = 2;
1640 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1643 sal_Unicode b = '2';
1644 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1647 rtl::OUString b("2");
1648 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1651 css::uno::Type b(getCppuType< rtl::OUString >());
1652 CPPUNIT_ASSERT_MESSAGE(
1653 "css::uno::Type",
1654 !(a >>= b) && b == getCppuType< rtl::OUString >());
1657 css::uno::Any b(rtl::OUString("2"));
1658 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1661 css::uno::Sequence< rtl::OUString > b(2);
1662 CPPUNIT_ASSERT_MESSAGE(
1663 "css::uno::Sequence<rtl::OUString>",
1664 !(a >>= b) && b.getLength() == 2);
1667 css::uno::Sequence< sal_Int32 > b(2);
1668 CPPUNIT_ASSERT_MESSAGE(
1669 "css::uno::Sequence<sal_Int32>",
1670 (a >>= b) && b.getLength() == 1 && b[0] == 1);
1673 Enum1 b = Enum1_M2;
1674 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1677 Struct1 b(2);
1678 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1681 Exception1 b(
1682 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1683 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1686 css::uno::Reference< Interface1 > i(new Impl1);
1687 css::uno::Reference< Interface1 > b(i);
1688 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1692 void Test::testEnum() {
1693 css::uno::Any a(Enum2_M1);
1694 CPPUNIT_ASSERT(a.getValueType() == getCppuType< Enum2 >());
1696 bool b = true;
1697 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1700 sal_Bool b = true;
1701 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1704 sal_Int8 b = 2;
1705 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1708 sal_uInt8 b = 2;
1709 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1712 sal_Int16 b = 2;
1713 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1716 sal_uInt16 b = 2;
1717 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1720 sal_Int32 b = 2;
1721 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1724 sal_uInt32 b = 2;
1725 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1728 sal_Int64 b = 2;
1729 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1732 sal_uInt64 b = 2;
1733 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1736 float b = 2;
1737 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1740 double b = 2;
1741 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1744 sal_Unicode b = '2';
1745 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1748 rtl::OUString b("2");
1749 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1752 css::uno::Type b(getCppuType< rtl::OUString >());
1753 CPPUNIT_ASSERT_MESSAGE(
1754 "css::uno::Type",
1755 !(a >>= b) && b == getCppuType< rtl::OUString >());
1758 css::uno::Any b(rtl::OUString("2"));
1759 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1762 css::uno::Sequence< rtl::OUString > b(2);
1763 CPPUNIT_ASSERT_MESSAGE(
1764 "css::uno::Sequence<rtl::OUString>",
1765 !(a >>= b) && b.getLength() == 2);
1768 Enum1 b = Enum1_M2;
1769 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1772 Enum2 b = Enum2_M2;
1773 CPPUNIT_ASSERT_MESSAGE("Enum2", (a >>= b) && b == Enum2_M1);
1776 Struct1 b(2);
1777 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1780 Exception1 b(
1781 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1782 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1785 css::uno::Reference< Interface1 > i(new Impl1);
1786 css::uno::Reference< Interface1 > b(i);
1787 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1791 void Test::testStruct() {
1792 css::uno::Any a(Struct2a(1, 3));
1793 CPPUNIT_ASSERT(a.getValueType() == getCppuType< Struct2a >());
1795 bool b = true;
1796 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1799 sal_Bool b = true;
1800 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1803 sal_Int8 b = 2;
1804 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1807 sal_uInt8 b = 2;
1808 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1811 sal_Int16 b = 2;
1812 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1815 sal_uInt16 b = 2;
1816 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1819 sal_Int32 b = 2;
1820 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1823 sal_uInt32 b = 2;
1824 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1827 sal_Int64 b = 2;
1828 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1831 sal_uInt64 b = 2;
1832 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1835 float b = 2;
1836 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1839 double b = 2;
1840 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1843 sal_Unicode b = '2';
1844 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1847 rtl::OUString b("2");
1848 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1851 css::uno::Type b(getCppuType< rtl::OUString >());
1852 CPPUNIT_ASSERT_MESSAGE(
1853 "css::uno::Type",
1854 !(a >>= b) && b == getCppuType< rtl::OUString >());
1857 css::uno::Any b(rtl::OUString("2"));
1858 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1861 css::uno::Sequence< rtl::OUString > b(2);
1862 CPPUNIT_ASSERT_MESSAGE(
1863 "css::uno::Sequence<rtl::OUString>",
1864 !(a >>= b) && b.getLength() == 2);
1867 Enum1 b = Enum1_M2;
1868 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1871 Struct1 b(2);
1872 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1875 Struct2 b(2);
1876 CPPUNIT_ASSERT_MESSAGE("Struct2", (a >>= b) && b.member == 1);
1879 Struct2a b(2, 2);
1880 CPPUNIT_ASSERT_MESSAGE(
1881 "Struct2a", (a >>= b) && b.member == 1 && b.member2 == 3);
1884 Struct2b b(2, 2, 2);
1885 CPPUNIT_ASSERT_MESSAGE("Struct2b", !(a >>= b) && b.member == 2);
1888 Exception1 b(
1889 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1890 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1893 css::uno::Reference< Interface1 > i(new Impl1);
1894 css::uno::Reference< Interface1 > b(i);
1895 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1899 void Test::testPoly() {
1900 css::uno::Any a;
1901 a <<= Poly< css::uno::Sequence< ::sal_Unicode > >();
1902 CPPUNIT_ASSERT_MESSAGE( "type name", a.getValueType().getTypeName() == "Poly<[]char>" );
1903 CPPUNIT_ASSERT_MESSAGE(
1904 "constructor",
1905 a == css::uno::Any(Poly< css::uno::Sequence< ::sal_Unicode > >()));
1908 void Test::testException() {
1909 css::uno::Any a(
1910 Exception2a(
1911 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 1,
1912 3));
1913 CPPUNIT_ASSERT(a.getValueType() == getCppuType< Exception2a >());
1915 bool b = true;
1916 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1919 sal_Bool b = true;
1920 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1923 sal_Int8 b = 2;
1924 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1927 sal_uInt8 b = 2;
1928 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1931 sal_Int16 b = 2;
1932 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1935 sal_uInt16 b = 2;
1936 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1939 sal_Int32 b = 2;
1940 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1943 sal_uInt32 b = 2;
1944 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1947 sal_Int64 b = 2;
1948 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1951 sal_uInt64 b = 2;
1952 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1955 float b = 2;
1956 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1959 double b = 2;
1960 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1963 sal_Unicode b = '2';
1964 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1967 rtl::OUString b("2");
1968 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1971 css::uno::Type b(getCppuType< rtl::OUString >());
1972 CPPUNIT_ASSERT_MESSAGE(
1973 "css::uno::Type",
1974 !(a >>= b) && b == getCppuType< rtl::OUString >());
1977 css::uno::Any b(rtl::OUString("2"));
1978 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1981 css::uno::Sequence< rtl::OUString > b(2);
1982 CPPUNIT_ASSERT_MESSAGE(
1983 "css::uno::Sequence<rtl::OUString>",
1984 !(a >>= b) && b.getLength() == 2);
1987 Enum1 b = Enum1_M2;
1988 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1991 Struct1 b(2);
1992 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1995 Exception1 b(
1996 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1997 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2000 Exception2 b(
2001 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2002 CPPUNIT_ASSERT_MESSAGE("Exception2", (a >>= b) && b.member == 1);
2005 Exception2a b(
2006 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2008 CPPUNIT_ASSERT_MESSAGE(
2009 "Exception2a", (a >>= b) && b.member == 1 && b.member2 == 3);
2012 Exception2b b(
2013 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2015 CPPUNIT_ASSERT_MESSAGE("Exception2b", !(a >>= b) && b.member == 2);
2018 css::uno::Reference< Interface1 > i(new Impl1);
2019 css::uno::Reference< Interface1 > b(i);
2020 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2024 void Test::testInterface() {
2025 css::uno::Reference< Interface2a > i2(new Impl2);
2026 css::uno::Any a(i2);
2027 CPPUNIT_ASSERT(
2028 a.getValueType()
2029 == getCppuType< css::uno::Reference< Interface2a > >());
2031 bool b = true;
2032 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2035 sal_Bool b = true;
2036 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2039 sal_Int8 b = 2;
2040 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2043 sal_uInt8 b = 2;
2044 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2047 sal_Int16 b = 2;
2048 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2051 sal_uInt16 b = 2;
2052 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2055 sal_Int32 b = 2;
2056 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2059 sal_uInt32 b = 2;
2060 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2063 sal_Int64 b = 2;
2064 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2067 sal_uInt64 b = 2;
2068 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2071 float b = 2;
2072 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2075 double b = 2;
2076 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2079 sal_Unicode b = '2';
2080 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2083 rtl::OUString b("2");
2084 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
2087 css::uno::Type b(getCppuType< rtl::OUString >());
2088 CPPUNIT_ASSERT_MESSAGE(
2089 "css::uno::Type",
2090 !(a >>= b) && b == getCppuType< rtl::OUString >());
2093 css::uno::Any b(rtl::OUString("2"));
2094 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2097 css::uno::Sequence< rtl::OUString > b(2);
2098 CPPUNIT_ASSERT_MESSAGE(
2099 "css::uno::Sequence<rtl::OUString>",
2100 !(a >>= b) && b.getLength() == 2);
2103 Enum1 b = Enum1_M2;
2104 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2107 Struct1 b(2);
2108 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2111 Exception1 b(
2112 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2113 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2116 css::uno::Reference< Interface1 > i(new Impl1);
2117 css::uno::Reference< Interface1 > b(i);
2118 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2121 css::uno::Reference< Interface2 > b(new Impl2);
2122 CPPUNIT_ASSERT_MESSAGE("Interface2", (a >>= b) && b == i2);
2125 css::uno::Reference< Interface2a > b(new Impl2);
2126 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && b == i2);
2129 css::uno::Reference< Interface2b > i(new Impl2b);
2130 css::uno::Reference< Interface2b > b(i);
2131 CPPUNIT_ASSERT_MESSAGE("Interface2b", !(a >>= b) && b == i);
2134 css::uno::Reference< Interface3 > b(new Impl2);
2135 CPPUNIT_ASSERT_MESSAGE("Interface3", (a >>= b) && b == i2);
2139 void Test::testNull() {
2140 css::uno::Any a = css::uno::Any(css::uno::Reference< Interface2a >());
2141 CPPUNIT_ASSERT(
2142 a.getValueType()
2143 == getCppuType< css::uno::Reference< Interface2a > >());
2145 bool b = true;
2146 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2149 sal_Bool b = true;
2150 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2153 sal_Int8 b = 2;
2154 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2157 sal_uInt8 b = 2;
2158 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2161 sal_Int16 b = 2;
2162 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2165 sal_uInt16 b = 2;
2166 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2169 sal_Int32 b = 2;
2170 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2173 sal_uInt32 b = 2;
2174 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2177 sal_Int64 b = 2;
2178 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2181 sal_uInt64 b = 2;
2182 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2185 float b = 2;
2186 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2189 double b = 2;
2190 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2193 sal_Unicode b = '2';
2194 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2197 rtl::OUString b("2");
2198 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
2201 css::uno::Type b(getCppuType< rtl::OUString >());
2202 CPPUNIT_ASSERT_MESSAGE(
2203 "css::uno::Type",
2204 !(a >>= b) && b == getCppuType< rtl::OUString >());
2207 css::uno::Any b(rtl::OUString("2"));
2208 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2211 css::uno::Sequence< rtl::OUString > b(2);
2212 CPPUNIT_ASSERT_MESSAGE(
2213 "css::uno::Sequence<rtl::OUString>",
2214 !(a >>= b) && b.getLength() == 2);
2217 Enum1 b = Enum1_M2;
2218 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2221 Struct1 b(2);
2222 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2225 Exception1 b(
2226 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2227 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2230 css::uno::Reference< Interface1 > b(new Impl1);
2231 CPPUNIT_ASSERT_MESSAGE(
2232 "Interface1", (a >>= b) && !b.is());
2235 css::uno::Reference< Interface2 > b(new Impl2);
2236 CPPUNIT_ASSERT_MESSAGE(
2237 "Interface2", (a >>= b) && !b.is());
2240 css::uno::Reference< Interface2a > b(new Impl2);
2241 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && !b.is());
2244 css::uno::Reference< Interface2b > b(new Impl2b);
2245 CPPUNIT_ASSERT_MESSAGE(
2246 "Interface2b", (a >>= b) && !b.is());
2249 css::uno::Reference< Interface3 > b(new Impl2);
2250 CPPUNIT_ASSERT_MESSAGE(
2251 "Interface3", (a >>= b) && !b.is());
2255 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
2259 CPPUNIT_PLUGIN_IMPLEMENT();
2261 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */