1/*
2 * Copyright (C) 2013 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 "common_compiler_test.h"
18#include "sea_ir/types/types.h"
19
20namespace sea_ir {
21
22class TypeDataTest : public art::CommonCompilerTest {};
23
24TEST_F(TypeDataTest, Basics) {
25  TypeData td;
26  art::verifier::RegTypeCache type_cache(false);
27  int first_instruction_id = 1;
28  int second_instruction_id = 3;
29  EXPECT_TRUE(NULL == td.FindTypeOf(first_instruction_id));
30  const Type* int_type = &type_cache.Integer();
31  const Type* byte_type = &type_cache.Byte();
32  td.SetTypeOf(first_instruction_id, int_type);
33  EXPECT_TRUE(int_type == td.FindTypeOf(first_instruction_id));
34  EXPECT_TRUE(NULL == td.FindTypeOf(second_instruction_id));
35  td.SetTypeOf(second_instruction_id, byte_type);
36  EXPECT_TRUE(int_type == td.FindTypeOf(first_instruction_id));
37  EXPECT_TRUE(byte_type == td.FindTypeOf(second_instruction_id));
38}
39
40}  // namespace sea_ir
41