MCPcopy Create free account
hub / github.com/LFYSec/MScan / IRTest

Class IRTest

src/test/java/pascal/taie/frontend/soot/IRTest.java:35–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33import java.util.List;
34
35public class IRTest {
36
37 private static final List<String> targets = List.of("AllInOne");
38
39 private static void buildWorld(String mainClass) {
40 Main.buildWorld("-pp", "-cp", "src/test/resources/world", "--input-classes", mainClass);
41 }
42
43 @Test
44 void testBottomType() {
45 String clzName = "android$widget$RemoteViews$BaseReflectionAction";
46 Main.buildWorld("-ap", "-cp", "src/test/resources/world",
47 "--input-classes", clzName);
48 World.get().getClassHierarchy().getClass(clzName)
49 .getDeclaredMethod("initActionAsync").getIR();
50 }
51
52 @Test
53 void testIRBuilder() {
54 targets.forEach(main -> {
55 buildWorld(main);
56 JClass mainClass = World.get().getClassHierarchy().getClass(main);
57 mainClass.getDeclaredMethods()
58 .stream()
59 .sorted(Comparator.comparing(JMethod::toString))
60 .forEach(m ->
61 IRPrinter.print(m.getIR(), System.out));
62 System.out.println("------------------------------\n");
63 });
64 }
65
66 @Test
67 void testDefUse() {
68 String main = "DefUse";
69 buildWorld(main);
70 JClass mainClass = World.get().getClassHierarchy().getClass(main);
71 mainClass.getDeclaredMethods().forEach(m -> {
72 System.out.println(m);
73 m.getIR().forEach(stmt ->
74 System.out.printf("%s, def: %s, uses: %s%n",
75 stmt, stmt.getDef(), stmt.getUses()));
76 System.out.println("--------------------");
77 });
78 }
79}

Callers

nothing calls this directly

Calls 1

ofMethod · 0.65

Tested by

no test coverage detected