| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 | 10 |
| 11 #include "courgette/assembly_program.h" | 11 #include "courgette/assembly_program.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 // Returns one of two similar a simple programs. They differ only in the | 28 // Returns one of two similar a simple programs. They differ only in the |
| 29 // label assignment, so that it is possible to make them look identical. | 29 // label assignment, so that it is possible to make them look identical. |
| 30 courgette::AssemblyProgram* MakeProgram(int kind) const { | 30 courgette::AssemblyProgram* MakeProgram(int kind) const { |
| 31 courgette::AssemblyProgram* prog = new courgette::AssemblyProgram(); | 31 courgette::AssemblyProgram* prog = new courgette::AssemblyProgram(); |
| 32 prog->set_image_base(0x00400000); | 32 prog->set_image_base(0x00400000); |
| 33 | 33 |
| 34 courgette::Label* labelA = prog->FindOrMakeAbs32Label(0x00410000); | 34 courgette::Label* labelA = prog->FindOrMakeAbs32Label(0x00410000); |
| 35 courgette::Label* labelB = prog->FindOrMakeAbs32Label(0x00410004); | 35 courgette::Label* labelB = prog->FindOrMakeAbs32Label(0x00410004); |
| 36 | 36 |
| 37 prog->EmitAbs32(labelA); | 37 EXPECT_TRUE(prog->EmitAbs32(labelA)); |
| 38 prog->EmitAbs32(labelA); | 38 EXPECT_TRUE(prog->EmitAbs32(labelA)); |
| 39 prog->EmitAbs32(labelB); | 39 EXPECT_TRUE(prog->EmitAbs32(labelB)); |
| 40 prog->EmitAbs32(labelA); | 40 EXPECT_TRUE(prog->EmitAbs32(labelA)); |
| 41 prog->EmitAbs32(labelA); | 41 EXPECT_TRUE(prog->EmitAbs32(labelA)); |
| 42 prog->EmitAbs32(labelB); | 42 EXPECT_TRUE(prog->EmitAbs32(labelB)); |
| 43 | 43 |
| 44 if (kind == 0) { | 44 if (kind == 0) { |
| 45 labelA->index_ = 0; | 45 labelA->index_ = 0; |
| 46 labelB->index_ = 1; | 46 labelB->index_ = 1; |
| 47 } else { | 47 } else { |
| 48 labelA->index_ = 1; | 48 labelA->index_ = 1; |
| 49 labelB->index_ = 0; | 49 labelB->index_ = 0; |
| 50 } | 50 } |
| 51 prog->AssignRemainingIndexes(); | 51 prog->AssignRemainingIndexes(); |
| 52 | 52 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 std::string s6 = Serialize(prog6); | 99 std::string s6 = Serialize(prog6); |
| 100 | 100 |
| 101 EXPECT_TRUE(s1 == s5); // Adjustment did not change A (prog5) | 101 EXPECT_TRUE(s1 == s5); // Adjustment did not change A (prog5) |
| 102 EXPECT_TRUE(s5 == s6); // Adjustment did change B into A | 102 EXPECT_TRUE(s5 == s6); // Adjustment did change B into A |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| 106 TEST_F(AdjustmentMethodTest, All) { | 106 TEST_F(AdjustmentMethodTest, All) { |
| 107 Test1(); | 107 Test1(); |
| 108 } | 108 } |
| OLD | NEW |