Index: test/unittests/source-position-table-unittest.cc |
diff --git a/test/unittests/source-position-table-unittest.cc b/test/unittests/source-position-table-unittest.cc |
index b1d63aa3dde7f014224ffabf9866f723a6444168..680e1be4c706ce29fcb35604983728aeaef4c448 100644 |
--- a/test/unittests/source-position-table-unittest.cc |
+++ b/test/unittests/source-position-table-unittest.cc |
@@ -16,6 +16,10 @@ class SourcePositionTableTest : public TestWithIsolateAndZone { |
public: |
SourcePositionTableTest() {} |
~SourcePositionTableTest() override {} |
+ |
+ SourcePosition toPos(int offset) { |
+ return SourcePosition(offset, offset % 10 - 1); |
+ } |
}; |
// Some random offsets, mostly at 'suspicious' bit boundaries. |
@@ -26,7 +30,7 @@ static int offsets[] = {0, 1, 2, 3, 4, 30, 31, 32, |
TEST_F(SourcePositionTableTest, EncodeStatement) { |
SourcePositionTableBuilder builder(zone()); |
for (size_t i = 0; i < arraysize(offsets); i++) { |
- builder.AddPosition(offsets[i], offsets[i], true); |
+ builder.AddPosition(offsets[i], toPos(offsets[i]), true); |
} |
// To test correctness, we rely on the assertions in ToSourcePositionTable(). |
@@ -38,8 +42,8 @@ TEST_F(SourcePositionTableTest, EncodeStatement) { |
TEST_F(SourcePositionTableTest, EncodeStatementDuplicates) { |
SourcePositionTableBuilder builder(zone()); |
for (size_t i = 0; i < arraysize(offsets); i++) { |
- builder.AddPosition(offsets[i], offsets[i], true); |
- builder.AddPosition(offsets[i], offsets[i] + 1, true); |
+ builder.AddPosition(offsets[i], toPos(offsets[i]), true); |
+ builder.AddPosition(offsets[i], toPos(offsets[i] + 1), true); |
} |
// To test correctness, we rely on the assertions in ToSourcePositionTable(). |
@@ -51,7 +55,7 @@ TEST_F(SourcePositionTableTest, EncodeStatementDuplicates) { |
TEST_F(SourcePositionTableTest, EncodeExpression) { |
SourcePositionTableBuilder builder(zone()); |
for (size_t i = 0; i < arraysize(offsets); i++) { |
- builder.AddPosition(offsets[i], offsets[i], false); |
+ builder.AddPosition(offsets[i], toPos(offsets[i]), false); |
} |
CHECK(!builder.ToSourcePositionTable(isolate(), Handle<AbstractCode>()) |
.is_null()); |
@@ -66,9 +70,9 @@ TEST_F(SourcePositionTableTest, EncodeAscending) { |
code_offset += offsets[i]; |
source_position += offsets[i]; |
if (i % 2) { |
- builder.AddPosition(code_offset, source_position, true); |
+ builder.AddPosition(code_offset, toPos(source_position), true); |
} else { |
- builder.AddPosition(code_offset, source_position, false); |
+ builder.AddPosition(code_offset, toPos(source_position), false); |
} |
} |
@@ -77,9 +81,9 @@ TEST_F(SourcePositionTableTest, EncodeAscending) { |
code_offset += offsets[i]; |
source_position -= offsets[i]; |
if (i % 2) { |
- builder.AddPosition(code_offset, source_position, true); |
+ builder.AddPosition(code_offset, toPos(source_position), true); |
} else { |
- builder.AddPosition(code_offset, source_position, false); |
+ builder.AddPosition(code_offset, toPos(source_position), false); |
} |
} |