nss: upgrade to release 3.73
[LibreOffice.git] / cppu / qa / test_any.cxx
blob7dfed7a714dec7e0b426a5eaeeb70efdcca22598
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>
23 #include <type_traits>
25 #include <cppunit/TestFixture.h>
26 #include <cppunit/plugin/TestPlugIn.h>
27 #include <cppunit/extensions/HelperMacros.h>
29 #include <Enum1.hpp>
30 #include <Enum2.hpp>
31 #include <Exception1.hpp>
32 #include <Exception2.hpp>
33 #include <Exception2a.hpp>
34 #include <Exception2b.hpp>
35 #include <Interface1.hpp>
36 #include <Interface2.hpp>
37 #include <Interface2a.hpp>
38 #include <Interface2b.hpp>
39 #include <Interface3.hpp>
40 #include <Poly.hpp>
41 #include <Struct1.hpp>
42 #include <Struct2.hpp>
43 #include <Struct2a.hpp>
44 #include <Struct2b.hpp>
45 #include <com/sun/star/uno/Any.hxx>
46 #include <com/sun/star/uno/Reference.hxx>
47 #include <com/sun/star/uno/Sequence.hxx>
48 #include <com/sun/star/uno/Type.hxx>
49 #include <o3tl/cppunittraitshelper.hxx>
50 #include <osl/interlck.h>
51 #include <rtl/ustring.hxx>
53 namespace {
55 class Base {
56 public:
57 Base(): m_count(0) {}
59 Base(const Base&) = delete;
60 const Base& operator=(const Base&) = delete;
62 void acquire() {
63 if (osl_atomic_increment(&m_count) == SAL_MAX_INT32) {
64 abort();
68 void release() {
69 if (osl_atomic_decrement(&m_count) == 0) {
70 delete this;
74 protected:
75 virtual ~Base() {}
77 private:
78 oslInterlockedCount m_count;
81 class Impl1: public Interface1, private Base {
82 public:
83 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override
85 if (type == cppu::UnoType<css::uno::XInterface>::get()) {
86 css::uno::Reference< css::uno::XInterface > ref(
87 static_cast< css::uno::XInterface * >(this));
88 return css::uno::Any(&ref, type);
90 if (type == cppu::UnoType<Interface1>::get()) {
91 css::uno::Reference< Interface1 > ref(this);
92 return css::uno::Any(&ref, type);
94 return css::uno::Any();
97 virtual void SAL_CALL acquire() throw () override {
98 Base::acquire();
101 virtual void SAL_CALL release() throw () override {
102 Base::release();
106 class Impl2: public Interface2a, public Interface3, private Base {
107 public:
108 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override
110 if (type == cppu::UnoType<css::uno::XInterface>::get()) {
111 css::uno::Reference< css::uno::XInterface > ref(
112 static_cast< css::uno::XInterface * >(
113 static_cast< Interface2a * >(this)));
114 return css::uno::Any(&ref, type);
116 if (type == cppu::UnoType<Interface2>::get()) {
117 css::uno::Reference< Interface2 > ref(this);
118 return css::uno::Any(&ref, type);
120 if (type == cppu::UnoType<Interface2a>::get()) {
121 css::uno::Reference< Interface2a > ref(this);
122 return css::uno::Any(&ref, type);
124 if (type == cppu::UnoType<Interface3>::get()) {
125 css::uno::Reference< Interface3 > ref(this);
126 return css::uno::Any(&ref, type);
128 return css::uno::Any();
131 virtual void SAL_CALL acquire() throw () override {
132 Base::acquire();
135 virtual void SAL_CALL release() throw () override {
136 Base::release();
140 class Impl2b: public Interface2b, private Base {
141 public:
142 virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override
144 if (type == cppu::UnoType<css::uno::XInterface>::get()) {
145 css::uno::Reference< css::uno::XInterface > ref(
146 static_cast< css::uno::XInterface * >(
147 static_cast< Interface2a * >(this)));
148 return css::uno::Any(&ref, type);
150 if (type == cppu::UnoType<Interface2>::get()) {
151 css::uno::Reference< Interface2 > ref(this);
152 return css::uno::Any(&ref, type);
154 if (type == cppu::UnoType<Interface2a>::get()) {
155 css::uno::Reference< Interface2a > ref(this);
156 return css::uno::Any(&ref, type);
158 if (type == cppu::UnoType<Interface2b>::get()) {
159 css::uno::Reference< Interface2b > ref(this);
160 return css::uno::Any(&ref, type);
162 return css::uno::Any();
165 virtual void SAL_CALL acquire() throw () override {
166 Base::acquire();
169 virtual void SAL_CALL release() throw () override {
170 Base::release();
174 class Test: public CppUnit::TestFixture {
175 public:
176 void testVoid();
177 void testBoolean();
178 void testByte();
179 void testShort();
180 void testUnsignedShort();
181 void testLong();
182 void testUnsignedLong();
183 void testHyper();
184 void testUnsignedHyper();
185 void testFloat();
186 void testDouble();
187 void testChar();
188 void testString();
189 void testType();
190 void testSequence();
191 void testEnum();
192 void testStruct();
193 void testPoly();
194 void testException();
195 void testInterface();
196 void testNull();
198 CPPUNIT_TEST_SUITE(Test);
199 CPPUNIT_TEST(testVoid);
200 CPPUNIT_TEST(testBoolean);
201 CPPUNIT_TEST(testByte);
202 CPPUNIT_TEST(testShort);
203 CPPUNIT_TEST(testUnsignedShort);
204 CPPUNIT_TEST(testLong);
205 CPPUNIT_TEST(testUnsignedLong);
206 CPPUNIT_TEST(testHyper);
207 CPPUNIT_TEST(testUnsignedHyper);
208 CPPUNIT_TEST(testFloat);
209 CPPUNIT_TEST(testDouble);
210 CPPUNIT_TEST(testChar);
211 CPPUNIT_TEST(testString);
212 CPPUNIT_TEST(testType);
213 CPPUNIT_TEST(testSequence);
214 CPPUNIT_TEST(testEnum);
215 CPPUNIT_TEST(testStruct);
216 CPPUNIT_TEST(testPoly);
217 CPPUNIT_TEST(testException);
218 CPPUNIT_TEST(testInterface);
219 CPPUNIT_TEST(testNull);
220 CPPUNIT_TEST_SUITE_END();
223 void Test::testVoid() {
224 css::uno::Any a;
225 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<void>::get()));
227 bool b = true;
228 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
229 CPPUNIT_ASSERT_MESSAGE("bool", b);
232 sal_Bool b = true;
233 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
234 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
237 sal_Int8 b = 2;
238 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
239 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
242 sal_Int16 b = 2;
243 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
244 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
247 sal_uInt16 b = 2;
248 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
249 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
252 sal_Int32 b = 2;
253 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
254 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
257 sal_uInt32 b = 2;
258 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
259 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
262 sal_Int64 b = 2;
263 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
264 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
267 sal_uInt64 b = 2;
268 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
269 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
272 float b = 2;
273 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
274 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", 2.0f, b);
277 double b = 2;
278 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
279 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
282 sal_Unicode b = '2';
283 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
284 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
287 OUString b("2");
288 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
289 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
292 css::uno::Type b(cppu::UnoType<OUString>::get());
293 CPPUNIT_ASSERT_MESSAGE(
294 "css::uno::Type",
295 !(a >>= b));
296 CPPUNIT_ASSERT_EQUAL_MESSAGE(
297 "css::uno::Type",
298 cppu::UnoType<OUString>::get(), b);
301 css::uno::Sequence< OUString > b(2);
302 CPPUNIT_ASSERT_MESSAGE(
303 "css::uno::Sequence<OUString>", !(a >>= b));
304 CPPUNIT_ASSERT_EQUAL_MESSAGE(
305 "css::uno::Sequence<OUString>", sal_Int32(2), b.getLength());
308 Enum1 b = Enum1_M2;
309 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
310 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
313 Struct1 b(2);
314 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
315 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
318 Exception1 b(
319 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
320 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
321 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
324 css::uno::Reference< Interface1 > i(new Impl1);
325 css::uno::Reference< Interface1 > b(i);
326 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
327 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
331 void Test::testBoolean() {
332 css::uno::Any a(false);
333 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<bool>::get()));
335 bool b = true;
336 CPPUNIT_ASSERT_MESSAGE("bool", (a >>= b));
337 CPPUNIT_ASSERT_MESSAGE("bool", !b);
340 sal_Bool b = true;
341 CPPUNIT_ASSERT_MESSAGE("sal_Bool", (a >>= b));
342 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !b);
345 sal_Int8 b = 2;
346 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
347 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
350 sal_Int16 b = 2;
351 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
352 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
355 sal_uInt16 b = 2;
356 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
357 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
360 sal_Int32 b = 2;
361 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
362 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
365 sal_uInt32 b = 2;
366 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
367 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
370 sal_Int64 b = 2;
371 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
372 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
375 sal_uInt64 b = 2;
376 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
377 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
380 float b = 2;
381 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
382 CPPUNIT_ASSERT_EQUAL_MESSAGE("float", 2.0f, b);
385 double b = 2;
386 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
387 CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
390 sal_Unicode b = '2';
391 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
392 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
395 OUString b("2");
396 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
397 CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
400 css::uno::Type b(cppu::UnoType<OUString>::get());
401 CPPUNIT_ASSERT_MESSAGE(
402 "css::uno::Type",
403 !(a >>= b));
404 CPPUNIT_ASSERT_EQUAL_MESSAGE(
405 "css::uno::Type",
406 cppu::UnoType<OUString>::get(), b);
409 css::uno::Sequence< OUString > b(2);
410 CPPUNIT_ASSERT_MESSAGE(
411 "css::uno::Sequence<OUString>",
412 !(a >>= b));
413 CPPUNIT_ASSERT_EQUAL_MESSAGE(
414 "css::uno::Sequence<OUString>",
415 sal_Int32(2), b.getLength());
418 Enum1 b = Enum1_M2;
419 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
420 CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
423 Struct1 b(2);
424 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
425 CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
428 Exception1 b(
429 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
430 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
431 CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
434 css::uno::Reference< Interface1 > i(new Impl1);
435 css::uno::Reference< Interface1 > b(i);
436 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
437 CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
441 void Test::testByte() {
442 css::uno::Any a(static_cast< sal_Int8 >(1));
443 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int8>::get()));
445 bool b = true;
446 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
447 CPPUNIT_ASSERT_MESSAGE("bool", b);
450 sal_Bool b = true;
451 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
452 CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
455 sal_Int8 b = 2;
456 CPPUNIT_ASSERT_MESSAGE("sal_Int8", (a >>= b));
457 CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(1), b);
460 sal_Int16 b = 2;
461 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
464 sal_uInt16 b = 2;
465 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
468 sal_Int32 b = 2;
469 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
472 sal_uInt32 b = 2;
473 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
476 sal_Int64 b = 2;
477 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
480 sal_uInt64 b = 2;
481 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
484 float b = 2;
485 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
488 double b = 2;
489 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
492 sal_Unicode b = '2';
493 if (std::is_same< sal_Unicode, sal_uInt16 >::value) {
494 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
495 } else {
496 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
500 OUString b("2");
501 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
504 css::uno::Type b(cppu::UnoType<OUString>::get());
505 CPPUNIT_ASSERT_MESSAGE(
506 "css::uno::Type",
507 !(a >>= b) && b == cppu::UnoType<OUString>::get());
510 css::uno::Sequence< OUString > b(2);
511 CPPUNIT_ASSERT_MESSAGE(
512 "css::uno::Sequence<OUString>",
513 !(a >>= b) && b.getLength() == 2);
516 Enum1 b = Enum1_M2;
517 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
520 Struct1 b(2);
521 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
524 Exception1 b(
525 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
526 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
529 css::uno::Reference< Interface1 > i(new Impl1);
530 css::uno::Reference< Interface1 > b(i);
531 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
535 void Test::testShort() {
536 css::uno::Any a(static_cast< sal_Int16 >(1));
537 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int16>::get()));
539 bool b = true;
540 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
543 sal_Bool b = true;
544 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
547 sal_Int8 b = 2;
548 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
551 sal_Int16 b = 2;
552 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
555 sal_uInt16 b = 2;
556 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
559 sal_Int32 b = 2;
560 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
563 sal_uInt32 b = 2;
564 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
567 sal_Int64 b = 2;
568 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
571 sal_uInt64 b = 2;
572 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
575 float b = 2;
576 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
579 double b = 2;
580 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
583 sal_Unicode b = '2';
584 if (std::is_same< sal_Unicode, sal_uInt16 >::value) {
585 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
586 } else {
587 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
591 OUString b("2");
592 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
595 css::uno::Type b(cppu::UnoType<OUString>::get());
596 CPPUNIT_ASSERT_MESSAGE(
597 "css::uno::Type",
598 !(a >>= b) && b == cppu::UnoType<OUString>::get());
601 css::uno::Sequence< OUString > b(2);
602 CPPUNIT_ASSERT_MESSAGE(
603 "css::uno::Sequence<OUString>",
604 !(a >>= b) && b.getLength() == 2);
607 Enum1 b = Enum1_M2;
608 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
611 Struct1 b(2);
612 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
615 Exception1 b(
616 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
617 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
620 css::uno::Reference< Interface1 > i(new Impl1);
621 css::uno::Reference< Interface1 > b(i);
622 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
626 void Test::testUnsignedShort() {
627 sal_uInt16 n = 1;
628 css::uno::Any a(&n, cppu::UnoType<cppu::UnoUnsignedShortType>::get());
629 CPPUNIT_ASSERT(
630 bool(a.getValueType() == cppu::UnoType<cppu::UnoUnsignedShortType>::get()));
632 bool b = true;
633 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
636 sal_Bool b = true;
637 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
640 sal_Int8 b = 2;
641 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
644 sal_Int16 b = 2;
645 CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b) && b == 1);
648 sal_uInt16 b = 2;
649 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b) && b == 1);
652 sal_Int32 b = 2;
653 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
656 sal_uInt32 b = 2;
657 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
660 sal_Int64 b = 2;
661 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
664 sal_uInt64 b = 2;
665 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
668 float b = 2;
669 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
672 double b = 2;
673 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
676 sal_Unicode b = '2';
677 if (std::is_same< sal_Unicode, sal_uInt16 >::value) {
678 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", (a >>= b) && b == 1);
679 } else {
680 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
684 OUString b("2");
685 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
688 css::uno::Type b(cppu::UnoType<OUString>::get());
689 CPPUNIT_ASSERT_MESSAGE(
690 "css::uno::Type",
691 !(a >>= b) && b == cppu::UnoType<OUString>::get());
694 css::uno::Sequence< OUString > b(2);
695 CPPUNIT_ASSERT_MESSAGE(
696 "css::uno::Sequence<OUString>",
697 !(a >>= b) && b.getLength() == 2);
700 Enum1 b = Enum1_M2;
701 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
704 Struct1 b(2);
705 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
708 Exception1 b(
709 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
710 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
713 css::uno::Reference< Interface1 > i(new Impl1);
714 css::uno::Reference< Interface1 > b(i);
715 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
719 void Test::testLong() {
720 css::uno::Any a(static_cast< sal_Int32 >(1));
721 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int32>::get()));
723 bool b = true;
724 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
727 sal_Bool b = true;
728 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
731 sal_Int8 b = 2;
732 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
735 sal_Int16 b = 2;
736 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
739 sal_uInt16 b = 2;
740 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
743 sal_Int32 b = 2;
744 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
747 sal_uInt32 b = 2;
748 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
751 sal_Int64 b = 2;
752 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
755 sal_uInt64 b = 2;
756 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
759 float b = 2;
760 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
763 double b = 2;
764 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
767 sal_Unicode b = '2';
768 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
771 OUString b("2");
772 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
775 css::uno::Type b(cppu::UnoType<OUString>::get());
776 CPPUNIT_ASSERT_MESSAGE(
777 "css::uno::Type",
778 !(a >>= b) && b == cppu::UnoType<OUString>::get());
781 css::uno::Sequence< OUString > b(2);
782 CPPUNIT_ASSERT_MESSAGE(
783 "css::uno::Sequence<OUString>",
784 !(a >>= b) && b.getLength() == 2);
787 Enum1 b = Enum1_M2;
788 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
791 Struct1 b(2);
792 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
795 Exception1 b(
796 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
797 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
800 css::uno::Reference< Interface1 > i(new Impl1);
801 css::uno::Reference< Interface1 > b(i);
802 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
806 void Test::testUnsignedLong() {
807 css::uno::Any a(static_cast< sal_uInt32 >(1));
808 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_uInt32>::get()));
810 bool b = true;
811 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
814 sal_Bool b = true;
815 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
818 sal_Int8 b = 2;
819 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
822 sal_Int16 b = 2;
823 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
826 sal_uInt16 b = 2;
827 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
830 sal_Int32 b = 2;
831 CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b) && b == 1);
834 sal_uInt32 b = 2;
835 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b) && b == 1);
838 sal_Int64 b = 2;
839 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
842 sal_uInt64 b = 2;
843 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
846 float b = 2;
847 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
850 double b = 2;
851 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
854 sal_Unicode b = '2';
855 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
858 OUString b("2");
859 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
862 css::uno::Type b(cppu::UnoType<OUString>::get());
863 CPPUNIT_ASSERT_MESSAGE(
864 "css::uno::Type",
865 !(a >>= b) && b == cppu::UnoType<OUString>::get());
868 css::uno::Sequence< OUString > b(2);
869 CPPUNIT_ASSERT_MESSAGE(
870 "css::uno::Sequence<OUString>",
871 !(a >>= b) && b.getLength() == 2);
874 Enum1 b = Enum1_M2;
875 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
878 Struct1 b(2);
879 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
882 Exception1 b(
883 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
884 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
887 css::uno::Reference< Interface1 > i(new Impl1);
888 css::uno::Reference< Interface1 > b(i);
889 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
893 void Test::testHyper() {
894 css::uno::Any a(static_cast< sal_Int64 >(1));
895 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int64>::get()));
897 bool b = true;
898 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
901 sal_Bool b = true;
902 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
905 sal_Int8 b = 2;
906 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
909 sal_Int16 b = 2;
910 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
913 sal_uInt16 b = 2;
914 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
917 sal_Int32 b = 2;
918 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
921 sal_uInt32 b = 2;
922 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
925 sal_Int64 b = 2;
926 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
929 sal_uInt64 b = 2;
930 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
933 float b = 2;
934 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
937 double b = 2;
938 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
941 sal_Unicode b = '2';
942 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
945 OUString b("2");
946 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
949 css::uno::Type b(cppu::UnoType<OUString>::get());
950 CPPUNIT_ASSERT_MESSAGE(
951 "css::uno::Type",
952 !(a >>= b) && b == cppu::UnoType<OUString>::get());
955 css::uno::Sequence< OUString > b(2);
956 CPPUNIT_ASSERT_MESSAGE(
957 "css::uno::Sequence<OUString>",
958 !(a >>= b) && b.getLength() == 2);
961 Enum1 b = Enum1_M2;
962 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
965 Struct1 b(2);
966 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
969 Exception1 b(
970 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
971 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
974 css::uno::Reference< Interface1 > i(new Impl1);
975 css::uno::Reference< Interface1 > b(i);
976 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
980 void Test::testUnsignedHyper() {
981 css::uno::Any a(static_cast< sal_uInt64 >(1));
982 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_uInt64>::get()));
984 bool b = true;
985 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
988 sal_Bool b = true;
989 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
992 sal_Int8 b = 2;
993 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
996 sal_Int16 b = 2;
997 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1000 sal_uInt16 b = 2;
1001 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1004 sal_Int32 b = 2;
1005 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1008 sal_uInt32 b = 2;
1009 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1012 sal_Int64 b = 2;
1013 CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b) && b == 1);
1016 sal_uInt64 b = 2;
1017 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b) && b == 1);
1020 float b = 2;
1021 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1024 double b = 2;
1025 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1028 sal_Unicode b = '2';
1029 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1032 OUString b("2");
1033 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
1036 css::uno::Type b(cppu::UnoType<OUString>::get());
1037 CPPUNIT_ASSERT_MESSAGE(
1038 "css::uno::Type",
1039 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1042 css::uno::Sequence< OUString > b(2);
1043 CPPUNIT_ASSERT_MESSAGE(
1044 "css::uno::Sequence<OUString>",
1045 !(a >>= b) && b.getLength() == 2);
1048 Enum1 b = Enum1_M2;
1049 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1052 Struct1 b(2);
1053 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1056 Exception1 b(
1057 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1058 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1061 css::uno::Reference< Interface1 > i(new Impl1);
1062 css::uno::Reference< Interface1 > b(i);
1063 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1067 void Test::testFloat() {
1068 css::uno::Any a(1.f);
1069 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<float>::get()));
1071 bool b = true;
1072 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1075 sal_Bool b = true;
1076 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1079 sal_Int8 b = 2;
1080 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1083 sal_Int16 b = 2;
1084 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1087 sal_uInt16 b = 2;
1088 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1091 sal_Int32 b = 2;
1092 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1095 sal_uInt32 b = 2;
1096 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1099 sal_Int64 b = 2;
1100 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1103 sal_uInt64 b = 2;
1104 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1107 float b = 2;
1108 CPPUNIT_ASSERT_MESSAGE("float", (a >>= b) && b == 1);
1111 double b = 2;
1112 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1115 sal_Unicode b = '2';
1116 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1119 OUString b("2");
1120 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
1123 css::uno::Type b(cppu::UnoType<OUString>::get());
1124 CPPUNIT_ASSERT_MESSAGE(
1125 "css::uno::Type",
1126 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1129 css::uno::Sequence< OUString > b(2);
1130 CPPUNIT_ASSERT_MESSAGE(
1131 "css::uno::Sequence<OUString>",
1132 !(a >>= b) && b.getLength() == 2);
1135 Enum1 b = Enum1_M2;
1136 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1139 Struct1 b(2);
1140 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1143 Exception1 b(
1144 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1145 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1148 css::uno::Reference< Interface1 > i(new Impl1);
1149 css::uno::Reference< Interface1 > b(i);
1150 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1154 void Test::testDouble() {
1155 css::uno::Any a(1.);
1156 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<double>::get()));
1158 bool b = true;
1159 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1162 sal_Bool b = true;
1163 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1166 sal_Int8 b = 2;
1167 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1170 sal_Int16 b = 2;
1171 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1174 sal_uInt16 b = 2;
1175 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1178 sal_Int32 b = 2;
1179 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1182 sal_uInt32 b = 2;
1183 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1186 sal_Int64 b = 2;
1187 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1190 sal_uInt64 b = 2;
1191 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1194 float b = 2;
1195 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1198 double b = 2;
1199 CPPUNIT_ASSERT_MESSAGE("double", (a >>= b) && b == 1);
1202 sal_Unicode b = '2';
1203 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1206 OUString b("2");
1207 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
1210 css::uno::Type b(cppu::UnoType<OUString>::get());
1211 CPPUNIT_ASSERT_MESSAGE(
1212 "css::uno::Type",
1213 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1216 css::uno::Sequence< OUString > b(2);
1217 CPPUNIT_ASSERT_MESSAGE(
1218 "css::uno::Sequence<OUString>",
1219 !(a >>= b) && b.getLength() == 2);
1222 Enum1 b = Enum1_M2;
1223 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1226 Struct1 b(2);
1227 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1230 Exception1 b(
1231 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1232 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1235 css::uno::Reference< Interface1 > i(new Impl1);
1236 css::uno::Reference< Interface1 > b(i);
1237 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1241 void Test::testChar() {
1242 sal_Unicode c = '1';
1243 css::uno::Any a(&c, cppu::UnoType<cppu::UnoCharType>::get());
1244 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<cppu::UnoCharType>::get()));
1246 bool b = true;
1247 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1250 sal_Bool b = true;
1251 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1254 sal_Int8 b = 2;
1255 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1258 sal_Int16 b = 2;
1259 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1262 sal_uInt16 b = 2;
1263 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1266 sal_Int32 b = 2;
1267 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1270 sal_uInt32 b = 2;
1271 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1274 sal_Int64 b = 2;
1275 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1278 sal_uInt64 b = 2;
1279 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1282 float b = 2;
1283 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1286 double b = 2;
1287 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1290 sal_Unicode b = '2';
1291 if (std::is_same< sal_Unicode, sal_uInt16 >::value) {
1292 CPPUNIT_ASSERT_MESSAGE("@sal_Unicode", !(a >>= b) && b == '2');
1293 } else {
1294 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", (a >>= b) && b == '1');
1298 OUString b("2");
1299 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
1302 css::uno::Type b(cppu::UnoType<OUString>::get());
1303 CPPUNIT_ASSERT_MESSAGE(
1304 "css::uno::Type",
1305 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1308 css::uno::Sequence< OUString > b(2);
1309 CPPUNIT_ASSERT_MESSAGE(
1310 "css::uno::Sequence<OUString>",
1311 !(a >>= b) && b.getLength() == 2);
1314 Enum1 b = Enum1_M2;
1315 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1318 Struct1 b(2);
1319 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1322 Exception1 b(
1323 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1324 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1327 css::uno::Reference< Interface1 > i(new Impl1);
1328 css::uno::Reference< Interface1 > b(i);
1329 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1333 void Test::testString() {
1334 css::uno::Any a(OUString("1"));
1335 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<OUString>::get()));
1337 bool b = true;
1338 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1341 sal_Bool b = true;
1342 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1345 sal_Int8 b = 2;
1346 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1349 sal_Int16 b = 2;
1350 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1353 sal_uInt16 b = 2;
1354 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1357 sal_Int32 b = 2;
1358 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1361 sal_uInt32 b = 2;
1362 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1365 sal_Int64 b = 2;
1366 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1369 sal_uInt64 b = 2;
1370 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1373 float b = 2;
1374 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1377 double b = 2;
1378 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1381 sal_Unicode b = '2';
1382 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1385 OUString b("2");
1386 CPPUNIT_ASSERT_MESSAGE( "OUString", (a >>= b) && b == "1" );
1389 css::uno::Type b(cppu::UnoType<OUString>::get());
1390 CPPUNIT_ASSERT_MESSAGE(
1391 "css::uno::Type",
1392 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1395 css::uno::Sequence< OUString > b(2);
1396 CPPUNIT_ASSERT_MESSAGE(
1397 "css::uno::Sequence<OUString>",
1398 !(a >>= b) && b.getLength() == 2);
1401 Enum1 b = Enum1_M2;
1402 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1405 Struct1 b(2);
1406 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1409 Exception1 b(
1410 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1411 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1414 css::uno::Reference< Interface1 > i(new Impl1);
1415 css::uno::Reference< Interface1 > b(i);
1416 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1420 void Test::testType() {
1421 css::uno::Any a(cppu::UnoType<sal_Int32>::get());
1422 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<css::uno::Type>::get()));
1424 bool b = true;
1425 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1428 sal_Bool b = true;
1429 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1432 sal_Int8 b = 2;
1433 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1436 sal_Int16 b = 2;
1437 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1440 sal_uInt16 b = 2;
1441 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1444 sal_Int32 b = 2;
1445 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1448 sal_uInt32 b = 2;
1449 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1452 sal_Int64 b = 2;
1453 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1456 sal_uInt64 b = 2;
1457 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1460 float b = 2;
1461 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1464 double b = 2;
1465 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1468 sal_Unicode b = '2';
1469 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1472 OUString b("2");
1473 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
1476 css::uno::Type b(cppu::UnoType<OUString>::get());
1477 CPPUNIT_ASSERT_MESSAGE(
1478 "css::uno::Type", (a >>= b) && b == cppu::UnoType<sal_Int32>::get());
1481 css::uno::Sequence< OUString > b(2);
1482 CPPUNIT_ASSERT_MESSAGE(
1483 "css::uno::Sequence<OUString>",
1484 !(a >>= b) && b.getLength() == 2);
1487 Enum1 b = Enum1_M2;
1488 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1491 Struct1 b(2);
1492 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1495 Exception1 b(
1496 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1497 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1500 css::uno::Reference< Interface1 > i(new Impl1);
1501 css::uno::Reference< Interface1 > b(i);
1502 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1506 void Test::testSequence() {
1507 sal_Int32 n = 1;
1508 css::uno::Any a(css::uno::Sequence< sal_Int32 >(&n, 1));
1509 CPPUNIT_ASSERT(
1510 bool(a.getValueType()
1511 == cppu::UnoType<css::uno::Sequence<sal_Int32>>::get()));
1513 bool b = true;
1514 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1517 sal_Bool b = true;
1518 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1521 sal_Int8 b = 2;
1522 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1525 sal_Int16 b = 2;
1526 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1529 sal_uInt16 b = 2;
1530 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1533 sal_Int32 b = 2;
1534 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1537 sal_uInt32 b = 2;
1538 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1541 sal_Int64 b = 2;
1542 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1545 sal_uInt64 b = 2;
1546 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1549 float b = 2;
1550 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1553 double b = 2;
1554 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1557 sal_Unicode b = '2';
1558 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1561 OUString b("2");
1562 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
1565 css::uno::Type b(cppu::UnoType<OUString>::get());
1566 CPPUNIT_ASSERT_MESSAGE(
1567 "css::uno::Type",
1568 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1571 css::uno::Sequence< OUString > b(2);
1572 CPPUNIT_ASSERT_MESSAGE(
1573 "css::uno::Sequence<OUString>",
1574 !(a >>= b) && b.getLength() == 2);
1577 css::uno::Sequence< sal_Int32 > b(2);
1578 CPPUNIT_ASSERT_MESSAGE(
1579 "css::uno::Sequence<sal_Int32>",
1580 (a >>= b) && b.getLength() == 1 && b[0] == 1);
1583 Enum1 b = Enum1_M2;
1584 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1587 Struct1 b(2);
1588 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1591 Exception1 b(
1592 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1593 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1596 css::uno::Reference< Interface1 > i(new Impl1);
1597 css::uno::Reference< Interface1 > b(i);
1598 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1602 void Test::testEnum() {
1603 css::uno::Any a(Enum2_M1);
1604 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Enum2>::get()));
1606 bool b = true;
1607 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1610 sal_Bool b = true;
1611 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1614 sal_Int8 b = 2;
1615 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1618 sal_Int16 b = 2;
1619 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1622 sal_uInt16 b = 2;
1623 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1626 sal_Int32 b = 2;
1627 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1630 sal_uInt32 b = 2;
1631 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1634 sal_Int64 b = 2;
1635 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1638 sal_uInt64 b = 2;
1639 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1642 float b = 2;
1643 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1646 double b = 2;
1647 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1650 sal_Unicode b = '2';
1651 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1654 OUString b("2");
1655 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
1658 css::uno::Type b(cppu::UnoType<OUString>::get());
1659 CPPUNIT_ASSERT_MESSAGE(
1660 "css::uno::Type",
1661 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1664 css::uno::Sequence< OUString > b(2);
1665 CPPUNIT_ASSERT_MESSAGE(
1666 "css::uno::Sequence<OUString>",
1667 !(a >>= b) && b.getLength() == 2);
1670 Enum1 b = Enum1_M2;
1671 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1674 Enum2 b = Enum2_M2;
1675 CPPUNIT_ASSERT_MESSAGE("Enum2", (a >>= b) && b == Enum2_M1);
1678 Struct1 b(2);
1679 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1682 Exception1 b(
1683 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1684 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1687 css::uno::Reference< Interface1 > i(new Impl1);
1688 css::uno::Reference< Interface1 > b(i);
1689 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1693 void Test::testStruct() {
1694 css::uno::Any a(Struct2a(1, 3));
1695 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Struct2a>::get()));
1697 bool b = true;
1698 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1701 sal_Bool b = true;
1702 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1705 sal_Int8 b = 2;
1706 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1709 sal_Int16 b = 2;
1710 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1713 sal_uInt16 b = 2;
1714 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1717 sal_Int32 b = 2;
1718 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1721 sal_uInt32 b = 2;
1722 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1725 sal_Int64 b = 2;
1726 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1729 sal_uInt64 b = 2;
1730 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1733 float b = 2;
1734 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1737 double b = 2;
1738 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1741 sal_Unicode b = '2';
1742 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1745 OUString b("2");
1746 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
1749 css::uno::Type b(cppu::UnoType<OUString>::get());
1750 CPPUNIT_ASSERT_MESSAGE(
1751 "css::uno::Type",
1752 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1755 css::uno::Sequence< OUString > b(2);
1756 CPPUNIT_ASSERT_MESSAGE(
1757 "css::uno::Sequence<OUString>",
1758 !(a >>= b) && b.getLength() == 2);
1761 Enum1 b = Enum1_M2;
1762 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1765 Struct1 b(2);
1766 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1769 Struct2 b(2);
1770 CPPUNIT_ASSERT_MESSAGE("Struct2", (a >>= b) && b.member == 1);
1773 Struct2a b(2, 2);
1774 CPPUNIT_ASSERT_MESSAGE(
1775 "Struct2a", (a >>= b) && b.member == 1 && b.member2 == 3);
1778 Struct2b b(2, 2, 2);
1779 CPPUNIT_ASSERT_MESSAGE("Struct2b", !(a >>= b) && b.member == 2);
1782 Exception1 b(
1783 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1784 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1787 css::uno::Reference< Interface1 > i(new Impl1);
1788 css::uno::Reference< Interface1 > b(i);
1789 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1793 void Test::testPoly() {
1794 css::uno::Any a;
1795 a <<= Poly< css::uno::Sequence< ::sal_Unicode > >();
1796 CPPUNIT_ASSERT_EQUAL_MESSAGE( "type name", OUString("Poly<[]char>"), a.getValueType().getTypeName() );
1797 CPPUNIT_ASSERT_EQUAL_MESSAGE(
1798 "constructor",
1799 css::uno::Any(Poly< css::uno::Sequence< ::sal_Unicode > >()), a);
1802 void Test::testException() {
1803 css::uno::Any a(
1804 Exception2a(
1805 OUString(), css::uno::Reference< css::uno::XInterface >(), 1,
1806 3));
1807 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Exception2a>::get()));
1809 bool b = true;
1810 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
1813 sal_Bool b = true;
1814 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
1817 sal_Int8 b = 2;
1818 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
1821 sal_Int16 b = 2;
1822 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1825 sal_uInt16 b = 2;
1826 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1829 sal_Int32 b = 2;
1830 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1833 sal_uInt32 b = 2;
1834 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1837 sal_Int64 b = 2;
1838 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1841 sal_uInt64 b = 2;
1842 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1845 float b = 2;
1846 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1849 double b = 2;
1850 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1853 sal_Unicode b = '2';
1854 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1857 OUString b("2");
1858 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
1861 css::uno::Type b(cppu::UnoType<OUString>::get());
1862 CPPUNIT_ASSERT_MESSAGE(
1863 "css::uno::Type",
1864 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1867 css::uno::Sequence< OUString > b(2);
1868 CPPUNIT_ASSERT_MESSAGE(
1869 "css::uno::Sequence<OUString>",
1870 !(a >>= b) && b.getLength() == 2);
1873 Enum1 b = Enum1_M2;
1874 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1877 Struct1 b(2);
1878 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1881 Exception1 b(
1882 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1883 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1886 Exception2 b(
1887 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1888 CPPUNIT_ASSERT_MESSAGE("Exception2", (a >>= b) && b.member == 1);
1891 Exception2a b(
1892 OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
1894 CPPUNIT_ASSERT_MESSAGE(
1895 "Exception2a", (a >>= b) && b.member == 1 && b.member2 == 3);
1898 Exception2b b(
1899 OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
1901 CPPUNIT_ASSERT_MESSAGE("Exception2b", !(a >>= b) && b.member == 2);
1904 css::uno::Reference< Interface1 > i(new Impl1);
1905 css::uno::Reference< Interface1 > b(i);
1906 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1910 void Test::testInterface() {
1911 css::uno::Reference< Interface2a > i2(new Impl2);
1912 css::uno::Any a(i2);
1913 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Interface2a>::get()));
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_Int16 b = 2;
1928 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
1931 sal_uInt16 b = 2;
1932 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
1935 sal_Int32 b = 2;
1936 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
1939 sal_uInt32 b = 2;
1940 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
1943 sal_Int64 b = 2;
1944 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
1947 sal_uInt64 b = 2;
1948 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
1951 float b = 2;
1952 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
1955 double b = 2;
1956 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
1959 sal_Unicode b = '2';
1960 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
1963 OUString b("2");
1964 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
1967 css::uno::Type b(cppu::UnoType<OUString>::get());
1968 CPPUNIT_ASSERT_MESSAGE(
1969 "css::uno::Type",
1970 !(a >>= b) && b == cppu::UnoType<OUString>::get());
1973 css::uno::Sequence< OUString > b(2);
1974 CPPUNIT_ASSERT_MESSAGE(
1975 "css::uno::Sequence<OUString>",
1976 !(a >>= b) && b.getLength() == 2);
1979 Enum1 b = Enum1_M2;
1980 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
1983 Struct1 b(2);
1984 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
1987 Exception1 b(
1988 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1989 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
1992 css::uno::Reference< Interface1 > i(new Impl1);
1993 css::uno::Reference< Interface1 > b(i);
1994 CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b) && b == i);
1997 css::uno::Reference< Interface2 > b(new Impl2);
1998 CPPUNIT_ASSERT_MESSAGE("Interface2", (a >>= b) && b == i2);
2001 css::uno::Reference< Interface2a > b(new Impl2);
2002 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && b == i2);
2005 css::uno::Reference< Interface2b > i(new Impl2b);
2006 css::uno::Reference< Interface2b > b(i);
2007 CPPUNIT_ASSERT_MESSAGE("Interface2b", !(a >>= b) && b == i);
2010 css::uno::Reference< Interface3 > b(new Impl2);
2011 CPPUNIT_ASSERT_MESSAGE("Interface3", (a >>= b) && b == i2);
2015 void Test::testNull() {
2016 css::uno::Any a { css::uno::Reference< Interface2a >() };
2017 CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Interface2a>::get()));
2019 bool b = true;
2020 CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b) && b);
2023 sal_Bool b = true;
2024 CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b) && b);
2027 sal_Int8 b = 2;
2028 CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b) && b == 2);
2031 sal_Int16 b = 2;
2032 CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b) && b == 2);
2035 sal_uInt16 b = 2;
2036 CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b) && b == 2);
2039 sal_Int32 b = 2;
2040 CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b) && b == 2);
2043 sal_uInt32 b = 2;
2044 CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b) && b == 2);
2047 sal_Int64 b = 2;
2048 CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b) && b == 2);
2051 sal_uInt64 b = 2;
2052 CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b) && b == 2);
2055 float b = 2;
2056 CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b) && b == 2);
2059 double b = 2;
2060 CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b) && b == 2);
2063 sal_Unicode b = '2';
2064 CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b) && b == '2');
2067 OUString b("2");
2068 CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) && b == "2" );
2071 css::uno::Type b(cppu::UnoType<OUString>::get());
2072 CPPUNIT_ASSERT_MESSAGE(
2073 "css::uno::Type",
2074 !(a >>= b) && b == cppu::UnoType<OUString>::get());
2077 css::uno::Sequence< OUString > b(2);
2078 CPPUNIT_ASSERT_MESSAGE(
2079 "css::uno::Sequence<OUString>",
2080 !(a >>= b) && b.getLength() == 2);
2083 Enum1 b = Enum1_M2;
2084 CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b) && b == Enum1_M2);
2087 Struct1 b(2);
2088 CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b) && b.member == 2);
2091 Exception1 b(
2092 OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2093 CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b) && b.member == 2);
2096 css::uno::Reference< Interface1 > b(new Impl1);
2097 CPPUNIT_ASSERT_MESSAGE(
2098 "Interface1", (a >>= b) && !b.is());
2101 css::uno::Reference< Interface2 > b(new Impl2);
2102 CPPUNIT_ASSERT_MESSAGE(
2103 "Interface2", (a >>= b) && !b.is());
2106 css::uno::Reference< Interface2a > b(new Impl2);
2107 CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b) && !b.is());
2110 css::uno::Reference< Interface2b > b(new Impl2b);
2111 CPPUNIT_ASSERT_MESSAGE(
2112 "Interface2b", (a >>= b) && !b.is());
2115 css::uno::Reference< Interface3 > b(new Impl2);
2116 CPPUNIT_ASSERT_MESSAGE(
2117 "Interface3", (a >>= b) && !b.is());
2121 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
2125 CPPUNIT_PLUGIN_IMPLEMENT();
2127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */