| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "courgette/rel32_finder_win32_x86.h" | 5 #include "courgette/rel32_finder_win32_x86.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 Rel32FinderWin32X86TestCase(const std::string& test_data) | 26 Rel32FinderWin32X86TestCase(const std::string& test_data) |
| 27 : text_start_rva_(0), | 27 : text_start_rva_(0), |
| 28 text_end_rva_(0), | 28 text_end_rva_(0), |
| 29 relocs_start_rva_(0), | 29 relocs_start_rva_(0), |
| 30 relocs_end_rva_(0), | 30 relocs_end_rva_(0), |
| 31 image_end_rva_(0) { | 31 image_end_rva_(0) { |
| 32 LoadTestFromString(test_data); | 32 LoadTestFromString(test_data); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void RunTestBasic(std::string name) { | 35 void RunTestBasic(std::string name) { |
| 36 Rel32FinderWin32X86_Basic finder(relocs_start_rva_, relocs_end_rva_, | 36 Rel32FinderWin32X86_Basic finder(relocs_start_rva_, relocs_end_rva_); |
| 37 image_end_rva_); | |
| 38 ASSERT_FALSE(text_data_.empty()); | 37 ASSERT_FALSE(text_data_.empty()); |
| 39 finder.Find(&text_data_[0], &text_data_[0] + text_data_.size(), | 38 finder.Find(&text_data_[0], &text_data_[0] + text_data_.size(), |
| 40 text_start_rva_, text_end_rva_, abs32_locations_); | 39 text_start_rva_, text_end_rva_, abs32_locations_); |
| 41 std::vector<RVA> rel32_locations; | 40 std::vector<RVA> rel32_locations; |
| 42 finder.SwapRel32Locations(&rel32_locations); | 41 finder.SwapRel32Locations(&rel32_locations); |
| 43 EXPECT_EQ(expected_rel32_locations_, rel32_locations) | 42 EXPECT_EQ(expected_rel32_locations_, rel32_locations) |
| 44 << "From test case " << name << " (addresses are in hex)"; | 43 << "From test case " << name << " (addresses are in hex)"; |
| 45 } | 44 } |
| 46 | 45 |
| 47 private: | 46 private: |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 TEST_F(Rel32FinderWin32X86Test, TestBasic) { | 142 TEST_F(Rel32FinderWin32X86Test, TestBasic) { |
| 144 RunTest("rel32_win32_x86_01.txt"); | 143 RunTest("rel32_win32_x86_01.txt"); |
| 145 RunTest("rel32_win32_x86_02.txt"); | 144 RunTest("rel32_win32_x86_02.txt"); |
| 146 RunTest("rel32_win32_x86_03.txt"); | 145 RunTest("rel32_win32_x86_03.txt"); |
| 147 RunTest("rel32_win32_x86_04.txt"); | 146 RunTest("rel32_win32_x86_04.txt"); |
| 148 } | 147 } |
| 149 | 148 |
| 150 } // namespace | 149 } // namespace |
| 151 | 150 |
| 152 } // namespace courgette | 151 } // namespace courgette |
| OLD | NEW |