1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <cppunit/TestAssert.h>
11 #include <cppunit/TestFixture.h>
12 #include <cppunit/extensions/HelperMacros.h>
13 #include <cppunit/plugin/TestPlugIn.h>
14 #include <tools/cpuid.hxx>
15 #include <rtl/ustring.hxx>
19 class CpuInstructionSetSupport
: public CppUnit::TestFixture
22 void testCpuInstructionSetSupport();
24 CPPUNIT_TEST_SUITE(CpuInstructionSetSupport
);
25 CPPUNIT_TEST(testCpuInstructionSetSupport
);
26 CPPUNIT_TEST_SUITE_END();
29 void CpuInstructionSetSupport::testCpuInstructionSetSupport()
31 OUString aString
= cpuid::instructionSetSupportedString();
33 if (cpuid::isCpuInstructionSetSupported(cpuid::InstructionSetFlags::SSE2
))
35 CPPUNIT_ASSERT(aString
.indexOf("SSE2") >= 0);
38 if (cpuid::isCpuInstructionSetSupported(cpuid::InstructionSetFlags::SSSE3
))
40 CPPUNIT_ASSERT(aString
.indexOf("SSSE3") >= 0);
43 if (cpuid::isCpuInstructionSetSupported(cpuid::InstructionSetFlags::AVX
))
45 CPPUNIT_ASSERT(aString
.indexOf("AVX") > 0);
48 if (cpuid::isCpuInstructionSetSupported(cpuid::InstructionSetFlags::AVX2
))
50 CPPUNIT_ASSERT(aString
.indexOf("AVX2") > 0);
54 CPPUNIT_TEST_SUITE_REGISTRATION(CpuInstructionSetSupport
);
56 } // end anonymous namespace
58 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */