1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
10 #include <sal/config.h>
12 #include <cppunit/TestAssert.h>
13 #include <cppunit/TestFixture.h>
14 #include <cppunit/extensions/HelperMacros.h>
16 #include <o3tl/enumarray.hxx>
20 class Test
: public CppUnit::TestFixture
{
22 CPPUNIT_TEST_SUITE(Test
);
23 CPPUNIT_TEST(testOperations
);
24 CPPUNIT_TEST_SUITE_END();
27 void testOperations() {
28 enum class MyEnum
{ ONE
, TWO
, THREE
, LAST
= THREE
};
29 o3tl::enumarray
<MyEnum
, int> aModules
;
31 aModules
[MyEnum::ONE
] = 1;
32 aModules
[MyEnum::TWO
] = 1;
33 aModules
[MyEnum::THREE
] = 1;
35 o3tl::enumarray
<MyEnum
, int> const & rModules
= aModules
;
37 for (auto const & i
: rModules
)
38 CPPUNIT_ASSERT_EQUAL( 1, i
);
42 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
46 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */