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 <tools/cpuid.hxx>
14 #include <rtl/ustring.hxx>
18 class CpuInstructionSetSupport
: public CppUnit::TestFixture
21 void testCpuInstructionSetSupport();
23 CPPUNIT_TEST_SUITE(CpuInstructionSetSupport
);
24 CPPUNIT_TEST(testCpuInstructionSetSupport
);
25 CPPUNIT_TEST_SUITE_END();
28 void CpuInstructionSetSupport::testCpuInstructionSetSupport()
30 OUString aString
= cpuid::instructionSetSupportedString();
32 if (cpuid::isCpuInstructionSetSupported(cpuid::InstructionSetFlags::SSE2
))
34 CPPUNIT_ASSERT(aString
.indexOf("SSE2") >= 0);
37 if (cpuid::isCpuInstructionSetSupported(cpuid::InstructionSetFlags::SSSE3
))
39 CPPUNIT_ASSERT(aString
.indexOf("SSSE3") >= 0);
42 if (cpuid::isCpuInstructionSetSupported(cpuid::InstructionSetFlags::AVX
))
44 CPPUNIT_ASSERT(aString
.indexOf("AVX") > 0);
47 if (cpuid::isCpuInstructionSetSupported(cpuid::InstructionSetFlags::AVX2
))
49 CPPUNIT_ASSERT(aString
.indexOf("AVX2") > 0);
53 CPPUNIT_TEST_SUITE_REGISTRATION(CpuInstructionSetSupport
);
55 } // end anonymous namespace
57 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */