11package org.usvm.samples.checkers
22
3- import org.jacodb.ets.model.EtsScene
4- import org.jacodb.ets.utils.loadEtsFileAutoConvert
3+ import org.jacodb.ets.utils.loadEtsProjectFromIR
54import org.junit.jupiter.api.Test
65import org.usvm.UMachineOptions
76import org.usvm.api.checkers.UnreachableCodeDetector
@@ -12,21 +11,27 @@ import org.usvm.util.getResourcePath
1211class UnreachableCodeDetectorTest {
1312 @Test
1413 fun testUnreachableCode () {
15- val scene = run {
16- val name = " UnreachableCode.ts"
17- val path = getResourcePath(" /samples/checkers/$name " )
18- val file = loadEtsFileAutoConvert(
19- path,
20- useArkAnalyzerTypeInference = 1
21- )
22- EtsScene (listOf (file))
23- }
14+ // val scene = run {
15+ // val name = "UnreachableCode.ts"
16+ // val path = getResourcePath("/samples/checkers/$name")
17+ // val file = loadEtsFileAutoConvert(
18+ // path,
19+ // useArkAnalyzerTypeInference = 1
20+ // )
21+ // EtsScene(listOf(file))
22+ // }
23+
24+ val path = getResourcePath(" /projects/Demo_Calc/etsir" )
25+ val scene = loadEtsProjectFromIR(path, null )
2426
2527 val options = UMachineOptions ()
2628 val tsOptions = TsOptions (interproceduralAnalysis = false )
2729 val observer = UnreachableCodeDetector ()
2830 val machine = TsMachine (scene, options, tsOptions, observer, observer)
29- val methods = scene.projectClasses.flatMap { it.methods }.filter { it.name == " simpleUnreachableBranch" }
31+ val methods = scene.projectClasses
32+ .flatMap { it.methods }
33+ .filterNot { it.cfg.stmts.isEmpty() }
34+ // .filter { it.name == "simpleUnreachableBranch" }
3035 val results = machine.analyze(methods)
3136
3237 check(results.isNotEmpty())
0 commit comments