@@ -40,6 +40,8 @@ class InterProceduralUnitGraph(graph: ExceptionalUnitGraph) {
4040
4141 val stmts: MutableSet <Stmt > = graph.stmts.toMutableSet()
4242 val registeredEdges: MutableSet <Edge > = graph.edges.toMutableSet()
43+ // this field is required for visualization
44+ val allEdges: MutableSet <Edge > = graph.edges.toMutableSet()
4345 /* *
4446 * Used in [org.utbot.engine.selectors.nurs.InheritorsSelector] for a fast search of Virtual invoke successors.
4547 */
@@ -54,6 +56,7 @@ class InterProceduralUnitGraph(graph: ExceptionalUnitGraph) {
5456 private val edgeToGraph: MutableMap <Edge , ExceptionalUnitGraph > = graph.edges.associateWithTo(mutableMapOf ()) { graph }
5557
5658 private val registeredEdgesCount: MutableMap <Stmt , Int > = graph.outgoingEdgesCount
59+ private val allEdgesCount: MutableMap <Stmt , Int > = graph.outgoingEdgesCount
5760 private val outgoingEdgesCount: MutableMap <Stmt , Int > = graph.outgoingEdgesCount
5861
5962 fun method (stmt : Stmt ): SootMethod = stmtToGraph[stmt]?.body?.method ? : error(" $stmt not in graph." )
@@ -125,6 +128,12 @@ class InterProceduralUnitGraph(graph: ExceptionalUnitGraph) {
125128 outgoingEdgesCount + = graph.outgoingEdgesCount
126129 stmts + = joinedStmts
127130
131+ allEdges + = graph.edges
132+ allEdgesCount + = graph.outgoingEdgesCount
133+ allEdgesCount.computeIfPresent(stmt) { _, value ->
134+ value + 1
135+ }
136+
128137 if (registerEdges) {
129138 registeredMethods + = method
130139 registeredEdgesCount + = graph.outgoingEdgesCount
@@ -144,6 +153,7 @@ class InterProceduralUnitGraph(graph: ExceptionalUnitGraph) {
144153 }
145154
146155 registeredEdges + = invokeEdge
156+ allEdges + = invokeEdge
147157
148158 outgoingEdgesCount.computeIfPresent(stmt) { _, value ->
149159 value + 1
@@ -168,11 +178,8 @@ class InterProceduralUnitGraph(graph: ExceptionalUnitGraph) {
168178
169179 when (edge) {
170180 in implicitEdges -> coveredImplicitEdges + = edge
171- !in registeredEdges -> {
181+ !in registeredEdges, !in coveredEdges -> {
172182 coveredOutgoingEdges.putIfAbsent(edge.src, 0 )
173- coveredEdges + = edge
174- }
175- !in coveredEdges -> {
176183 coveredOutgoingEdges.compute(edge.src) { _, value -> (value ? : 0 ) + 1 }
177184 coveredEdges + = edge
178185 }
@@ -280,7 +287,10 @@ class InterProceduralUnitGraph(graph: ExceptionalUnitGraph) {
280287 * Statement is covered if all the outgoing edges are covered.
281288 */
282289 fun isCovered (stmt : Stmt ) =
283- stmt !in registeredEdgesCount || stmt in coveredOutgoingEdges && coveredOutgoingEdges[stmt]!! >= registeredEdgesCount[stmt]!!
290+ stmt !in registeredEdgesCount || isCoveredIgnoringRegistration(stmt)
291+
292+ fun isCoveredIgnoringRegistration (stmt : Stmt ) =
293+ stmt in coveredOutgoingEdges && coveredOutgoingEdges[stmt]!! >= allEdgesCount[stmt]!!
284294
285295 /* *
286296 * Edge is covered if we visited it in successfully completed execution at least once
0 commit comments