1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <sal/types.h>
21 
22 #include <stdlib.h>
23 
24 #include <cppunit/TestFixture.h>
25 #include <cppunit/plugin/TestPlugIn.h>
26 #include <cppunit/extensions/HelperMacros.h>
27 
28 #include <Enum1.hpp>
29 #include <Enum2.hpp>
30 #include <Exception1.hpp>
31 #include <Exception2.hpp>
32 #include <Exception2a.hpp>
33 #include <Exception2b.hpp>
34 #include <Interface1.hpp>
35 #include <Interface2.hpp>
36 #include <Interface2a.hpp>
37 #include <Interface2b.hpp>
38 #include <Interface3.hpp>
39 #include <Poly.hpp>
40 #include <Struct1.hpp>
41 #include <Struct2.hpp>
42 #include <Struct2a.hpp>
43 #include <Struct2b.hpp>
44 #include <com/sun/star/uno/Any.hxx>
45 #include <com/sun/star/uno/Reference.hxx>
46 #include <com/sun/star/uno/Sequence.hxx>
47 #include <com/sun/star/uno/Type.hxx>
48 #include <o3tl/cppunittraitshelper.hxx>
49 #include <osl/interlck.h>
50 #include <rtl/ustring.hxx>
51 
52 namespace {
53 
54 class Base {
55 public:
Base()56     Base(): m_count(0) {}
57 
58     Base(const Base&) = delete;
59     const Base& operator=(const Base&) = delete;
60 
acquire()61     void acquire() {
62         if (osl_atomic_increment(&m_count) == SAL_MAX_INT32) {
63             abort();
64         }
65     }
66 
release()67     void release() {
68         if (osl_atomic_decrement(&m_count) == 0) {
69             delete this;
70         }
71     }
72 
73 protected:
~Base()74     virtual ~Base() {}
75 
76 private:
77     oslInterlockedCount m_count;
78 };
79 
80 class Impl1: public Interface1, private Base {
81 public:
queryInterface(css::uno::Type const & type)82     virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override
83     {
84         if (type == cppu::UnoType<css::uno::XInterface>::get()) {
85             css::uno::Reference< css::uno::XInterface > ref(
86                 static_cast< css::uno::XInterface * >(this));
87             return css::uno::Any(&ref, type);
88         }
89         if (type == cppu::UnoType<Interface1>::get()) {
90             css::uno::Reference< Interface1 > ref(this);
91             return css::uno::Any(&ref, type);
92         }
93         return css::uno::Any();
94     }
95 
acquire()96     virtual void SAL_CALL acquire() noexcept override {
97         Base::acquire();
98     }
99 
release()100     virtual void SAL_CALL release() noexcept override {
101         Base::release();
102     }
103 };
104 
105 class Impl2: public Interface2a, public Interface3, private Base {
106 public:
queryInterface(css::uno::Type const & type)107     virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override
108     {
109         if (type == cppu::UnoType<css::uno::XInterface>::get()) {
110             css::uno::Reference< css::uno::XInterface > ref(
111                 static_cast< css::uno::XInterface * >(
112                     static_cast< Interface2a * >(this)));
113             return css::uno::Any(&ref, type);
114         }
115         if (type == cppu::UnoType<Interface2>::get()) {
116             css::uno::Reference< Interface2 > ref(this);
117             return css::uno::Any(&ref, type);
118         }
119         if (type == cppu::UnoType<Interface2a>::get()) {
120             css::uno::Reference< Interface2a > ref(this);
121             return css::uno::Any(&ref, type);
122         }
123         if (type == cppu::UnoType<Interface3>::get()) {
124             css::uno::Reference< Interface3 > ref(this);
125             return css::uno::Any(&ref, type);
126         }
127         return css::uno::Any();
128     }
129 
acquire()130     virtual void SAL_CALL acquire() noexcept override {
131         Base::acquire();
132     }
133 
release()134     virtual void SAL_CALL release() noexcept override {
135         Base::release();
136     }
137 };
138 
139 class Impl2b: public Interface2b, private Base {
140 public:
queryInterface(css::uno::Type const & type)141     virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const & type) override
142     {
143         if (type == cppu::UnoType<css::uno::XInterface>::get()) {
144             css::uno::Reference< css::uno::XInterface > ref(
145                 static_cast< css::uno::XInterface * >(
146                     static_cast< Interface2a * >(this)));
147             return css::uno::Any(&ref, type);
148         }
149         if (type == cppu::UnoType<Interface2>::get()) {
150             css::uno::Reference< Interface2 > ref(this);
151             return css::uno::Any(&ref, type);
152         }
153         if (type == cppu::UnoType<Interface2a>::get()) {
154             css::uno::Reference< Interface2a > ref(this);
155             return css::uno::Any(&ref, type);
156         }
157         if (type == cppu::UnoType<Interface2b>::get()) {
158             css::uno::Reference< Interface2b > ref(this);
159             return css::uno::Any(&ref, type);
160         }
161         return css::uno::Any();
162     }
163 
acquire()164     virtual void SAL_CALL acquire() noexcept override {
165         Base::acquire();
166     }
167 
release()168     virtual void SAL_CALL release() noexcept override {
169         Base::release();
170     }
171 };
172 
173 class Test: public CppUnit::TestFixture {
174 public:
175     void testVoid();
176     void testBoolean();
177     void testByte();
178     void testShort();
179     void testUnsignedShort();
180     void testLong();
181     void testUnsignedLong();
182     void testHyper();
183     void testUnsignedHyper();
184     void testFloat();
185     void testDouble();
186     void testChar();
187     void testString();
188     void testType();
189     void testSequence();
190     void testEnum();
191     void testStruct();
192     void testPoly();
193     void testException();
194     void testInterface();
195     void testNull();
196 
197     CPPUNIT_TEST_SUITE(Test);
198     CPPUNIT_TEST(testVoid);
199     CPPUNIT_TEST(testBoolean);
200     CPPUNIT_TEST(testByte);
201     CPPUNIT_TEST(testShort);
202     CPPUNIT_TEST(testUnsignedShort);
203     CPPUNIT_TEST(testLong);
204     CPPUNIT_TEST(testUnsignedLong);
205     CPPUNIT_TEST(testHyper);
206     CPPUNIT_TEST(testUnsignedHyper);
207     CPPUNIT_TEST(testFloat);
208     CPPUNIT_TEST(testDouble);
209     CPPUNIT_TEST(testChar);
210     CPPUNIT_TEST(testString);
211     CPPUNIT_TEST(testType);
212     CPPUNIT_TEST(testSequence);
213     CPPUNIT_TEST(testEnum);
214     CPPUNIT_TEST(testStruct);
215     CPPUNIT_TEST(testPoly);
216     CPPUNIT_TEST(testException);
217     CPPUNIT_TEST(testInterface);
218     CPPUNIT_TEST(testNull);
219     CPPUNIT_TEST_SUITE_END();
220 };
221 
testVoid()222 void Test::testVoid() {
223     css::uno::Any a;
224     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<void>::get()));
225     {
226         bool b = true;
227         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
228         CPPUNIT_ASSERT_MESSAGE("bool", b);
229     }
230     {
231         sal_Bool b = true;
232         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
233         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
234     }
235     {
236         sal_Int8 b = 2;
237         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
238         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
239     }
240     {
241         sal_Int16 b = 2;
242         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
243         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
244     }
245     {
246         sal_uInt16 b = 2;
247         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
248         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
249     }
250     {
251         sal_Int32 b = 2;
252         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
253         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
254     }
255     {
256         sal_uInt32 b = 2;
257         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
258         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
259     }
260     {
261         sal_Int64 b = 2;
262         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
263         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
264     }
265     {
266         sal_uInt64 b = 2;
267         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
268         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
269     }
270     {
271         float b = 2;
272         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
273         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", 2.0f, b);
274     }
275     {
276         double b = 2;
277         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
278         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
279     }
280     {
281         sal_Unicode b = '2';
282         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
283         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
284     }
285     {
286         OUString b("2");
287         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
288         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
289     }
290     {
291         css::uno::Type b(cppu::UnoType<OUString>::get());
292         CPPUNIT_ASSERT_MESSAGE(
293             "css::uno::Type",
294             !(a >>= b));
295         CPPUNIT_ASSERT_EQUAL_MESSAGE(
296             "css::uno::Type",
297             cppu::UnoType<OUString>::get(), b);
298     }
299     {
300         css::uno::Sequence< OUString > b(2);
301         CPPUNIT_ASSERT_MESSAGE(
302             "css::uno::Sequence<OUString>", !(a >>= b));
303         CPPUNIT_ASSERT_EQUAL_MESSAGE(
304             "css::uno::Sequence<OUString>", sal_Int32(2), b.getLength());
305     }
306     {
307         Enum1 b = Enum1_M2;
308         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
309         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
310     }
311     {
312         Struct1 b(2);
313         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
314         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
315     }
316     {
317         Exception1 b(
318             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
319         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
320         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
321     }
322     {
323         css::uno::Reference< Interface1 > i(new Impl1);
324         css::uno::Reference< Interface1 > b(i);
325         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
326         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
327     }
328 }
329 
testBoolean()330 void Test::testBoolean() {
331     css::uno::Any a(false);
332     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<bool>::get()));
333     {
334         bool b = true;
335         CPPUNIT_ASSERT_MESSAGE("bool", (a >>= b));
336         CPPUNIT_ASSERT_MESSAGE("bool", !b);
337     }
338     {
339         sal_Bool b = true;
340         CPPUNIT_ASSERT_MESSAGE("sal_Bool", (a >>= b));
341         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !b);
342     }
343     {
344         sal_Int8 b = 2;
345         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
346         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
347     }
348     {
349         sal_Int16 b = 2;
350         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
351         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
352     }
353     {
354         sal_uInt16 b = 2;
355         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
356         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
357     }
358     {
359         sal_Int32 b = 2;
360         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
361         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
362     }
363     {
364         sal_uInt32 b = 2;
365         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
366         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
367     }
368     {
369         sal_Int64 b = 2;
370         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
371         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
372     }
373     {
374         sal_uInt64 b = 2;
375         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
376         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
377     }
378     {
379         float b = 2;
380         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
381         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", 2.0f, b);
382     }
383     {
384         double b = 2;
385         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
386         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
387     }
388     {
389         sal_Unicode b = '2';
390         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
391         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
392     }
393     {
394         OUString b("2");
395         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
396         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
397     }
398     {
399         css::uno::Type b(cppu::UnoType<OUString>::get());
400         CPPUNIT_ASSERT_MESSAGE(
401             "css::uno::Type",
402             !(a >>= b));
403         CPPUNIT_ASSERT_EQUAL_MESSAGE(
404             "css::uno::Type",
405             cppu::UnoType<OUString>::get(), b);
406     }
407     {
408         css::uno::Sequence< OUString > b(2);
409         CPPUNIT_ASSERT_MESSAGE(
410             "css::uno::Sequence<OUString>",
411             !(a >>= b));
412         CPPUNIT_ASSERT_EQUAL_MESSAGE(
413             "css::uno::Sequence<OUString>",
414             sal_Int32(2), b.getLength());
415     }
416     {
417         Enum1 b = Enum1_M2;
418         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
419         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
420     }
421     {
422         Struct1 b(2);
423         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
424         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
425     }
426     {
427         Exception1 b(
428             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
429         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
430         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
431     }
432     {
433         css::uno::Reference< Interface1 > i(new Impl1);
434         css::uno::Reference< Interface1 > b(i);
435         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
436         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
437     }
438 }
439 
testByte()440 void Test::testByte() {
441     css::uno::Any a(static_cast< sal_Int8 >(1));
442     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int8>::get()));
443     {
444         bool b = true;
445         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
446         CPPUNIT_ASSERT_MESSAGE("bool", b);
447     }
448     {
449         sal_Bool b = true;
450         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
451         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
452     }
453     {
454         sal_Int8 b = 2;
455         CPPUNIT_ASSERT_MESSAGE("sal_Int8", (a >>= b));
456         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(1), b);
457     }
458     {
459         sal_Int16 b = 2;
460         CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b));
461         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(1), b);
462     }
463     {
464         sal_uInt16 b = 2;
465         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b));
466         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(1), b);
467     }
468     {
469         sal_Int32 b = 2;
470         CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b));
471         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b);
472     }
473     {
474         sal_uInt32 b = 2;
475         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b));
476         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b);
477     }
478     {
479         sal_Int64 b = 2;
480         CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
481         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
482     }
483     {
484         sal_uInt64 b = 2;
485         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
486         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
487     }
488     {
489         float b = 2;
490         CPPUNIT_ASSERT_MESSAGE("float", (a >>= b));
491         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b);
492     }
493     {
494         double b = 2;
495         CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
496         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
497     }
498     {
499         sal_Unicode b = '2';
500         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
501         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
502     }
503     {
504         OUString b("2");
505         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
506         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
507     }
508     {
509         css::uno::Type b(cppu::UnoType<OUString>::get());
510         CPPUNIT_ASSERT_MESSAGE(
511             "css::uno::Type",
512             !(a >>= b));
513         CPPUNIT_ASSERT_EQUAL_MESSAGE(
514             "css::uno::Type",
515             cppu::UnoType<OUString>::get(), b);
516     }
517     {
518         css::uno::Sequence< OUString > b(2);
519         CPPUNIT_ASSERT_MESSAGE(
520             "css::uno::Sequence<OUString>",
521             !(a >>= b));
522         CPPUNIT_ASSERT_EQUAL_MESSAGE(
523             "css::uno::Sequence<OUString>",
524             sal_Int32(2), b.getLength());
525     }
526     {
527         Enum1 b = Enum1_M2;
528         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
529         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
530     }
531     {
532         Struct1 b(2);
533         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
534         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
535     }
536     {
537         Exception1 b(
538             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
539         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
540         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
541     }
542     {
543         css::uno::Reference< Interface1 > i(new Impl1);
544         css::uno::Reference< Interface1 > b(i);
545         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
546         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
547     }
548 }
549 
testShort()550 void Test::testShort() {
551     css::uno::Any a(static_cast< sal_Int16 >(1));
552     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int16>::get()));
553     {
554         bool b = true;
555         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
556         CPPUNIT_ASSERT_MESSAGE("bool", b);
557     }
558     {
559         sal_Bool b = true;
560         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
561         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
562     }
563     {
564         sal_Int8 b = 2;
565         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
566         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
567     }
568     {
569         sal_Int16 b = 2;
570         CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b));
571         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(1), b);
572     }
573     {
574         sal_uInt16 b = 2;
575         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b));
576         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(1), b);
577     }
578     {
579         sal_Int32 b = 2;
580         CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b));
581         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b);
582     }
583     {
584         sal_uInt32 b = 2;
585         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b));
586         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b);
587     }
588     {
589         sal_Int64 b = 2;
590         CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
591         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
592     }
593     {
594         sal_uInt64 b = 2;
595         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
596         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
597     }
598     {
599         float b = 2;
600         CPPUNIT_ASSERT_MESSAGE("float", (a >>= b));
601         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b);
602     }
603     {
604         double b = 2;
605         CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
606         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
607     }
608     {
609         sal_Unicode b = '2';
610         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
611         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
612     }
613     {
614         OUString b("2");
615         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
616         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
617     }
618     {
619         css::uno::Type b(cppu::UnoType<OUString>::get());
620         CPPUNIT_ASSERT_MESSAGE(
621             "css::uno::Type",
622             !(a >>= b));
623         CPPUNIT_ASSERT_EQUAL_MESSAGE(
624             "css::uno::Type",
625             cppu::UnoType<OUString>::get(), b);
626     }
627     {
628         css::uno::Sequence< OUString > b(2);
629         CPPUNIT_ASSERT_MESSAGE(
630             "css::uno::Sequence<OUString>",
631             !(a >>= b));
632         CPPUNIT_ASSERT_EQUAL_MESSAGE(
633             "css::uno::Sequence<OUString>",
634             sal_Int32(2), b.getLength());
635     }
636     {
637         Enum1 b = Enum1_M2;
638         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
639         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
640     }
641     {
642         Struct1 b(2);
643         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
644         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
645     }
646     {
647         Exception1 b(
648             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
649         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
650         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
651     }
652     {
653         css::uno::Reference< Interface1 > i(new Impl1);
654         css::uno::Reference< Interface1 > b(i);
655         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
656         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
657     }
658 }
659 
testUnsignedShort()660 void Test::testUnsignedShort() {
661     sal_uInt16 n = 1;
662     css::uno::Any a(&n, cppu::UnoType<cppu::UnoUnsignedShortType>::get());
663     CPPUNIT_ASSERT(
664         bool(a.getValueType() == cppu::UnoType<cppu::UnoUnsignedShortType>::get()));
665     {
666         bool b = true;
667         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
668         CPPUNIT_ASSERT_MESSAGE("bool", b);
669     }
670     {
671         sal_Bool b = true;
672         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
673         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
674     }
675     {
676         sal_Int8 b = 2;
677         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
678         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
679     }
680     {
681         sal_Int16 b = 2;
682         CPPUNIT_ASSERT_MESSAGE("sal_Int16", (a >>= b));
683         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(1), b);
684     }
685     {
686         sal_uInt16 b = 2;
687         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", (a >>= b));
688         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(1), b);
689     }
690     {
691         sal_Int32 b = 2;
692         CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b));
693         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b);
694     }
695     {
696         sal_uInt32 b = 2;
697         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b));
698         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b);
699     }
700     {
701         sal_Int64 b = 2;
702         CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
703         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
704     }
705     {
706         sal_uInt64 b = 2;
707         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
708         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
709     }
710     {
711         float b = 2;
712         CPPUNIT_ASSERT_MESSAGE("float", (a >>= b));
713         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b);
714     }
715     {
716         double b = 2;
717         CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
718         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
719     }
720     {
721         sal_Unicode b = '2';
722         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
723         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
724     }
725     {
726         OUString b("2");
727         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
728         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
729     }
730     {
731         css::uno::Type b(cppu::UnoType<OUString>::get());
732         CPPUNIT_ASSERT_MESSAGE(
733             "css::uno::Type",
734             !(a >>= b));
735         CPPUNIT_ASSERT_EQUAL_MESSAGE(
736             "css::uno::Type",
737             cppu::UnoType<OUString>::get(), b);
738     }
739     {
740         css::uno::Sequence< OUString > b(2);
741         CPPUNIT_ASSERT_MESSAGE(
742             "css::uno::Sequence<OUString>",
743             !(a >>= b));
744         CPPUNIT_ASSERT_EQUAL_MESSAGE(
745             "css::uno::Sequence<OUString>",
746             sal_Int32(2), b.getLength());
747     }
748     {
749         Enum1 b = Enum1_M2;
750         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
751         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
752     }
753     {
754         Struct1 b(2);
755         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
756         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
757     }
758     {
759         Exception1 b(
760             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
761         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
762         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
763     }
764     {
765         css::uno::Reference< Interface1 > i(new Impl1);
766         css::uno::Reference< Interface1 > b(i);
767         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
768         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
769     }
770 }
771 
testLong()772 void Test::testLong() {
773     css::uno::Any a(static_cast< sal_Int32 >(1));
774     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int32>::get()));
775     {
776         bool b = true;
777         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
778         CPPUNIT_ASSERT_MESSAGE("bool", b);
779     }
780     {
781         sal_Bool b = true;
782         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
783         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
784     }
785     {
786         sal_Int8 b = 2;
787         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
788         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
789     }
790     {
791         sal_Int16 b = 2;
792         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
793         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
794     }
795     {
796         sal_uInt16 b = 2;
797         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
798         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
799     }
800     {
801         sal_Int32 b = 2;
802         CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b));
803         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b);
804     }
805     {
806         sal_uInt32 b = 2;
807         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b));
808         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b);
809     }
810     {
811         sal_Int64 b = 2;
812         CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
813         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
814     }
815     {
816         sal_uInt64 b = 2;
817         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
818         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
819     }
820     {
821         float b = 2;
822         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
823         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
824     }
825     {
826         double b = 2;
827         CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
828         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
829     }
830     {
831         sal_Unicode b = '2';
832         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
833         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
834     }
835     {
836         OUString b("2");
837         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
838         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
839     }
840     {
841         css::uno::Type b(cppu::UnoType<OUString>::get());
842         CPPUNIT_ASSERT_MESSAGE(
843             "css::uno::Type",
844             !(a >>= b));
845         CPPUNIT_ASSERT_EQUAL_MESSAGE(
846             "css::uno::Type",
847             cppu::UnoType<OUString>::get(), b);
848     }
849     {
850         css::uno::Sequence< OUString > b(2);
851         CPPUNIT_ASSERT_MESSAGE(
852             "css::uno::Sequence<OUString>",
853             !(a >>= b));
854         CPPUNIT_ASSERT_EQUAL_MESSAGE(
855             "css::uno::Sequence<OUString>",
856             sal_Int32(2), b.getLength());
857     }
858     {
859         Enum1 b = Enum1_M2;
860         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
861         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
862     }
863     {
864         Struct1 b(2);
865         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
866         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
867     }
868     {
869         Exception1 b(
870             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
871         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
872         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
873     }
874     {
875         css::uno::Reference< Interface1 > i(new Impl1);
876         css::uno::Reference< Interface1 > b(i);
877         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
878         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
879     }
880 }
881 
testUnsignedLong()882 void Test::testUnsignedLong() {
883     css::uno::Any a(static_cast< sal_uInt32 >(1));
884     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_uInt32>::get()));
885     {
886         bool b = true;
887         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
888         CPPUNIT_ASSERT_MESSAGE("bool", b);
889     }
890     {
891         sal_Bool b = true;
892         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
893         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
894     }
895     {
896         sal_Int8 b = 2;
897         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
898         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
899     }
900     {
901         sal_Int16 b = 2;
902         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
903         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
904     }
905     {
906         sal_uInt16 b = 2;
907         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
908         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
909     }
910     {
911         sal_Int32 b = 2;
912         CPPUNIT_ASSERT_MESSAGE("sal_Int32", (a >>= b));
913         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(1), b);
914     }
915     {
916         sal_uInt32 b = 2;
917         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", (a >>= b));
918         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(1), b);
919     }
920     {
921         sal_Int64 b = 2;
922         CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
923         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
924     }
925     {
926         sal_uInt64 b = 2;
927         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
928         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
929     }
930     {
931         float b = 2;
932         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
933         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
934     }
935     {
936         double b = 2;
937         CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
938         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
939     }
940     {
941         sal_Unicode b = '2';
942         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
943         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
944     }
945     {
946         OUString b("2");
947         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
948         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
949     }
950     {
951         css::uno::Type b(cppu::UnoType<OUString>::get());
952         CPPUNIT_ASSERT_MESSAGE(
953             "css::uno::Type",
954             !(a >>= b));
955         CPPUNIT_ASSERT_EQUAL_MESSAGE(
956             "css::uno::Type",
957             cppu::UnoType<OUString>::get(), b);
958     }
959     {
960         css::uno::Sequence< OUString > b(2);
961         CPPUNIT_ASSERT_MESSAGE(
962             "css::uno::Sequence<OUString>",
963             !(a >>= b));
964         CPPUNIT_ASSERT_EQUAL_MESSAGE(
965             "css::uno::Sequence<OUString>",
966             sal_Int32(2), b.getLength());
967     }
968     {
969         Enum1 b = Enum1_M2;
970         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
971         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
972     }
973     {
974         Struct1 b(2);
975         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
976         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
977     }
978     {
979         Exception1 b(
980             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
981         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
982         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
983     }
984     {
985         css::uno::Reference< Interface1 > i(new Impl1);
986         css::uno::Reference< Interface1 > b(i);
987         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
988         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
989     }
990 }
991 
testHyper()992 void Test::testHyper() {
993     css::uno::Any a(static_cast< sal_Int64 >(1));
994     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_Int64>::get()));
995     {
996         bool b = true;
997         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
998         CPPUNIT_ASSERT_MESSAGE("bool", b);
999     }
1000     {
1001         sal_Bool b = true;
1002         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
1003         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
1004     }
1005     {
1006         sal_Int8 b = 2;
1007         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
1008         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
1009     }
1010     {
1011         sal_Int16 b = 2;
1012         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
1013         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
1014     }
1015     {
1016         sal_uInt16 b = 2;
1017         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
1018         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
1019     }
1020     {
1021         sal_Int32 b = 2;
1022         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
1023         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
1024     }
1025     {
1026         sal_uInt32 b = 2;
1027         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
1028         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
1029     }
1030     {
1031         sal_Int64 b = 2;
1032         CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
1033         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
1034     }
1035     {
1036         sal_uInt64 b = 2;
1037         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
1038         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
1039     }
1040     {
1041         float b = 2;
1042         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
1043         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
1044     }
1045     {
1046         double b = 2;
1047         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
1048         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
1049     }
1050     {
1051         sal_Unicode b = '2';
1052         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
1053         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
1054     }
1055     {
1056         OUString b("2");
1057         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
1058         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
1059     }
1060     {
1061         css::uno::Type b(cppu::UnoType<OUString>::get());
1062         CPPUNIT_ASSERT_MESSAGE(
1063             "css::uno::Type",
1064             !(a >>= b));
1065         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1066             "css::uno::Type",
1067             cppu::UnoType<OUString>::get(), b);
1068     }
1069     {
1070         css::uno::Sequence< OUString > b(2);
1071         CPPUNIT_ASSERT_MESSAGE(
1072             "css::uno::Sequence<OUString>",
1073             !(a >>= b));
1074         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1075             "css::uno::Sequence<OUString>",
1076             sal_Int32(2), b.getLength());
1077     }
1078     {
1079         Enum1 b = Enum1_M2;
1080         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
1081         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
1082     }
1083     {
1084         Struct1 b(2);
1085         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
1086         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
1087     }
1088     {
1089         Exception1 b(
1090             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1091         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
1092         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
1093     }
1094     {
1095         css::uno::Reference< Interface1 > i(new Impl1);
1096         css::uno::Reference< Interface1 > b(i);
1097         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
1098         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
1099     }
1100 }
1101 
testUnsignedHyper()1102 void Test::testUnsignedHyper() {
1103     css::uno::Any a(static_cast< sal_uInt64 >(1));
1104     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<sal_uInt64>::get()));
1105     {
1106         bool b = true;
1107         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
1108         CPPUNIT_ASSERT_MESSAGE("bool", b);
1109     }
1110     {
1111         sal_Bool b = true;
1112         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
1113         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
1114     }
1115     {
1116         sal_Int8 b = 2;
1117         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
1118         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
1119     }
1120     {
1121         sal_Int16 b = 2;
1122         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
1123         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
1124     }
1125     {
1126         sal_uInt16 b = 2;
1127         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
1128         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
1129     }
1130     {
1131         sal_Int32 b = 2;
1132         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
1133         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
1134     }
1135     {
1136         sal_uInt32 b = 2;
1137         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
1138         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
1139     }
1140     {
1141         sal_Int64 b = 2;
1142         CPPUNIT_ASSERT_MESSAGE("sal_Int64", (a >>= b));
1143         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(1), b);
1144     }
1145     {
1146         sal_uInt64 b = 2;
1147         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", (a >>= b));
1148         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(1), b);
1149     }
1150     {
1151         float b = 2;
1152         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
1153         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
1154     }
1155     {
1156         double b = 2;
1157         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
1158         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
1159     }
1160     {
1161         sal_Unicode b = '2';
1162         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
1163         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
1164     }
1165     {
1166         OUString b("2");
1167         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
1168         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
1169     }
1170     {
1171         css::uno::Type b(cppu::UnoType<OUString>::get());
1172         CPPUNIT_ASSERT_MESSAGE(
1173             "css::uno::Type",
1174             !(a >>= b));
1175         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1176             "css::uno::Type",
1177             cppu::UnoType<OUString>::get(), b);
1178     }
1179     {
1180         css::uno::Sequence< OUString > b(2);
1181         CPPUNIT_ASSERT_MESSAGE(
1182             "css::uno::Sequence<OUString>",
1183             !(a >>= b));
1184         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1185             "css::uno::Sequence<OUString>",
1186             sal_Int32(2), b.getLength());
1187     }
1188     {
1189         Enum1 b = Enum1_M2;
1190         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
1191         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
1192     }
1193     {
1194         Struct1 b(2);
1195         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
1196         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
1197     }
1198     {
1199         Exception1 b(
1200             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1201         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
1202         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
1203     }
1204     {
1205         css::uno::Reference< Interface1 > i(new Impl1);
1206         css::uno::Reference< Interface1 > b(i);
1207         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
1208         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
1209     }
1210 }
1211 
testFloat()1212 void Test::testFloat() {
1213     css::uno::Any a(1.f);
1214     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<float>::get()));
1215     {
1216         bool b = true;
1217         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
1218         CPPUNIT_ASSERT_MESSAGE("bool", b);
1219     }
1220     {
1221         sal_Bool b = true;
1222         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
1223         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
1224     }
1225     {
1226         sal_Int8 b = 2;
1227         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
1228         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
1229     }
1230     {
1231         sal_Int16 b = 2;
1232         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
1233         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
1234     }
1235     {
1236         sal_uInt16 b = 2;
1237         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
1238         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
1239     }
1240     {
1241         sal_Int32 b = 2;
1242         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
1243         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
1244     }
1245     {
1246         sal_uInt32 b = 2;
1247         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
1248         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
1249     }
1250     {
1251         sal_Int64 b = 2;
1252         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
1253         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
1254     }
1255     {
1256         sal_uInt64 b = 2;
1257         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
1258         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
1259     }
1260     {
1261         float b = 2;
1262         CPPUNIT_ASSERT_MESSAGE("float", (a >>= b));
1263         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(1), b);
1264     }
1265     {
1266         double b = 2;
1267         CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
1268         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
1269     }
1270     {
1271         sal_Unicode b = '2';
1272         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
1273         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
1274     }
1275     {
1276         OUString b("2");
1277         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
1278         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
1279     }
1280     {
1281         css::uno::Type b(cppu::UnoType<OUString>::get());
1282         CPPUNIT_ASSERT_MESSAGE(
1283             "css::uno::Type",
1284             !(a >>= b));
1285         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1286             "css::uno::Type",
1287             cppu::UnoType<OUString>::get(), b);
1288     }
1289     {
1290         css::uno::Sequence< OUString > b(2);
1291         CPPUNIT_ASSERT_MESSAGE(
1292             "css::uno::Sequence<OUString>",
1293             !(a >>= b));
1294         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1295             "css::uno::Sequence<OUString>",
1296             sal_Int32(2), b.getLength());
1297     }
1298     {
1299         Enum1 b = Enum1_M2;
1300         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
1301         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
1302     }
1303     {
1304         Struct1 b(2);
1305         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
1306         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
1307     }
1308     {
1309         Exception1 b(
1310             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1311         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
1312         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
1313     }
1314     {
1315         css::uno::Reference< Interface1 > i(new Impl1);
1316         css::uno::Reference< Interface1 > b(i);
1317         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
1318         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
1319     }
1320 }
1321 
testDouble()1322 void Test::testDouble() {
1323     css::uno::Any a(1.);
1324     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<double>::get()));
1325     {
1326         bool b = true;
1327         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
1328         CPPUNIT_ASSERT_MESSAGE("bool", b);
1329     }
1330     {
1331         sal_Bool b = true;
1332         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
1333         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
1334     }
1335     {
1336         sal_Int8 b = 2;
1337         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
1338         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
1339     }
1340     {
1341         sal_Int16 b = 2;
1342         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
1343         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
1344     }
1345     {
1346         sal_uInt16 b = 2;
1347         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
1348         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
1349     }
1350     {
1351         sal_Int32 b = 2;
1352         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
1353         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
1354     }
1355     {
1356         sal_uInt32 b = 2;
1357         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
1358         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
1359     }
1360     {
1361         sal_Int64 b = 2;
1362         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
1363         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
1364     }
1365     {
1366         sal_uInt64 b = 2;
1367         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
1368         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
1369     }
1370     {
1371         float b = 2;
1372         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
1373         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
1374     }
1375     {
1376         double b = 2;
1377         CPPUNIT_ASSERT_MESSAGE("double", (a >>= b));
1378         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 1.0, b);
1379     }
1380     {
1381         sal_Unicode b = '2';
1382         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
1383         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
1384     }
1385     {
1386         OUString b("2");
1387         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
1388         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
1389     }
1390     {
1391         css::uno::Type b(cppu::UnoType<OUString>::get());
1392         CPPUNIT_ASSERT_MESSAGE(
1393             "css::uno::Type",
1394             !(a >>= b));
1395         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1396             "css::uno::Type",
1397             cppu::UnoType<OUString>::get(), b);
1398     }
1399     {
1400         css::uno::Sequence< OUString > b(2);
1401         CPPUNIT_ASSERT_MESSAGE(
1402             "css::uno::Sequence<OUString>",
1403             !(a >>= b));
1404         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1405             "css::uno::Sequence<OUString>",
1406             sal_Int32(2), b.getLength());
1407     }
1408     {
1409         Enum1 b = Enum1_M2;
1410         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
1411         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
1412     }
1413     {
1414         Struct1 b(2);
1415         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
1416         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
1417     }
1418     {
1419         Exception1 b(
1420             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1421         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
1422         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
1423     }
1424     {
1425         css::uno::Reference< Interface1 > i(new Impl1);
1426         css::uno::Reference< Interface1 > b(i);
1427         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
1428         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
1429     }
1430 }
1431 
testChar()1432 void Test::testChar() {
1433     sal_Unicode c = '1';
1434     css::uno::Any a(&c, cppu::UnoType<cppu::UnoCharType>::get());
1435     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<cppu::UnoCharType>::get()));
1436     {
1437         bool b = true;
1438         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
1439         CPPUNIT_ASSERT_MESSAGE("bool", b);
1440     }
1441     {
1442         sal_Bool b = true;
1443         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
1444         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
1445     }
1446     {
1447         sal_Int8 b = 2;
1448         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
1449         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
1450     }
1451     {
1452         sal_Int16 b = 2;
1453         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
1454         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
1455     }
1456     {
1457         sal_uInt16 b = 2;
1458         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
1459         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
1460     }
1461     {
1462         sal_Int32 b = 2;
1463         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
1464         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
1465     }
1466     {
1467         sal_uInt32 b = 2;
1468         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
1469         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
1470     }
1471     {
1472         sal_Int64 b = 2;
1473         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
1474         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
1475     }
1476     {
1477         sal_uInt64 b = 2;
1478         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
1479         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
1480     }
1481     {
1482         float b = 2;
1483         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
1484         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
1485     }
1486     {
1487         double b = 2;
1488         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
1489         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
1490     }
1491     {
1492         sal_Unicode b = '2';
1493         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", (a >>= b));
1494         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'1', b);
1495     }
1496     {
1497         OUString b("2");
1498         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
1499         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
1500     }
1501     {
1502         css::uno::Type b(cppu::UnoType<OUString>::get());
1503         CPPUNIT_ASSERT_MESSAGE(
1504             "css::uno::Type",
1505             !(a >>= b));
1506         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1507             "css::uno::Type",
1508             cppu::UnoType<OUString>::get(), b);
1509     }
1510     {
1511         css::uno::Sequence< OUString > b(2);
1512         CPPUNIT_ASSERT_MESSAGE(
1513             "css::uno::Sequence<OUString>",
1514             !(a >>= b));
1515         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1516             "css::uno::Sequence<OUString>",
1517             sal_Int32(2), b.getLength());
1518     }
1519     {
1520         Enum1 b = Enum1_M2;
1521         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
1522         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
1523     }
1524     {
1525         Struct1 b(2);
1526         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
1527         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
1528     }
1529     {
1530         Exception1 b(
1531             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1532         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
1533         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
1534     }
1535     {
1536         css::uno::Reference< Interface1 > i(new Impl1);
1537         css::uno::Reference< Interface1 > b(i);
1538         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
1539         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
1540     }
1541 }
1542 
testString()1543 void Test::testString() {
1544     css::uno::Any a(OUString("1"));
1545     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<OUString>::get()));
1546     {
1547         bool b = true;
1548         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
1549         CPPUNIT_ASSERT_MESSAGE("bool", b);
1550     }
1551     {
1552         sal_Bool b = true;
1553         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
1554         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
1555     }
1556     {
1557         sal_Int8 b = 2;
1558         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
1559         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
1560     }
1561     {
1562         sal_Int16 b = 2;
1563         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
1564         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
1565     }
1566     {
1567         sal_uInt16 b = 2;
1568         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
1569         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
1570     }
1571     {
1572         sal_Int32 b = 2;
1573         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
1574         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
1575     }
1576     {
1577         sal_uInt32 b = 2;
1578         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
1579         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
1580     }
1581     {
1582         sal_Int64 b = 2;
1583         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
1584         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
1585     }
1586     {
1587         sal_uInt64 b = 2;
1588         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
1589         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
1590     }
1591     {
1592         float b = 2;
1593         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
1594         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
1595     }
1596     {
1597         double b = 2;
1598         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
1599         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
1600     }
1601     {
1602         sal_Unicode b = '2';
1603         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
1604         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
1605     }
1606     {
1607         OUString b("2");
1608         CPPUNIT_ASSERT_MESSAGE( "OUString", (a >>= b) );
1609         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("1"), b );
1610     }
1611     {
1612         css::uno::Type b(cppu::UnoType<OUString>::get());
1613         CPPUNIT_ASSERT_MESSAGE(
1614             "css::uno::Type",
1615             !(a >>= b));
1616         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1617             "css::uno::Type",
1618             cppu::UnoType<OUString>::get(), b);
1619     }
1620     {
1621         css::uno::Sequence< OUString > b(2);
1622         CPPUNIT_ASSERT_MESSAGE(
1623             "css::uno::Sequence<OUString>",
1624             !(a >>= b));
1625         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1626             "css::uno::Sequence<OUString>",
1627             sal_Int32(2), b.getLength());
1628     }
1629     {
1630         Enum1 b = Enum1_M2;
1631         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
1632         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
1633     }
1634     {
1635         Struct1 b(2);
1636         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
1637         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
1638     }
1639     {
1640         Exception1 b(
1641             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1642         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
1643         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
1644     }
1645     {
1646         css::uno::Reference< Interface1 > i(new Impl1);
1647         css::uno::Reference< Interface1 > b(i);
1648         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
1649         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
1650     }
1651 }
1652 
testType()1653 void Test::testType() {
1654     css::uno::Any a(cppu::UnoType<sal_Int32>::get());
1655     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<css::uno::Type>::get()));
1656     {
1657         bool b = true;
1658         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
1659         CPPUNIT_ASSERT_MESSAGE("bool", b);
1660     }
1661     {
1662         sal_Bool b = true;
1663         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
1664         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
1665     }
1666     {
1667         sal_Int8 b = 2;
1668         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
1669         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
1670     }
1671     {
1672         sal_Int16 b = 2;
1673         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
1674         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
1675     }
1676     {
1677         sal_uInt16 b = 2;
1678         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
1679         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
1680     }
1681     {
1682         sal_Int32 b = 2;
1683         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
1684         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
1685     }
1686     {
1687         sal_uInt32 b = 2;
1688         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
1689         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
1690     }
1691     {
1692         sal_Int64 b = 2;
1693         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
1694         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
1695     }
1696     {
1697         sal_uInt64 b = 2;
1698         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
1699         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
1700     }
1701     {
1702         float b = 2;
1703         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
1704         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
1705     }
1706     {
1707         double b = 2;
1708         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
1709         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
1710     }
1711     {
1712         sal_Unicode b = '2';
1713         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
1714         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
1715     }
1716     {
1717         OUString b("2");
1718         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
1719         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
1720     }
1721     {
1722         css::uno::Type b(cppu::UnoType<OUString>::get());
1723         CPPUNIT_ASSERT_MESSAGE(
1724             "css::uno::Type", (a >>= b));
1725         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1726             "css::uno::Type", cppu::UnoType<sal_Int32>::get(), b);
1727     }
1728     {
1729         css::uno::Sequence< OUString > b(2);
1730         CPPUNIT_ASSERT_MESSAGE(
1731             "css::uno::Sequence<OUString>",
1732             !(a >>= b));
1733         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1734             "css::uno::Sequence<OUString>",
1735             sal_Int32(2), b.getLength());
1736     }
1737     {
1738         Enum1 b = Enum1_M2;
1739         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
1740         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
1741     }
1742     {
1743         Struct1 b(2);
1744         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
1745         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
1746     }
1747     {
1748         Exception1 b(
1749             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1750         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
1751         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
1752     }
1753     {
1754         css::uno::Reference< Interface1 > i(new Impl1);
1755         css::uno::Reference< Interface1 > b(i);
1756         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
1757         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
1758     }
1759 }
1760 
testSequence()1761 void Test::testSequence() {
1762     sal_Int32 n = 1;
1763     css::uno::Any a(css::uno::Sequence< sal_Int32 >(&n, 1));
1764     CPPUNIT_ASSERT(
1765         bool(a.getValueType()
1766         == cppu::UnoType<css::uno::Sequence<sal_Int32>>::get()));
1767     {
1768         bool b = true;
1769         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
1770         CPPUNIT_ASSERT_MESSAGE("bool", b);
1771     }
1772     {
1773         sal_Bool b = true;
1774         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
1775         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
1776     }
1777     {
1778         sal_Int8 b = 2;
1779         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
1780         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
1781     }
1782     {
1783         sal_Int16 b = 2;
1784         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
1785         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
1786     }
1787     {
1788         sal_uInt16 b = 2;
1789         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
1790         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
1791     }
1792     {
1793         sal_Int32 b = 2;
1794         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
1795         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
1796     }
1797     {
1798         sal_uInt32 b = 2;
1799         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
1800         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
1801     }
1802     {
1803         sal_Int64 b = 2;
1804         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
1805         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
1806     }
1807     {
1808         sal_uInt64 b = 2;
1809         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
1810         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
1811     }
1812     {
1813         float b = 2;
1814         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
1815         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
1816     }
1817     {
1818         double b = 2;
1819         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
1820         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
1821     }
1822     {
1823         sal_Unicode b = '2';
1824         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
1825         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
1826     }
1827     {
1828         OUString b("2");
1829         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
1830         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
1831     }
1832     {
1833         css::uno::Type b(cppu::UnoType<OUString>::get());
1834         CPPUNIT_ASSERT_MESSAGE(
1835             "css::uno::Type",
1836             !(a >>= b));
1837         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1838             "css::uno::Type",
1839             cppu::UnoType<OUString>::get(), b);
1840     }
1841     {
1842         css::uno::Sequence< OUString > b(2);
1843         CPPUNIT_ASSERT_MESSAGE(
1844             "css::uno::Sequence<OUString>",
1845             !(a >>= b));
1846         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1847             "css::uno::Sequence<OUString>",
1848             sal_Int32(2), b.getLength());
1849     }
1850     {
1851         css::uno::Sequence< sal_Int32 > b(2);
1852         CPPUNIT_ASSERT_MESSAGE(
1853             "css::uno::Sequence<sal_Int32>",
1854             (a >>= b));
1855         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1856             "css::uno::Sequence<sal_Int32>",
1857             sal_Int32(1), b.getLength());
1858         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1859             "css::uno::Sequence<sal_Int32>",
1860             sal_Int32(1), b[0]);
1861     }
1862     {
1863         Enum1 b = Enum1_M2;
1864         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
1865         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
1866     }
1867     {
1868         Struct1 b(2);
1869         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
1870         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
1871     }
1872     {
1873         Exception1 b(
1874             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1875         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
1876         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
1877     }
1878     {
1879         css::uno::Reference< Interface1 > i(new Impl1);
1880         css::uno::Reference< Interface1 > b(i);
1881         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
1882         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
1883     }
1884 }
1885 
testEnum()1886 void Test::testEnum() {
1887     css::uno::Any a(Enum2_M1);
1888     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Enum2>::get()));
1889     {
1890         bool b = true;
1891         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
1892         CPPUNIT_ASSERT_MESSAGE("bool", b);
1893     }
1894     {
1895         sal_Bool b = true;
1896         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
1897         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
1898     }
1899     {
1900         sal_Int8 b = 2;
1901         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
1902         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
1903     }
1904     {
1905         sal_Int16 b = 2;
1906         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
1907         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
1908     }
1909     {
1910         sal_uInt16 b = 2;
1911         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
1912         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
1913     }
1914     {
1915         sal_Int32 b = 2;
1916         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
1917         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
1918     }
1919     {
1920         sal_uInt32 b = 2;
1921         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
1922         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
1923     }
1924     {
1925         sal_Int64 b = 2;
1926         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
1927         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
1928     }
1929     {
1930         sal_uInt64 b = 2;
1931         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
1932         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
1933     }
1934     {
1935         float b = 2;
1936         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
1937         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
1938     }
1939     {
1940         double b = 2;
1941         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
1942         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
1943     }
1944     {
1945         sal_Unicode b = '2';
1946         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
1947         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
1948     }
1949     {
1950         OUString b("2");
1951         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
1952         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
1953     }
1954     {
1955         css::uno::Type b(cppu::UnoType<OUString>::get());
1956         CPPUNIT_ASSERT_MESSAGE(
1957             "css::uno::Type",
1958             !(a >>= b));
1959         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1960             "css::uno::Type",
1961             cppu::UnoType<OUString>::get(), b);
1962     }
1963     {
1964         css::uno::Sequence< OUString > b(2);
1965         CPPUNIT_ASSERT_MESSAGE(
1966             "css::uno::Sequence<OUString>",
1967             !(a >>= b));
1968         CPPUNIT_ASSERT_EQUAL_MESSAGE(
1969             "css::uno::Sequence<OUString>",
1970             sal_Int32(2), b.getLength());
1971     }
1972     {
1973         Enum1 b = Enum1_M2;
1974         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
1975         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
1976     }
1977     {
1978         Enum2 b = Enum2_M2;
1979         CPPUNIT_ASSERT_MESSAGE("Enum2", (a >>= b));
1980         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum2", Enum2_M1, b);
1981     }
1982     {
1983         Struct1 b(2);
1984         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
1985         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
1986     }
1987     {
1988         Exception1 b(
1989             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
1990         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
1991         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
1992     }
1993     {
1994         css::uno::Reference< Interface1 > i(new Impl1);
1995         css::uno::Reference< Interface1 > b(i);
1996         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
1997         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
1998     }
1999 }
2000 
testStruct()2001 void Test::testStruct() {
2002     css::uno::Any a(Struct2a(1, 3));
2003     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Struct2a>::get()));
2004     {
2005         bool b = true;
2006         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
2007         CPPUNIT_ASSERT_MESSAGE("bool", b);
2008     }
2009     {
2010         sal_Bool b = true;
2011         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
2012         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
2013     }
2014     {
2015         sal_Int8 b = 2;
2016         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
2017         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
2018     }
2019     {
2020         sal_Int16 b = 2;
2021         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
2022         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
2023     }
2024     {
2025         sal_uInt16 b = 2;
2026         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
2027         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
2028     }
2029     {
2030         sal_Int32 b = 2;
2031         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
2032         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
2033     }
2034     {
2035         sal_uInt32 b = 2;
2036         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
2037         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
2038     }
2039     {
2040         sal_Int64 b = 2;
2041         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
2042         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
2043     }
2044     {
2045         sal_uInt64 b = 2;
2046         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
2047         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
2048     }
2049     {
2050         float b = 2;
2051         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
2052         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
2053     }
2054     {
2055         double b = 2;
2056         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
2057         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
2058     }
2059     {
2060         sal_Unicode b = '2';
2061         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
2062         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
2063     }
2064     {
2065         OUString b("2");
2066         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
2067         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
2068     }
2069     {
2070         css::uno::Type b(cppu::UnoType<OUString>::get());
2071         CPPUNIT_ASSERT_MESSAGE(
2072             "css::uno::Type",
2073             !(a >>= b));
2074         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2075             "css::uno::Type",
2076             cppu::UnoType<OUString>::get(), b);
2077     }
2078     {
2079         css::uno::Sequence< OUString > b(2);
2080         CPPUNIT_ASSERT_MESSAGE(
2081             "css::uno::Sequence<OUString>",
2082             !(a >>= b));
2083         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2084             "css::uno::Sequence<OUString>",
2085             sal_Int32(2), b.getLength());
2086     }
2087     {
2088         Enum1 b = Enum1_M2;
2089         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
2090         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
2091     }
2092     {
2093         Struct1 b(2);
2094         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
2095         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
2096     }
2097     {
2098         Struct2 b(2);
2099         CPPUNIT_ASSERT_MESSAGE("Struct2", (a >>= b));
2100         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct2", sal_Int32(1), b.member);
2101     }
2102     {
2103         Struct2a b(2, 2);
2104         CPPUNIT_ASSERT_MESSAGE(
2105             "Struct2a", (a >>= b));
2106         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2107             "Struct2a", sal_Int32(1), b.member);
2108         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2109             "Struct2a", sal_Int32(3), b.member2);
2110     }
2111     {
2112         Struct2b b(2, 2, 2);
2113         CPPUNIT_ASSERT_MESSAGE("Struct2b", !(a >>= b));
2114         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct2b", sal_Int32(2), b.member);
2115     }
2116     {
2117         Exception1 b(
2118             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2119         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
2120         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
2121     }
2122     {
2123         css::uno::Reference< Interface1 > i(new Impl1);
2124         css::uno::Reference< Interface1 > b(i);
2125         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
2126         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
2127     }
2128 }
2129 
testPoly()2130 void Test::testPoly() {
2131     css::uno::Any a;
2132     a <<= Poly< css::uno::Sequence< ::sal_Unicode > >();
2133     CPPUNIT_ASSERT_EQUAL_MESSAGE( "type name", OUString("Poly<[]char>"), a.getValueType().getTypeName() );
2134     CPPUNIT_ASSERT_EQUAL_MESSAGE(
2135         "constructor",
2136         css::uno::Any(Poly< css::uno::Sequence< ::sal_Unicode > >()), a);
2137 }
2138 
testException()2139 void Test::testException() {
2140     css::uno::Any a(
2141         Exception2a(
2142             OUString(), css::uno::Reference< css::uno::XInterface >(), 1,
2143             3));
2144     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Exception2a>::get()));
2145     {
2146         bool b = true;
2147         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
2148         CPPUNIT_ASSERT_MESSAGE("bool", b);
2149     }
2150     {
2151         sal_Bool b = true;
2152         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
2153         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
2154     }
2155     {
2156         sal_Int8 b = 2;
2157         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
2158         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
2159     }
2160     {
2161         sal_Int16 b = 2;
2162         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
2163         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
2164     }
2165     {
2166         sal_uInt16 b = 2;
2167         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
2168         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
2169     }
2170     {
2171         sal_Int32 b = 2;
2172         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
2173         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
2174     }
2175     {
2176         sal_uInt32 b = 2;
2177         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
2178         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
2179     }
2180     {
2181         sal_Int64 b = 2;
2182         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
2183         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
2184     }
2185     {
2186         sal_uInt64 b = 2;
2187         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
2188         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
2189     }
2190     {
2191         float b = 2;
2192         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
2193         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
2194     }
2195     {
2196         double b = 2;
2197         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
2198         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
2199     }
2200     {
2201         sal_Unicode b = '2';
2202         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
2203         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
2204     }
2205     {
2206         OUString b("2");
2207         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
2208         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
2209     }
2210     {
2211         css::uno::Type b(cppu::UnoType<OUString>::get());
2212         CPPUNIT_ASSERT_MESSAGE(
2213             "css::uno::Type",
2214             !(a >>= b));
2215         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2216             "css::uno::Type",
2217             cppu::UnoType<OUString>::get(), b);
2218     }
2219     {
2220         css::uno::Sequence< OUString > b(2);
2221         CPPUNIT_ASSERT_MESSAGE(
2222             "css::uno::Sequence<OUString>",
2223             !(a >>= b));
2224         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2225             "css::uno::Sequence<OUString>",
2226             sal_Int32(2), b.getLength());
2227     }
2228     {
2229         Enum1 b = Enum1_M2;
2230         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
2231         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
2232     }
2233     {
2234         Struct1 b(2);
2235         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
2236         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
2237     }
2238     {
2239         Exception1 b(
2240             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2241         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
2242         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
2243     }
2244     {
2245         Exception2 b(
2246             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2247         CPPUNIT_ASSERT_MESSAGE("Exception2", (a >>= b));
2248         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception2", sal_Int32(1), b.member);
2249     }
2250     {
2251         Exception2a b(
2252             OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2253             2);
2254         CPPUNIT_ASSERT_MESSAGE(
2255             "Exception2a", (a >>= b));
2256         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2257             "Exception2a", sal_Int32(1), b.member);
2258         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2259             "Exception2a", sal_Int32(3), b.member2);
2260     }
2261     {
2262         Exception2b b(
2263             OUString(), css::uno::Reference< css::uno::XInterface >(), 2,
2264             2);
2265         CPPUNIT_ASSERT_MESSAGE("Exception2b", !(a >>= b));
2266         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception2b", sal_Int32(2), b.member);
2267     }
2268     {
2269         css::uno::Reference< Interface1 > i(new Impl1);
2270         css::uno::Reference< Interface1 > b(i);
2271         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
2272         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
2273     }
2274 }
2275 
testInterface()2276 void Test::testInterface() {
2277     css::uno::Reference< Interface2a > i2(new Impl2);
2278     css::uno::Any a(i2);
2279     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Interface2a>::get()));
2280     {
2281         bool b = true;
2282         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
2283         CPPUNIT_ASSERT_MESSAGE("bool", b);
2284     }
2285     {
2286         sal_Bool b = true;
2287         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
2288         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
2289     }
2290     {
2291         sal_Int8 b = 2;
2292         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
2293         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
2294     }
2295     {
2296         sal_Int16 b = 2;
2297         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
2298         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
2299     }
2300     {
2301         sal_uInt16 b = 2;
2302         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
2303         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
2304     }
2305     {
2306         sal_Int32 b = 2;
2307         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
2308         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
2309     }
2310     {
2311         sal_uInt32 b = 2;
2312         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
2313         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
2314     }
2315     {
2316         sal_Int64 b = 2;
2317         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
2318         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
2319     }
2320     {
2321         sal_uInt64 b = 2;
2322         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
2323         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
2324     }
2325     {
2326         float b = 2;
2327         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
2328         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
2329     }
2330     {
2331         double b = 2;
2332         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
2333         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
2334     }
2335     {
2336         sal_Unicode b = '2';
2337         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
2338         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
2339     }
2340     {
2341         OUString b("2");
2342         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
2343         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
2344     }
2345     {
2346         css::uno::Type b(cppu::UnoType<OUString>::get());
2347         CPPUNIT_ASSERT_MESSAGE(
2348             "css::uno::Type",
2349             !(a >>= b));
2350         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2351             "css::uno::Type",
2352             cppu::UnoType<OUString>::get(), b);
2353     }
2354     {
2355         css::uno::Sequence< OUString > b(2);
2356         CPPUNIT_ASSERT_MESSAGE(
2357             "css::uno::Sequence<OUString>",
2358             !(a >>= b));
2359         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2360             "css::uno::Sequence<OUString>",
2361             sal_Int32(2), b.getLength());
2362     }
2363     {
2364         Enum1 b = Enum1_M2;
2365         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
2366         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
2367     }
2368     {
2369         Struct1 b(2);
2370         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
2371         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
2372     }
2373     {
2374         Exception1 b(
2375             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2376         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
2377         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
2378     }
2379     {
2380         css::uno::Reference< Interface1 > i(new Impl1);
2381         css::uno::Reference< Interface1 > b(i);
2382         CPPUNIT_ASSERT_MESSAGE("Interface1", !(a >>= b));
2383         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface1", i, b);
2384     }
2385     {
2386         css::uno::Reference< Interface2 > b(new Impl2);
2387         CPPUNIT_ASSERT_MESSAGE("Interface2", (a >>= b));
2388         CPPUNIT_ASSERT_MESSAGE("Interface2", b.operator ==(i2));
2389     }
2390     {
2391         css::uno::Reference< Interface2a > b(new Impl2);
2392         CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b));
2393         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface2a", i2, b);
2394     }
2395     {
2396         css::uno::Reference< Interface2b > i(new Impl2b);
2397         css::uno::Reference< Interface2b > b(i);
2398         CPPUNIT_ASSERT_MESSAGE("Interface2b", !(a >>= b));
2399         CPPUNIT_ASSERT_EQUAL_MESSAGE("Interface2b", i, b);
2400     }
2401     {
2402         css::uno::Reference< Interface3 > b(new Impl2);
2403         CPPUNIT_ASSERT_MESSAGE("Interface3", (a >>= b));
2404         CPPUNIT_ASSERT_MESSAGE("Interface3", b.operator ==(i2));
2405     }
2406 }
2407 
testNull()2408 void Test::testNull() {
2409     css::uno::Any a { css::uno::Reference< Interface2a >() };
2410     CPPUNIT_ASSERT(bool(a.getValueType() == cppu::UnoType<Interface2a>::get()));
2411     {
2412         bool b = true;
2413         CPPUNIT_ASSERT_MESSAGE("bool", !(a >>= b));
2414         CPPUNIT_ASSERT_MESSAGE("bool", b);
2415     }
2416     {
2417         sal_Bool b = true;
2418         CPPUNIT_ASSERT_MESSAGE("sal_Bool", !(a >>= b));
2419         CPPUNIT_ASSERT_MESSAGE("sal_Bool", b);
2420     }
2421     {
2422         sal_Int8 b = 2;
2423         CPPUNIT_ASSERT_MESSAGE("sal_Int8", !(a >>= b));
2424         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int8", sal_Int8(2), b);
2425     }
2426     {
2427         sal_Int16 b = 2;
2428         CPPUNIT_ASSERT_MESSAGE("sal_Int16", !(a >>= b));
2429         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int16", sal_Int16(2), b);
2430     }
2431     {
2432         sal_uInt16 b = 2;
2433         CPPUNIT_ASSERT_MESSAGE("sal_uInt16", !(a >>= b));
2434         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt16", sal_uInt16(2), b);
2435     }
2436     {
2437         sal_Int32 b = 2;
2438         CPPUNIT_ASSERT_MESSAGE("sal_Int32", !(a >>= b));
2439         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int32", sal_Int32(2), b);
2440     }
2441     {
2442         sal_uInt32 b = 2;
2443         CPPUNIT_ASSERT_MESSAGE("sal_uInt32", !(a >>= b));
2444         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt32", sal_uInt32(2), b);
2445     }
2446     {
2447         sal_Int64 b = 2;
2448         CPPUNIT_ASSERT_MESSAGE("sal_Int64", !(a >>= b));
2449         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Int64", sal_Int64(2), b);
2450     }
2451     {
2452         sal_uInt64 b = 2;
2453         CPPUNIT_ASSERT_MESSAGE("sal_uInt64", !(a >>= b));
2454         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_uInt64", sal_uInt64(2), b);
2455     }
2456     {
2457         float b = 2;
2458         CPPUNIT_ASSERT_MESSAGE("float", !(a >>= b));
2459         CPPUNIT_ASSERT_EQUAL_MESSAGE("float", float(2), b);
2460     }
2461     {
2462         double b = 2;
2463         CPPUNIT_ASSERT_MESSAGE("double", !(a >>= b));
2464         CPPUNIT_ASSERT_EQUAL_MESSAGE("double", 2.0, b);
2465     }
2466     {
2467         sal_Unicode b = '2';
2468         CPPUNIT_ASSERT_MESSAGE("sal_Unicode", !(a >>= b));
2469         CPPUNIT_ASSERT_EQUAL_MESSAGE("sal_Unicode", u'2', b);
2470     }
2471     {
2472         OUString b("2");
2473         CPPUNIT_ASSERT_MESSAGE( "OUString", !(a >>= b) );
2474         CPPUNIT_ASSERT_EQUAL_MESSAGE( "OUString", OUString("2"), b );
2475     }
2476     {
2477         css::uno::Type b(cppu::UnoType<OUString>::get());
2478         CPPUNIT_ASSERT_MESSAGE(
2479             "css::uno::Type",
2480             !(a >>= b));
2481         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2482             "css::uno::Type",
2483             cppu::UnoType<OUString>::get(), b);
2484     }
2485     {
2486         css::uno::Sequence< OUString > b(2);
2487         CPPUNIT_ASSERT_MESSAGE(
2488             "css::uno::Sequence<OUString>",
2489             !(a >>= b));
2490         CPPUNIT_ASSERT_EQUAL_MESSAGE(
2491             "css::uno::Sequence<OUString>",
2492             sal_Int32(2), b.getLength());
2493     }
2494     {
2495         Enum1 b = Enum1_M2;
2496         CPPUNIT_ASSERT_MESSAGE("Enum1", !(a >>= b));
2497         CPPUNIT_ASSERT_EQUAL_MESSAGE("Enum1", Enum1_M2, b);
2498     }
2499     {
2500         Struct1 b(2);
2501         CPPUNIT_ASSERT_MESSAGE("Struct1", !(a >>= b));
2502         CPPUNIT_ASSERT_EQUAL_MESSAGE("Struct1", sal_Int32(2), b.member);
2503     }
2504     {
2505         Exception1 b(
2506             OUString(), css::uno::Reference< css::uno::XInterface >(), 2);
2507         CPPUNIT_ASSERT_MESSAGE("Exception1", !(a >>= b));
2508         CPPUNIT_ASSERT_EQUAL_MESSAGE("Exception1", sal_Int32(2), b.member);
2509     }
2510     {
2511         css::uno::Reference< Interface1 > b(new Impl1);
2512         CPPUNIT_ASSERT_MESSAGE(
2513             "Interface1", (a >>= b));
2514         CPPUNIT_ASSERT_MESSAGE(
2515             "Interface1", !b.is());
2516     }
2517     {
2518         css::uno::Reference< Interface2 > b(new Impl2);
2519         CPPUNIT_ASSERT_MESSAGE(
2520             "Interface2", (a >>= b));
2521         CPPUNIT_ASSERT_MESSAGE(
2522             "Interface2", !b.is());
2523     }
2524     {
2525         css::uno::Reference< Interface2a > b(new Impl2);
2526         CPPUNIT_ASSERT_MESSAGE("Interface2a", (a >>= b));
2527         CPPUNIT_ASSERT_MESSAGE("Interface2a", !b.is());
2528     }
2529     {
2530         css::uno::Reference< Interface2b > b(new Impl2b);
2531         CPPUNIT_ASSERT_MESSAGE(
2532             "Interface2b", (a >>= b));
2533         CPPUNIT_ASSERT_MESSAGE(
2534             "Interface2b", !b.is());
2535     }
2536     {
2537         css::uno::Reference< Interface3 > b(new Impl2);
2538         CPPUNIT_ASSERT_MESSAGE(
2539             "Interface3", (a >>= b));
2540         CPPUNIT_ASSERT_MESSAGE(
2541             "Interface3", !b.is());
2542     }
2543 }
2544 
2545 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
2546 
2547 }
2548 
2549 CPPUNIT_PLUGIN_IMPLEMENT();
2550 
2551 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
2552