Update git submodules
[LibreOffice.git] / cppu / qa / any-external.cxx
blobbac61342786c0739655bbf1badf76983b15022f4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <sal/config.h>
12 #include <cppunit/TestAssert.h>
13 #include <cppunit/TestFixture.h>
14 #include <cppunit/extensions/HelperMacros.h>
15 #include <cppunit/plugin/TestPlugIn.h>
17 #include <com/sun/star/uno/Any.hxx>
18 #include <sal/types.h>
20 namespace {
22 class Test: public CppUnit::TestFixture {
23 private:
24 CPPUNIT_TEST_SUITE(Test);
25 CPPUNIT_TEST(testGet);
26 CPPUNIT_TEST(testHas);
27 CPPUNIT_TEST(testExtract);
28 CPPUNIT_TEST(testInsert);
29 CPPUNIT_TEST_SUITE_END();
31 void testGet() {
32 css::uno::Any a(false);
33 CPPUNIT_ASSERT_EQUAL(a, a.get<css::uno::Any>());
34 CPPUNIT_ASSERT_EQUAL(false, a.get<bool>());
37 void testHas() {
38 css::uno::Any a(false);
39 CPPUNIT_ASSERT_EQUAL(true, a.has<css::uno::Any>());
40 CPPUNIT_ASSERT_EQUAL(true, a.has<bool>());
43 void testExtract() {
44 css::uno::Any a1(false);
45 css::uno::Any a2;
46 CPPUNIT_ASSERT(a1 >>= a2);
47 CPPUNIT_ASSERT_EQUAL(a1, a2);
50 void testInsert() {
51 css::uno::Any a;
52 a <<= css::uno::Any(false);
53 CPPUNIT_ASSERT_EQUAL(css::uno::Any(false), a);
57 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
61 CPPUNIT_PLUGIN_IMPLEMENT();
63 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */