fixup! Move info about existing statements into known data.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#
-from pynguin.testcase.execution import ExecutionTrace, FileStatementData
+from pynguin.testcase.execution import ExecutionTrace
def test_merge():
@@ -15,13 +15,6 @@ def test_merge():
def test_merge_full():
- foo_tracker_1 = FileStatementData("foo")
- foo_tracker_1.statements.add(0)
- foo_tracker_1.statements.add(1)
- foo_tracker_1.visited_statements[0] = 1
- bar_tracker_1 = FileStatementData("bar")
- bar_tracker_1.statements.add(0)
- bar_tracker_1.statements.add(1)
trace0 = ExecutionTrace()
trace0.executed_code_objects.add(0)
trace0.executed_code_objects.add(1)
@@ -31,14 +24,8 @@ def test_merge_full():
trace0.true_distances[1] = 3
trace0.false_distances[0] = 0
trace0.false_distances[1] = 1
- trace0.file_trackers["foo"] = foo_tracker_1
- trace0.file_trackers["bar"] = bar_tracker_1
+ trace0.covered_statements = {"foo": {1}}
- foo_tracker_2 = FileStatementData("foo")
- foo_tracker_2.statements.add(0)
- foo_tracker_2.statements.add(1)
- foo_tracker_2.visited_statements[0] = 3
- foo_tracker_2.visited_statements[1] = 3
trace1 = ExecutionTrace()
trace1.executed_code_objects.add(1)
trace1.executed_code_objects.add(2)
@@ -48,17 +35,9 @@ def test_merge_full():
trace1.true_distances[2] = 3
trace1.false_distances[1] = 234
trace1.false_distances[2] = 0
- trace1.file_trackers["foo"] = foo_tracker_2
+ trace1.covered_statements = {"foo": {0}}
result = ExecutionTrace()
- foo_tracker_3 = FileStatementData("foo")
- foo_tracker_3.statements.add(0)
- foo_tracker_3.statements.add(1)
- foo_tracker_3.visited_statements[0] = 4
- foo_tracker_3.visited_statements[1] = 3
- bar_tracker_2 = FileStatementData("bar")
- bar_tracker_2.statements.add(0)
- bar_tracker_2.statements.add(1)
result.executed_code_objects.add(0)
result.executed_code_objects.add(1)
result.executed_code_objects.add(2)
@@ -71,8 +50,7 @@ def test_merge_full():
result.false_distances[0] = 0
result.false_distances[1] = 1
result.false_distances[2] = 0
- result.file_trackers["foo"] = foo_tracker_3
- result.file_trackers["bar"] = bar_tracker_2
+ result.covered_statements = {"foo": {0, 1}}
trace0.merge(trace1)
assert trace0 == result
