blob: ece32386d5618f855c582f50ef329f629dc57dca [file] [log] [blame]
Narayan Kamath11d9f062014-04-23 20:24:57 +01001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "instruction_set.h"
18
19#include "common_runtime_test.h"
20
21namespace art {
22
23class InstructionSetTest : public CommonRuntimeTest {};
24
25TEST_F(InstructionSetTest, GetInstructionSetFromString) {
26 EXPECT_EQ(kArm, GetInstructionSetFromString("arm"));
27 EXPECT_EQ(kArm64, GetInstructionSetFromString("arm64"));
28 EXPECT_EQ(kX86, GetInstructionSetFromString("x86"));
29 EXPECT_EQ(kX86_64, GetInstructionSetFromString("x86_64"));
30 EXPECT_EQ(kMips, GetInstructionSetFromString("mips"));
31 EXPECT_EQ(kNone, GetInstructionSetFromString("none"));
32}
33
34TEST_F(InstructionSetTest, GetInstructionSetString) {
35 EXPECT_STREQ("arm", GetInstructionSetString(kArm));
36 EXPECT_STREQ("arm", GetInstructionSetString(kThumb2));
37 EXPECT_STREQ("arm64", GetInstructionSetString(kArm64));
38 EXPECT_STREQ("x86", GetInstructionSetString(kX86));
39 EXPECT_STREQ("x86_64", GetInstructionSetString(kX86_64));
40 EXPECT_STREQ("mips", GetInstructionSetString(kMips));
41 EXPECT_STREQ("none", GetInstructionSetString(kNone));
42}
43
44TEST_F(InstructionSetTest, TestRoundTrip) {
45 EXPECT_EQ(kRuntimeISA, GetInstructionSetFromString(GetInstructionSetString(kRuntimeISA)));
46}
47
Alexei Zavjalov41c507a2014-05-15 16:02:46 +070048TEST_F(InstructionSetTest, PointerSize) {
49 EXPECT_EQ(kPointerSize, GetInstructionSetPointerSize(kRuntimeISA));
50}
51
Narayan Kamath11d9f062014-04-23 20:24:57 +010052} // namespace art