Bump version to 6.4.7.2.M8
[LibreOffice.git] / o3tl / qa / test-enumarray.cxx
blob9da8dae18f0be6bfb35f5a4ed5dde4ef40c43d42
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 <stdexcept>
14 #include <cppunit/TestAssert.h>
15 #include <cppunit/TestFixture.h>
16 #include <cppunit/extensions/HelperMacros.h>
18 #include <o3tl/enumarray.hxx>
20 namespace {
22 class Test: public CppUnit::TestFixture {
23 private:
24 CPPUNIT_TEST_SUITE(Test);
25 CPPUNIT_TEST(testOperations);
26 CPPUNIT_TEST_SUITE_END();
29 void testOperations() {
30 enum class MyEnum { ONE, TWO, THREE, LAST = THREE };
31 o3tl::enumarray<MyEnum, int> aModules;
33 aModules[MyEnum::ONE] = 1;
34 aModules[MyEnum::TWO] = 1;
35 aModules[MyEnum::THREE] = 1;
37 o3tl::enumarray<MyEnum, int> const & rModules = aModules;
39 for (auto const & i : rModules)
40 CPPUNIT_ASSERT_EQUAL( 1, i );
44 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
48 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */