1 /*
2  * Copyright (C) 2018 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 "read_dex_file.h"
18 
19 #include <gtest/gtest.h>
20 
21 #include <algorithm>
22 
23 #include "get_test_data.h"
24 #include "test_util.h"
25 #include "utils.h"
26 
TEST(read_dex_file,smoke)27 TEST(read_dex_file, smoke) {
28   std::vector<DexFileSymbol> symbols;
29   ASSERT_TRUE(ReadSymbolsFromDexFile(GetTestData("base.vdex"), {0x28}, &symbols));
30   ASSERT_EQ(12435u, symbols.size());
31   DexFileSymbol target;
32   target.offset = 0x6c77e;
33   target.len = 0x16;
34   target.name = art_api::dex::DexString(
35       "com.example.simpleperf.simpleperfexamplewithnative.MixActivity$1.run");
36   ASSERT_NE(std::find(symbols.begin(), symbols.end(), target), symbols.end());
37 }
38