bump product version to 5.0.4.1
[LibreOffice.git] / cppu / qa / test_any.cxx
blob3a0352b3c59f5559bc1fbcb8d6ae3194cb95bb34
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/noncopyable.hpp"
47 #include "boost/type_traits/is_same.hpp"
48 #include "com/sun/star/uno/Any.hxx"
49 #include "com/sun/star/uno/Reference.hxx"
50 #include "com/sun/star/uno/RuntimeException.hpp"
51 #include "com/sun/star/uno/Sequence.hxx"
52 #include "com/sun/star/uno/Type.hxx"
53 #include "com/sun/star/uno/XInterface.hpp"
54 #include "osl/diagnose.h"
55 #include "osl/interlck.h"
56 #include "rtl/string.h"
57 #include "rtl/ustring.h"
58 #include "rtl/ustring.hxx"
60 namespace {
62 class Base: private boost::noncopyable {
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 oslInterlockedCount m_count;
85 class Impl1: public Interface1, private Base {
86 public:
87 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
88 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
90 if (type == cppu::UnoType<css::uno::XInterface>::get()) {
91 css::uno::Reference< css::uno::XInterface > ref(
92 static_cast< css::uno::XInterface * >(this));
93 return css::uno::Any(&ref, type);
94 } else if (type == cppu::UnoType<Interface1>::get()) {
95 css::uno::Reference< Interface1 > ref(this);
96 return css::uno::Any(&ref, type);
97 } else {
98 return css::uno::Any();
102 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE {
103 Base::acquire();
106 virtual void SAL_CALL release() throw () SAL_OVERRIDE {
107 Base::release();
111 class Impl2: public Interface2a, public Interface3, private Base {
112 public:
113 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
114 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
116 if (type == cppu::UnoType<css::uno::XInterface>::get()) {
117 css::uno::Reference< css::uno::XInterface > ref(
118 static_cast< css::uno::XInterface * >(
119 static_cast< Interface2a * >(this)));
120 return css::uno::Any(&ref, type);
121 } else if (type == cppu::UnoType<Interface2>::get()) {
122 css::uno::Reference< Interface2 > ref(this);
123 return css::uno::Any(&ref, type);
124 } else if (type == cppu::UnoType<Interface2a>::get()) {
125 css::uno::Reference< Interface2a > ref(this);
126 return css::uno::Any(&ref, type);
127 } else if (type == cppu::UnoType<Interface3>::get()) {
128 css::uno::Reference< Interface3 > ref(this);
129 return css::uno::Any(&ref, type);
130 } else {
131 return css::uno::Any();
135 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE {
136 Base::acquire();
139 virtual void SAL_CALL release() throw () SAL_OVERRIDE {
140 Base::release();
144 class Impl2b: public Interface2b, private Base {
145 public:
146 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type)
147 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
149 if (type == cppu::UnoType<css::uno::XInterface>::get()) {
150 css::uno::Reference< css::uno::XInterface > ref(
151 static_cast< css::uno::XInterface * >(
152 static_cast< Interface2a * >(this)));
153 return css::uno::Any(&ref, type);
154 } else if (type == cppu::UnoType<Interface2>::get()) {
155 css::uno::Reference< Interface2 > ref(this);
156 return css::uno::Any(&ref, type);
157 } else if (type == cppu::UnoType<Interface2a>::get()) {
158 css::uno::Reference< Interface2a > ref(this);
159 return css::uno::Any(&ref, type);
160 } else if (type == cppu::UnoType<Interface2b>::get()) {
161 css::uno::Reference< Interface2b > ref(this);
162 return css::uno::Any(&ref, type);
163 } else {
164 return css::uno::Any();
168 virtual void SAL_CALL acquire() throw () SAL_OVERRIDE {
169 Base::acquire();
172 virtual void SAL_CALL release() throw () SAL_OVERRIDE {
173 Base::release();
177 class Test: public CppUnit::TestFixture {
178 public:
179 void testVoid();
180 void testBoolean();
181 void testByte();
182 void testShort();
183 void testUnsignedShort();
184 void testLong();
185 void testUnsignedLong();
186 void testHyper();
187 void testUnsignedHyper();
188 void testFloat();
189 void testDouble();
190 void testChar();
191 void testString();
192 void testType();
193 void testSequence();
194 void testEnum();
195 void testStruct();
196 void testPoly();
197 void testException();
198 void testInterface();
199 void testNull();
201 CPPUNIT_TEST_SUITE(Test);
202 CPPUNIT_TEST(testVoid);
203 CPPUNIT_TEST(testBoolean);
204 CPPUNIT_TEST(testByte);
205 CPPUNIT_TEST(testShort);
206 CPPUNIT_TEST(testUnsignedShort);
207 CPPUNIT_TEST(testLong);
208 CPPUNIT_TEST(testUnsignedLong);
209 CPPUNIT_TEST(testHyper);
210 CPPUNIT_TEST(testUnsignedHyper);
211 CPPUNIT_TEST(testFloat);
212 CPPUNIT_TEST(testDouble);
213 CPPUNIT_TEST(testChar);
214 CPPUNIT_TEST(testString);
215 CPPUNIT_TEST(testType);
216 CPPUNIT_TEST(testSequence);
217 CPPUNIT_TEST(testEnum);
218 CPPUNIT_TEST(testStruct);
219 CPPUNIT_TEST(testPoly);
220 CPPUNIT_TEST(testException);
221 CPPUNIT_TEST(testInterface);
222 CPPUNIT_TEST(testNull);
223 CPPUNIT_TEST_SUITE_END();
226 void Test::testVoid() {
227 css::uno::Any a;
228 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<void>::get());
230 bool b = true;
231 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
234 sal_Bool b = true;
235 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
238 sal_Int8 b = 2;
239 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
242 sal_uInt8 b = 2;
243 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
246 sal_Int16 b = 2;
247 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
250 sal_uInt16 b = 2;
251 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
254 sal_Int32 b = 2;
255 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
258 sal_uInt32 b = 2;
259 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
262 sal_Int64 b = 2;
263 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
266 sal_uInt64 b = 2;
267 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
270 float b = 2;
271 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
274 double b = 2;
275 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
278 sal_Unicode b = '2';
279 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
282 rtl::OUString b("2");
283 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
286 css::uno::Type b(cppu::UnoType<OUString>::get());
287 CPPUNIT_ASSERT_MESSAGE(
288 "css::uno::Type",
289 !(a >>= b) && b == cppu::UnoType<OUString>::get());
292 css::uno::Any b(rtl::OUString("2"));
293 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
296 css::uno::Sequence< rtl::OUString > b(2);
297 CPPUNIT_ASSERT_MESSAGE(
298 "css::uno::Sequence<rtl::OUString>", !(a >>= b) && b.getLength() == 2);
301 Enum1 b = Enum1_M2;
302 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
305 Struct1 b(2);
306 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
309 Exception1 b(
310 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
311 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
314 css::uno::Reference< Interface1 > i(new Impl1);
315 css::uno::Reference< Interface1 > b(i);
316 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
320 void Test::testBoolean() {
321 css::uno::Any a(false);
322 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<bool>::get());
324 bool b = true;
325 CPPUNIT_ASSERT_MESSAGE("bool", (a >>= b) && !b);
328 sal_Bool b = true;
329 CPPUNIT_ASSERT_MESSAGE("sal_Bool", (a >>= b) && !b);
332 sal_Int8 b = 2;
333 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
336 sal_uInt8 b = 2;
337 if (boost::is_same< sal_uInt8, sal_Bool >::value) {
338 CPPUNIT_ASSERT_MESSAGE("@sal_uInt8", (a >>= b) && b == 0);
339 } else {
340 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
344 sal_Int16 b = 2;
345 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
348 sal_uInt16 b = 2;
349 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
352 sal_Int32 b = 2;
353 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
356 sal_uInt32 b = 2;
357 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
360 sal_Int64 b = 2;
361 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
364 sal_uInt64 b = 2;
365 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
368 float b = 2;
369 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
372 double b = 2;
373 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
376 sal_Unicode b = '2';
377 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
380 rtl::OUString b("2");
381 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
384 css::uno::Type b(cppu::UnoType<OUString>::get());
385 CPPUNIT_ASSERT_MESSAGE(
386 "css::uno::Type",
387 !(a >>= b) && b == cppu::UnoType<OUString>::get());
390 css::uno::Any b(rtl::OUString("2"));
391 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
394 css::uno::Sequence< rtl::OUString > b(2);
395 CPPUNIT_ASSERT_MESSAGE(
396 "css::uno::Sequence<rtl::OUString>",
397 !(a >>= b) && b.getLength() == 2);
400 Enum1 b = Enum1_M2;
401 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
404 Struct1 b(2);
405 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
408 Exception1 b(
409 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
410 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
413 css::uno::Reference< Interface1 > i(new Impl1);
414 css::uno::Reference< Interface1 > b(i);
415 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
419 void Test::testByte() {
420 css::uno::Any a(static_cast< sal_Int8 >(1));
421 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<sal_Int8>::get());
423 bool b = true;
424 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
427 sal_Bool b = true;
428 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
431 sal_Int8 b = 2;
432 CPPUNIT_ASSERT_MESSAGE("sal_Int8", (a >>= b) && b == 1);
435 sal_uInt8 b = 2;
436 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
439 sal_Int16 b = 2;
440 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
443 sal_uInt16 b = 2;
444 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
447 sal_Int32 b = 2;
448 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
451 sal_uInt32 b = 2;
452 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
455 sal_Int64 b = 2;
456 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
459 sal_uInt64 b = 2;
460 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
463 float b = 2;
464 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
467 double b = 2;
468 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
471 sal_Unicode b = '2';
472 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
473 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
474 } else {
475 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
479 rtl::OUString b("2");
480 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
483 css::uno::Type b(cppu::UnoType<OUString>::get());
484 CPPUNIT_ASSERT_MESSAGE(
485 "css::uno::Type",
486 !(a >>= b) && b == cppu::UnoType<OUString>::get());
489 css::uno::Any b(rtl::OUString("2"));
490 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
493 css::uno::Sequence< rtl::OUString > b(2);
494 CPPUNIT_ASSERT_MESSAGE(
495 "css::uno::Sequence<rtl::OUString>",
496 !(a >>= b) && b.getLength() == 2);
499 Enum1 b = Enum1_M2;
500 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
503 Struct1 b(2);
504 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
507 Exception1 b(
508 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
509 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
512 css::uno::Reference< Interface1 > i(new Impl1);
513 css::uno::Reference< Interface1 > b(i);
514 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
518 void Test::testShort() {
519 css::uno::Any a(static_cast< sal_Int16 >(1));
520 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<sal_Int16>::get());
522 bool b = true;
523 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
526 sal_Bool b = true;
527 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
530 sal_Int8 b = 2;
531 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
534 sal_uInt8 b = 2;
535 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
538 sal_Int16 b = 2;
539 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
542 sal_uInt16 b = 2;
543 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
546 sal_Int32 b = 2;
547 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
550 sal_uInt32 b = 2;
551 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
554 sal_Int64 b = 2;
555 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
558 sal_uInt64 b = 2;
559 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
562 float b = 2;
563 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
566 double b = 2;
567 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
570 sal_Unicode b = '2';
571 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
572 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
573 } else {
574 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
578 rtl::OUString b("2");
579 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
582 css::uno::Type b(cppu::UnoType<OUString>::get());
583 CPPUNIT_ASSERT_MESSAGE(
584 "css::uno::Type",
585 !(a >>= b) && b == cppu::UnoType<OUString>::get());
588 css::uno::Any b(rtl::OUString("2"));
589 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
592 css::uno::Sequence< rtl::OUString > b(2);
593 CPPUNIT_ASSERT_MESSAGE(
594 "css::uno::Sequence<rtl::OUString>",
595 !(a >>= b) && b.getLength() == 2);
598 Enum1 b = Enum1_M2;
599 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
602 Struct1 b(2);
603 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
606 Exception1 b(
607 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
608 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
611 css::uno::Reference< Interface1 > i(new Impl1);
612 css::uno::Reference< Interface1 > b(i);
613 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
617 void Test::testUnsignedShort() {
618 sal_uInt16 n = 1;
619 css::uno::Any a(&n, cppu::UnoType<cppu::UnoUnsignedShortType>::get());
620 CPPUNIT_ASSERT(
621 a.getValueType() == cppu::UnoType<cppu::UnoUnsignedShortType>::get());
623 bool b = true;
624 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
627 sal_Bool b = true;
628 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
631 sal_Int8 b = 2;
632 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
635 sal_uInt8 b = 2;
636 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
639 sal_Int16 b = 2;
640 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
643 sal_uInt16 b = 2;
644 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
647 sal_Int32 b = 2;
648 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
651 sal_uInt32 b = 2;
652 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
655 sal_Int64 b = 2;
656 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
659 sal_uInt64 b = 2;
660 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
663 float b = 2;
664 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
667 double b = 2;
668 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
671 sal_Unicode b = '2';
672 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
673 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
674 } else {
675 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
679 rtl::OUString b("2");
680 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
683 css::uno::Type b(cppu::UnoType<OUString>::get());
684 CPPUNIT_ASSERT_MESSAGE(
685 "css::uno::Type",
686 !(a >>= b) && b == cppu::UnoType<OUString>::get());
689 css::uno::Any b(rtl::OUString("2"));
690 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
693 css::uno::Sequence< rtl::OUString > b(2);
694 CPPUNIT_ASSERT_MESSAGE(
695 "css::uno::Sequence<rtl::OUString>",
696 !(a >>= b) && b.getLength() == 2);
699 Enum1 b = Enum1_M2;
700 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
703 Struct1 b(2);
704 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
707 Exception1 b(
708 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
709 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
712 css::uno::Reference< Interface1 > i(new Impl1);
713 css::uno::Reference< Interface1 > b(i);
714 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
718 void Test::testLong() {
719 css::uno::Any a(static_cast< sal_Int32 >(1));
720 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<sal_Int32>::get());
722 bool b = true;
723 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
726 sal_Bool b = true;
727 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
730 sal_Int8 b = 2;
731 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
734 sal_uInt8 b = 2;
735 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
738 sal_Int16 b = 2;
739 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
742 sal_uInt16 b = 2;
743 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
746 sal_Int32 b = 2;
747 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
750 sal_uInt32 b = 2;
751 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
754 sal_Int64 b = 2;
755 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
758 sal_uInt64 b = 2;
759 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
762 float b = 2;
763 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
766 double b = 2;
767 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
770 sal_Unicode b = '2';
771 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
774 rtl::OUString b("2");
775 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
778 css::uno::Type b(cppu::UnoType<OUString>::get());
779 CPPUNIT_ASSERT_MESSAGE(
780 "css::uno::Type",
781 !(a >>= b) && b == cppu::UnoType<OUString>::get());
784 css::uno::Any b(rtl::OUString("2"));
785 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
788 css::uno::Sequence< rtl::OUString > b(2);
789 CPPUNIT_ASSERT_MESSAGE(
790 "css::uno::Sequence<rtl::OUString>",
791 !(a >>= b) && b.getLength() == 2);
794 Enum1 b = Enum1_M2;
795 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
798 Struct1 b(2);
799 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
802 Exception1 b(
803 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
804 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
807 css::uno::Reference< Interface1 > i(new Impl1);
808 css::uno::Reference< Interface1 > b(i);
809 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
813 void Test::testUnsignedLong() {
814 css::uno::Any a(static_cast< sal_uInt32 >(1));
815 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<sal_uInt32>::get());
817 bool b = true;
818 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
821 sal_Bool b = true;
822 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
825 sal_Int8 b = 2;
826 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
829 sal_uInt8 b = 2;
830 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
833 sal_Int16 b = 2;
834 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
837 sal_uInt16 b = 2;
838 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
841 sal_Int32 b = 2;
842 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
845 sal_uInt32 b = 2;
846 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
849 sal_Int64 b = 2;
850 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
853 sal_uInt64 b = 2;
854 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
857 float b = 2;
858 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
861 double b = 2;
862 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
865 sal_Unicode b = '2';
866 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
869 rtl::OUString b("2");
870 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
873 css::uno::Type b(cppu::UnoType<OUString>::get());
874 CPPUNIT_ASSERT_MESSAGE(
875 "css::uno::Type",
876 !(a >>= b) && b == cppu::UnoType<OUString>::get());
879 css::uno::Any b(rtl::OUString("2"));
880 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
883 css::uno::Sequence< rtl::OUString > b(2);
884 CPPUNIT_ASSERT_MESSAGE(
885 "css::uno::Sequence<rtl::OUString>",
886 !(a >>= b) && b.getLength() == 2);
889 Enum1 b = Enum1_M2;
890 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
893 Struct1 b(2);
894 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
897 Exception1 b(
898 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
899 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
902 css::uno::Reference< Interface1 > i(new Impl1);
903 css::uno::Reference< Interface1 > b(i);
904 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
908 void Test::testHyper() {
909 css::uno::Any a(static_cast< sal_Int64 >(1));
910 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<sal_Int64>::get());
912 bool b = true;
913 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
916 sal_Bool b = true;
917 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
920 sal_Int8 b = 2;
921 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
924 sal_uInt8 b = 2;
925 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
928 sal_Int16 b = 2;
929 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
932 sal_uInt16 b = 2;
933 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
936 sal_Int32 b = 2;
937 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
940 sal_uInt32 b = 2;
941 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
944 sal_Int64 b = 2;
945 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
948 sal_uInt64 b = 2;
949 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
952 float b = 2;
953 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
956 double b = 2;
957 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
960 sal_Unicode b = '2';
961 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
964 rtl::OUString b("2");
965 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
968 css::uno::Type b(cppu::UnoType<OUString>::get());
969 CPPUNIT_ASSERT_MESSAGE(
970 "css::uno::Type",
971 !(a >>= b) && b == cppu::UnoType<OUString>::get());
974 css::uno::Any b(rtl::OUString("2"));
975 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
978 css::uno::Sequence< rtl::OUString > b(2);
979 CPPUNIT_ASSERT_MESSAGE(
980 "css::uno::Sequence<rtl::OUString>",
981 !(a >>= b) && b.getLength() == 2);
984 Enum1 b = Enum1_M2;
985 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
988 Struct1 b(2);
989 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
992 Exception1 b(
993 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
994 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
997 css::uno::Reference< Interface1 > i(new Impl1);
998 css::uno::Reference< Interface1 > b(i);
999 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1003 void Test::testUnsignedHyper() {
1004 css::uno::Any a(static_cast< sal_uInt64 >(1));
1005 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<sal_uInt64>::get());
1007 bool b = true;
1008 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1011 sal_Bool b = true;
1012 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1015 sal_Int8 b = 2;
1016 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1019 sal_uInt8 b = 2;
1020 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1023 sal_Int16 b = 2;
1024 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1027 sal_uInt16 b = 2;
1028 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1031 sal_Int32 b = 2;
1032 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1035 sal_uInt32 b = 2;
1036 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1039 sal_Int64 b = 2;
1040 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
1043 sal_uInt64 b = 2;
1044 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
1047 float b = 2;
1048 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1051 double b = 2;
1052 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1055 sal_Unicode b = '2';
1056 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1059 rtl::OUString b("2");
1060 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1063 css::uno::Type b(cppu::UnoType<OUString>::get());
1064 CPPUNIT_ASSERT_MESSAGE(
1065 "css::uno::Type",
1066 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1069 css::uno::Any b(rtl::OUString("2"));
1070 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1073 css::uno::Sequence< rtl::OUString > b(2);
1074 CPPUNIT_ASSERT_MESSAGE(
1075 "css::uno::Sequence<rtl::OUString>",
1076 !(a >>= b) && b.getLength() == 2);
1079 Enum1 b = Enum1_M2;
1080 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1083 Struct1 b(2);
1084 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1087 Exception1 b(
1088 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1089 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1092 css::uno::Reference< Interface1 > i(new Impl1);
1093 css::uno::Reference< Interface1 > b(i);
1094 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1098 void Test::testFloat() {
1099 css::uno::Any a(1.f);
1100 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<float>::get());
1102 bool b = true;
1103 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1106 sal_Bool b = true;
1107 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1110 sal_Int8 b = 2;
1111 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1114 sal_uInt8 b = 2;
1115 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1118 sal_Int16 b = 2;
1119 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1122 sal_uInt16 b = 2;
1123 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1126 sal_Int32 b = 2;
1127 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1130 sal_uInt32 b = 2;
1131 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1134 sal_Int64 b = 2;
1135 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1138 sal_uInt64 b = 2;
1139 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1142 float b = 2;
1143 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
1146 double b = 2;
1147 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1150 sal_Unicode b = '2';
1151 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1154 rtl::OUString b("2");
1155 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1158 css::uno::Type b(cppu::UnoType<OUString>::get());
1159 CPPUNIT_ASSERT_MESSAGE(
1160 "css::uno::Type",
1161 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1164 css::uno::Any b(rtl::OUString("2"));
1165 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1168 css::uno::Sequence< rtl::OUString > b(2);
1169 CPPUNIT_ASSERT_MESSAGE(
1170 "css::uno::Sequence<rtl::OUString>",
1171 !(a >>= b) && b.getLength() == 2);
1174 Enum1 b = Enum1_M2;
1175 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1178 Struct1 b(2);
1179 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1182 Exception1 b(
1183 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1184 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1187 css::uno::Reference< Interface1 > i(new Impl1);
1188 css::uno::Reference< Interface1 > b(i);
1189 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1193 void Test::testDouble() {
1194 css::uno::Any a(1.);
1195 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<double>::get());
1197 bool b = true;
1198 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1201 sal_Bool b = true;
1202 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1205 sal_Int8 b = 2;
1206 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1209 sal_uInt8 b = 2;
1210 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1213 sal_Int16 b = 2;
1214 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1217 sal_uInt16 b = 2;
1218 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1221 sal_Int32 b = 2;
1222 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1225 sal_uInt32 b = 2;
1226 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1229 sal_Int64 b = 2;
1230 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1233 sal_uInt64 b = 2;
1234 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1237 float b = 2;
1238 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1241 double b = 2;
1242 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1245 sal_Unicode b = '2';
1246 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1249 rtl::OUString b("2");
1250 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1253 css::uno::Type b(cppu::UnoType<OUString>::get());
1254 CPPUNIT_ASSERT_MESSAGE(
1255 "css::uno::Type",
1256 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1259 css::uno::Any b(rtl::OUString("2"));
1260 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1263 css::uno::Sequence< rtl::OUString > b(2);
1264 CPPUNIT_ASSERT_MESSAGE(
1265 "css::uno::Sequence<rtl::OUString>",
1266 !(a >>= b) && b.getLength() == 2);
1269 Enum1 b = Enum1_M2;
1270 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1273 Struct1 b(2);
1274 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1277 Exception1 b(
1278 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1279 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1282 css::uno::Reference< Interface1 > i(new Impl1);
1283 css::uno::Reference< Interface1 > b(i);
1284 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1288 void Test::testChar() {
1289 sal_Unicode c = '1';
1290 css::uno::Any a(&c, cppu::UnoType<cppu::UnoCharType>::get());
1291 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<cppu::UnoCharType>::get());
1293 bool b = true;
1294 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1297 sal_Bool b = true;
1298 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1301 sal_Int8 b = 2;
1302 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1305 sal_uInt8 b = 2;
1306 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1309 sal_Int16 b = 2;
1310 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1313 sal_uInt16 b = 2;
1314 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1317 sal_Int32 b = 2;
1318 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1321 sal_uInt32 b = 2;
1322 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1325 sal_Int64 b = 2;
1326 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1329 sal_uInt64 b = 2;
1330 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1333 float b = 2;
1334 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1337 double b = 2;
1338 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1341 sal_Unicode b = '2';
1342 if (boost::is_same< sal_Unicode, sal_uInt16 >::value) {
1343 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", !(a >>= b) && b == '2');
1344 } else {
1345 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", (a >>= b) && b == '1');
1349 rtl::OUString b("2");
1350 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1353 css::uno::Type b(cppu::UnoType<OUString>::get());
1354 CPPUNIT_ASSERT_MESSAGE(
1355 "css::uno::Type",
1356 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1359 css::uno::Any b(rtl::OUString("2"));
1360 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1363 css::uno::Sequence< rtl::OUString > b(2);
1364 CPPUNIT_ASSERT_MESSAGE(
1365 "css::uno::Sequence<rtl::OUString>",
1366 !(a >>= b) && b.getLength() == 2);
1369 Enum1 b = Enum1_M2;
1370 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1373 Struct1 b(2);
1374 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1377 Exception1 b(
1378 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1379 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1382 css::uno::Reference< Interface1 > i(new Impl1);
1383 css::uno::Reference< Interface1 > b(i);
1384 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1388 void Test::testString() {
1389 css::uno::Any a(rtl::OUString("1"));
1390 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<OUString>::get());
1392 bool b = true;
1393 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1396 sal_Bool b = true;
1397 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1400 sal_Int8 b = 2;
1401 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1404 sal_uInt8 b = 2;
1405 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1408 sal_Int16 b = 2;
1409 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1412 sal_uInt16 b = 2;
1413 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1416 sal_Int32 b = 2;
1417 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1420 sal_uInt32 b = 2;
1421 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1424 sal_Int64 b = 2;
1425 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1428 sal_uInt64 b = 2;
1429 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1432 float b = 2;
1433 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1436 double b = 2;
1437 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1440 sal_Unicode b = '2';
1441 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1444 rtl::OUString b("2");
1445 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", (a >>= b) && b == "1" );
1448 css::uno::Type b(cppu::UnoType<OUString>::get());
1449 CPPUNIT_ASSERT_MESSAGE(
1450 "css::uno::Type",
1451 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1454 css::uno::Any b(rtl::OUString("2"));
1455 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1458 css::uno::Sequence< rtl::OUString > b(2);
1459 CPPUNIT_ASSERT_MESSAGE(
1460 "css::uno::Sequence<rtl::OUString>",
1461 !(a >>= b) && b.getLength() == 2);
1464 Enum1 b = Enum1_M2;
1465 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1468 Struct1 b(2);
1469 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1472 Exception1 b(
1473 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1474 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1477 css::uno::Reference< Interface1 > i(new Impl1);
1478 css::uno::Reference< Interface1 > b(i);
1479 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1483 void Test::testType() {
1484 css::uno::Any a(cppu::UnoType<sal_Int32>::get());
1485 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<css::uno::Type>::get());
1487 bool b = true;
1488 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1491 sal_Bool b = true;
1492 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1495 sal_Int8 b = 2;
1496 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1499 sal_uInt8 b = 2;
1500 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1503 sal_Int16 b = 2;
1504 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1507 sal_uInt16 b = 2;
1508 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1511 sal_Int32 b = 2;
1512 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1515 sal_uInt32 b = 2;
1516 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1519 sal_Int64 b = 2;
1520 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1523 sal_uInt64 b = 2;
1524 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1527 float b = 2;
1528 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1531 double b = 2;
1532 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1535 sal_Unicode b = '2';
1536 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1539 rtl::OUString b("2");
1540 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1543 css::uno::Type b(cppu::UnoType<OUString>::get());
1544 CPPUNIT_ASSERT_MESSAGE(
1545 "css::uno::Type", (a >>= b) && b == cppu::UnoType<sal_Int32>::get());
1548 css::uno::Any b(rtl::OUString("2"));
1549 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1552 css::uno::Sequence< rtl::OUString > b(2);
1553 CPPUNIT_ASSERT_MESSAGE(
1554 "css::uno::Sequence<rtl::OUString>",
1555 !(a >>= b) && b.getLength() == 2);
1558 Enum1 b = Enum1_M2;
1559 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1562 Struct1 b(2);
1563 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1566 Exception1 b(
1567 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1568 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1571 css::uno::Reference< Interface1 > i(new Impl1);
1572 css::uno::Reference< Interface1 > b(i);
1573 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1577 void Test::testSequence() {
1578 sal_Int32 n = 1;
1579 css::uno::Any a(css::uno::Sequence< sal_Int32 >(&n, 1));
1580 CPPUNIT_ASSERT(
1581 a.getValueType()
1582 == cppu::UnoType<css::uno::Sequence<sal_Int32>>::get());
1584 bool b = true;
1585 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1588 sal_Bool b = true;
1589 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1592 sal_Int8 b = 2;
1593 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1596 sal_uInt8 b = 2;
1597 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1600 sal_Int16 b = 2;
1601 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1604 sal_uInt16 b = 2;
1605 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1608 sal_Int32 b = 2;
1609 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1612 sal_uInt32 b = 2;
1613 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1616 sal_Int64 b = 2;
1617 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1620 sal_uInt64 b = 2;
1621 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1624 float b = 2;
1625 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1628 double b = 2;
1629 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1632 sal_Unicode b = '2';
1633 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1636 rtl::OUString b("2");
1637 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1640 css::uno::Type b(cppu::UnoType<OUString>::get());
1641 CPPUNIT_ASSERT_MESSAGE(
1642 "css::uno::Type",
1643 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1646 css::uno::Any b(rtl::OUString("2"));
1647 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1650 css::uno::Sequence< rtl::OUString > b(2);
1651 CPPUNIT_ASSERT_MESSAGE(
1652 "css::uno::Sequence<rtl::OUString>",
1653 !(a >>= b) && b.getLength() == 2);
1656 css::uno::Sequence< sal_Int32 > b(2);
1657 CPPUNIT_ASSERT_MESSAGE(
1658 "css::uno::Sequence<sal_Int32>",
1659 (a >>= b) && b.getLength() == 1 && b[0] == 1);
1662 Enum1 b = Enum1_M2;
1663 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1666 Struct1 b(2);
1667 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1670 Exception1 b(
1671 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1672 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1675 css::uno::Reference< Interface1 > i(new Impl1);
1676 css::uno::Reference< Interface1 > b(i);
1677 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1681 void Test::testEnum() {
1682 css::uno::Any a(Enum2_M1);
1683 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<Enum2>::get());
1685 bool b = true;
1686 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1689 sal_Bool b = true;
1690 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1693 sal_Int8 b = 2;
1694 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1697 sal_uInt8 b = 2;
1698 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1701 sal_Int16 b = 2;
1702 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1705 sal_uInt16 b = 2;
1706 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1709 sal_Int32 b = 2;
1710 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1713 sal_uInt32 b = 2;
1714 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1717 sal_Int64 b = 2;
1718 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1721 sal_uInt64 b = 2;
1722 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1725 float b = 2;
1726 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1729 double b = 2;
1730 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1733 sal_Unicode b = '2';
1734 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1737 rtl::OUString b("2");
1738 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1741 css::uno::Type b(cppu::UnoType<OUString>::get());
1742 CPPUNIT_ASSERT_MESSAGE(
1743 "css::uno::Type",
1744 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1747 css::uno::Any b(rtl::OUString("2"));
1748 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1751 css::uno::Sequence< rtl::OUString > b(2);
1752 CPPUNIT_ASSERT_MESSAGE(
1753 "css::uno::Sequence<rtl::OUString>",
1754 !(a >>= b) && b.getLength() == 2);
1757 Enum1 b = Enum1_M2;
1758 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1761 Enum2 b = Enum2_M2;
1762 CPPUNIT_ASSERT_MESSAGE("Enum2", (a >>= b) && b == Enum2_M1);
1765 Struct1 b(2);
1766 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1769 Exception1 b(
1770 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1771 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1774 css::uno::Reference< Interface1 > i(new Impl1);
1775 css::uno::Reference< Interface1 > b(i);
1776 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1780 void Test::testStruct() {
1781 css::uno::Any a(Struct2a(1, 3));
1782 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<Struct2a>::get());
1784 bool b = true;
1785 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1788 sal_Bool b = true;
1789 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1792 sal_Int8 b = 2;
1793 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1796 sal_uInt8 b = 2;
1797 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1800 sal_Int16 b = 2;
1801 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1804 sal_uInt16 b = 2;
1805 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1808 sal_Int32 b = 2;
1809 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1812 sal_uInt32 b = 2;
1813 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1816 sal_Int64 b = 2;
1817 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1820 sal_uInt64 b = 2;
1821 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1824 float b = 2;
1825 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1828 double b = 2;
1829 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1832 sal_Unicode b = '2';
1833 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1836 rtl::OUString b("2");
1837 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1840 css::uno::Type b(cppu::UnoType<OUString>::get());
1841 CPPUNIT_ASSERT_MESSAGE(
1842 "css::uno::Type",
1843 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1846 css::uno::Any b(rtl::OUString("2"));
1847 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1850 css::uno::Sequence< rtl::OUString > b(2);
1851 CPPUNIT_ASSERT_MESSAGE(
1852 "css::uno::Sequence<rtl::OUString>",
1853 !(a >>= b) && b.getLength() == 2);
1856 Enum1 b = Enum1_M2;
1857 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1860 Struct1 b(2);
1861 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1864 Struct2 b(2);
1865 CPPUNIT_ASSERT_MESSAGE("Struct2", (a >>= b) && b.member == 1);
1868 Struct2a b(2, 2);
1869 CPPUNIT_ASSERT_MESSAGE(
1870 "Struct2a", (a >>= b) && b.member == 1 && b.member2 == 3);
1873 Struct2b b(2, 2, 2);
1874 CPPUNIT_ASSERT_MESSAGE("Struct2b", !(a >>= b) && b.member == 2);
1877 Exception1 b(
1878 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1879 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1882 css::uno::Reference< Interface1 > i(new Impl1);
1883 css::uno::Reference< Interface1 > b(i);
1884 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1888 void Test::testPoly() {
1889 css::uno::Any a;
1890 a <<= Poly< css::uno::Sequence< ::sal_Unicode > >();
1891 CPPUNIT_ASSERT_MESSAGE( "type name", a.getValueType().getTypeName() == "Poly<[]char>" );
1892 CPPUNIT_ASSERT_MESSAGE(
1893 "constructor",
1894 a == css::uno::Any(Poly< css::uno::Sequence< ::sal_Unicode > >()));
1897 void Test::testException() {
1898 css::uno::Any a(
1899 Exception2a(
1900 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 1,
1901 3));
1902 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<Exception2a>::get());
1904 bool b = true;
1905 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1908 sal_Bool b = true;
1909 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1912 sal_Int8 b = 2;
1913 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1916 sal_uInt8 b = 2;
1917 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
1920 sal_Int16 b = 2;
1921 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1924 sal_uInt16 b = 2;
1925 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1928 sal_Int32 b = 2;
1929 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1932 sal_uInt32 b = 2;
1933 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1936 sal_Int64 b = 2;
1937 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1940 sal_uInt64 b = 2;
1941 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1944 float b = 2;
1945 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1948 double b = 2;
1949 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1952 sal_Unicode b = '2';
1953 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1956 rtl::OUString b("2");
1957 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
1960 css::uno::Type b(cppu::UnoType<OUString>::get());
1961 CPPUNIT_ASSERT_MESSAGE(
1962 "css::uno::Type",
1963 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1966 css::uno::Any b(rtl::OUString("2"));
1967 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
1970 css::uno::Sequence< rtl::OUString > b(2);
1971 CPPUNIT_ASSERT_MESSAGE(
1972 "css::uno::Sequence<rtl::OUString>",
1973 !(a >>= b) && b.getLength() == 2);
1976 Enum1 b = Enum1_M2;
1977 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1980 Struct1 b(2);
1981 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1984 Exception1 b(
1985 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1986 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1989 Exception2 b(
1990 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1991 CPPUNIT_ASSERT_MESSAGE("Exception2", (a >>= b) && b.member == 1);
1994 Exception2a b(
1995 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
1997 CPPUNIT_ASSERT_MESSAGE(
1998 "Exception2a", (a >>= b) && b.member == 1 && b.member2 == 3);
2001 Exception2b b(
2002 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2004 CPPUNIT_ASSERT_MESSAGE("Exception2b", !(a >>= b) && b.member == 2);
2007 css::uno::Reference< Interface1 > i(new Impl1);
2008 css::uno::Reference< Interface1 > b(i);
2009 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2013 void Test::testInterface() {
2014 css::uno::Reference< Interface2a > i2(new Impl2);
2015 css::uno::Any a(i2);
2016 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<Interface2a>::get());
2018 bool b = true;
2019 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2022 sal_Bool b = true;
2023 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2026 sal_Int8 b = 2;
2027 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2030 sal_uInt8 b = 2;
2031 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2034 sal_Int16 b = 2;
2035 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2038 sal_uInt16 b = 2;
2039 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2042 sal_Int32 b = 2;
2043 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2046 sal_uInt32 b = 2;
2047 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2050 sal_Int64 b = 2;
2051 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2054 sal_uInt64 b = 2;
2055 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2058 float b = 2;
2059 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2062 double b = 2;
2063 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2066 sal_Unicode b = '2';
2067 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2070 rtl::OUString b("2");
2071 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
2074 css::uno::Type b(cppu::UnoType<OUString>::get());
2075 CPPUNIT_ASSERT_MESSAGE(
2076 "css::uno::Type",
2077 !(a >>= b) && b == cppu::UnoType<OUString>::get());
2080 css::uno::Any b(rtl::OUString("2"));
2081 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2084 css::uno::Sequence< rtl::OUString > b(2);
2085 CPPUNIT_ASSERT_MESSAGE(
2086 "css::uno::Sequence<rtl::OUString>",
2087 !(a >>= b) && b.getLength() == 2);
2090 Enum1 b = Enum1_M2;
2091 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2094 Struct1 b(2);
2095 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2098 Exception1 b(
2099 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2100 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2103 css::uno::Reference< Interface1 > i(new Impl1);
2104 css::uno::Reference< Interface1 > b(i);
2105 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
2108 css::uno::Reference< Interface2 > b(new Impl2);
2109 CPPUNIT_ASSERT_MESSAGE("Interface2", (a >>= b) && b == i2);
2112 css::uno::Reference< Interface2a > b(new Impl2);
2113 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && b == i2);
2116 css::uno::Reference< Interface2b > i(new Impl2b);
2117 css::uno::Reference< Interface2b > b(i);
2118 CPPUNIT_ASSERT_MESSAGE("Interface2b", !(a >>= b) && b == i);
2121 css::uno::Reference< Interface3 > b(new Impl2);
2122 CPPUNIT_ASSERT_MESSAGE("Interface3", (a >>= b) && b == i2);
2126 void Test::testNull() {
2127 css::uno::Any a = css::uno::Any(css::uno::Reference< Interface2a >());
2128 CPPUNIT_ASSERT(a.getValueType() == cppu::UnoType<Interface2a>::get());
2130 bool b = true;
2131 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2134 sal_Bool b = true;
2135 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2138 sal_Int8 b = 2;
2139 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2142 sal_uInt8 b = 2;
2143 CPPUNIT_ASSERT_MESSAGE("sal_uInt8", !(a >>= b) && b == 2);
2146 sal_Int16 b = 2;
2147 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2150 sal_uInt16 b = 2;
2151 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2154 sal_Int32 b = 2;
2155 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2158 sal_uInt32 b = 2;
2159 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2162 sal_Int64 b = 2;
2163 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2166 sal_uInt64 b = 2;
2167 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2170 float b = 2;
2171 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2174 double b = 2;
2175 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2178 sal_Unicode b = '2';
2179 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2182 rtl::OUString b("2");
2183 CPPUNIT_ASSERT_MESSAGE( "rtl::OUString", !(a >>= b) && b == "2" );
2186 css::uno::Type b(cppu::UnoType<OUString>::get());
2187 CPPUNIT_ASSERT_MESSAGE(
2188 "css::uno::Type",
2189 !(a >>= b) && b == cppu::UnoType<OUString>::get());
2192 css::uno::Any b(rtl::OUString("2"));
2193 CPPUNIT_ASSERT_MESSAGE("css::uno::Any", (a >>= b) && b == a);
2196 css::uno::Sequence< rtl::OUString > b(2);
2197 CPPUNIT_ASSERT_MESSAGE(
2198 "css::uno::Sequence<rtl::OUString>",
2199 !(a >>= b) && b.getLength() == 2);
2202 Enum1 b = Enum1_M2;
2203 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2206 Struct1 b(2);
2207 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2210 Exception1 b(
2211 rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2212 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2215 css::uno::Reference< Interface1 > b(new Impl1);
2216 CPPUNIT_ASSERT_MESSAGE(
2217 "Interface1", (a >>= b) && !b.is());
2220 css::uno::Reference< Interface2 > b(new Impl2);
2221 CPPUNIT_ASSERT_MESSAGE(
2222 "Interface2", (a >>= b) && !b.is());
2225 css::uno::Reference< Interface2a > b(new Impl2);
2226 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && !b.is());
2229 css::uno::Reference< Interface2b > b(new Impl2b);
2230 CPPUNIT_ASSERT_MESSAGE(
2231 "Interface2b", (a >>= b) && !b.is());
2234 css::uno::Reference< Interface3 > b(new Impl2);
2235 CPPUNIT_ASSERT_MESSAGE(
2236 "Interface3", (a >>= b) && !b.is());
2240 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
2244 CPPUNIT_PLUGIN_IMPLEMENT();
2246 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */