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