forked from spgroup/conflict-static-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(spgroup#31): add Interprocedural Override Assignment Test Cases
- Loading branch information
1 parent
3cdf69c
commit 7e36e2a
Showing
10 changed files
with
620 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
src/test/java/br/unb/cic/analysis/ioa/ClassFieldConflictAnalysisTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package br.unb.cic.analysis.ioa; | ||
|
||
import br.unb.cic.analysis.AbstractMergeConflictDefinition; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import soot.G; | ||
import soot.PackManager; | ||
import soot.Transform; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Ignore | ||
public class ClassFieldConflictAnalysisTest { | ||
|
||
private InterproceduralOverrideAssignment analysis; | ||
|
||
@Before | ||
public void configure() { | ||
G.reset(); | ||
|
||
AbstractMergeConflictDefinition definition = new AbstractMergeConflictDefinition() { | ||
@Override | ||
protected Map<String, List<Integer>> sourceDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(7); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentClassFieldConflictInterProceduralSample", lines); | ||
return res; | ||
} | ||
|
||
@Override | ||
protected Map<String, List<Integer>> sinkDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(8); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentClassFieldConflictInterProceduralSample", lines); | ||
return res; | ||
} | ||
}; | ||
|
||
analysis = new InterproceduralOverrideAssignment(definition); | ||
|
||
PackManager.v().getPack("wjtp").add(new Transform("wjtp.analysis", analysis)); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "on"); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "verbose:true"); | ||
// PhaseOptions.v().setPhaseOption("jb", "use-original-names:true"); | ||
|
||
String testClasses = "target/test-classes/"; | ||
soot.Main.main(new String[]{"-w", "-allow-phantom-refs", "-f", "J", "-keep-line-number", "-process-dir", testClasses}); | ||
} | ||
|
||
@Test | ||
public void interproceduralOverridingAssignmentTest() { | ||
Assert.assertEquals(1, analysis.getConflicts().size()); | ||
} | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
src/test/java/br/unb/cic/analysis/ioa/ClassFieldConflictAnalysisTest2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package br.unb.cic.analysis.ioa; | ||
|
||
import br.unb.cic.analysis.AbstractMergeConflictDefinition; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import soot.G; | ||
import soot.PackManager; | ||
import soot.Transform; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Ignore | ||
public class ClassFieldConflictAnalysisTest2 { | ||
|
||
private InterproceduralOverrideAssignment analysis; | ||
|
||
@Before | ||
public void configure() { | ||
G.reset(); | ||
|
||
AbstractMergeConflictDefinition definition = new AbstractMergeConflictDefinition() { | ||
@Override | ||
protected Map<String, List<Integer>> sourceDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(7); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentClassFieldConflictInterProceduralSample2", lines); | ||
return res; | ||
} | ||
|
||
@Override | ||
protected Map<String, List<Integer>> sinkDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(8); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentClassFieldConflictInterProceduralSample2", lines); | ||
return res; | ||
} | ||
}; | ||
|
||
analysis = new InterproceduralOverrideAssignment(definition); | ||
|
||
PackManager.v().getPack("wjtp").add(new Transform("wjtp.analysis", analysis)); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "on"); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "verbose:true"); | ||
// PhaseOptions.v().setPhaseOption("jb", "use-original-names:true"); | ||
|
||
String testClasses = "target/test-classes/"; | ||
soot.Main.main(new String[]{"-w", "-allow-phantom-refs", "-f", "J", "-keep-line-number", "-process-dir", testClasses}); | ||
} | ||
|
||
@Test | ||
public void interproceduralOverridingAssignmentTest() { | ||
Assert.assertEquals(1, analysis.getConflicts().size()); | ||
} | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
src/test/java/br/unb/cic/analysis/ioa/ClassFieldNotConflictAnalysisTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package br.unb.cic.analysis.ioa; | ||
|
||
import br.unb.cic.analysis.AbstractMergeConflictDefinition; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import soot.G; | ||
import soot.PackManager; | ||
import soot.Transform; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Ignore | ||
public class ClassFieldNotConflictAnalysisTest { | ||
|
||
private InterproceduralOverrideAssignment analysis; | ||
|
||
@Before | ||
public void configure() { | ||
G.reset(); | ||
|
||
AbstractMergeConflictDefinition definition = new AbstractMergeConflictDefinition() { | ||
@Override | ||
protected Map<String, List<Integer>> sourceDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(8); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentClassFieldNotConflictInterProceduralSample", lines); | ||
return res; | ||
} | ||
|
||
@Override | ||
protected Map<String, List<Integer>> sinkDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(10); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentClassFieldNotConflictInterProceduralSample", lines); | ||
return res; | ||
} | ||
}; | ||
|
||
analysis = new InterproceduralOverrideAssignment(definition); | ||
|
||
PackManager.v().getPack("wjtp").add(new Transform("wjtp.analysis", analysis)); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "on"); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "verbose:true"); | ||
// PhaseOptions.v().setPhaseOption("jb", "use-original-names:true"); | ||
|
||
String testClasses = "target/test-classes/"; | ||
soot.Main.main(new String[]{"-w", "-allow-phantom-refs", "-f", "J", "-keep-line-number", "-process-dir", testClasses}); | ||
} | ||
|
||
@Test | ||
public void interproceduralOverridingAssignmentTest() { | ||
Assert.assertEquals(0, analysis.getConflicts().size()); | ||
} | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
src/test/java/br/unb/cic/analysis/ioa/ClassFieldNotConflictAnalysisTest2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package br.unb.cic.analysis.ioa; | ||
|
||
import br.unb.cic.analysis.AbstractMergeConflictDefinition; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import soot.G; | ||
import soot.PackManager; | ||
import soot.Transform; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Ignore | ||
public class ClassFieldNotConflictAnalysisTest2 { | ||
|
||
private InterproceduralOverrideAssignment analysis; | ||
|
||
@Before | ||
public void configure() { | ||
G.reset(); | ||
|
||
AbstractMergeConflictDefinition definition = new AbstractMergeConflictDefinition() { | ||
@Override | ||
protected Map<String, List<Integer>> sourceDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(8); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentClassFieldNotConflictInterProceduralSample2", lines); | ||
return res; | ||
} | ||
|
||
@Override | ||
protected Map<String, List<Integer>> sinkDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(10); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentClassFieldNotConflictInterProceduralSample2", lines); | ||
return res; | ||
} | ||
}; | ||
|
||
analysis = new InterproceduralOverrideAssignment(definition); | ||
|
||
PackManager.v().getPack("wjtp").add(new Transform("wjtp.analysis", analysis)); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "on"); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "verbose:true"); | ||
// PhaseOptions.v().setPhaseOption("jb", "use-original-names:true"); | ||
|
||
String testClasses = "target/test-classes/"; | ||
soot.Main.main(new String[]{"-w", "-allow-phantom-refs", "-f", "J", "-keep-line-number", "-process-dir", testClasses}); | ||
} | ||
|
||
@Test | ||
public void interproceduralOverridingAssignmentTest() { | ||
Assert.assertEquals(0, analysis.getConflicts().size()); | ||
} | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
src/test/java/br/unb/cic/analysis/ioa/ClassFieldWithParameterNotConflictAnalysisTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package br.unb.cic.analysis.ioa; | ||
|
||
import br.unb.cic.analysis.AbstractMergeConflictDefinition; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import soot.G; | ||
import soot.PackManager; | ||
import soot.Transform; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Ignore | ||
public class ClassFieldWithParameterNotConflictAnalysisTest { | ||
|
||
private InterproceduralOverrideAssignment analysis; | ||
|
||
@Before | ||
public void configure() { | ||
G.reset(); | ||
|
||
AbstractMergeConflictDefinition definition = new AbstractMergeConflictDefinition() { | ||
@Override | ||
protected Map<String, List<Integer>> sourceDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(8); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentClassFieldWithParameterNotConflictInterProceduralSample", lines); | ||
return res; | ||
} | ||
|
||
@Override | ||
protected Map<String, List<Integer>> sinkDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(9); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentClassFieldWithParameterNotConflictInterProceduralSample", lines); | ||
return res; | ||
} | ||
}; | ||
|
||
analysis = new InterproceduralOverrideAssignment(definition); | ||
|
||
PackManager.v().getPack("wjtp").add(new Transform("wjtp.analysis", analysis)); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "on"); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "verbose:true"); | ||
// PhaseOptions.v().setPhaseOption("jb", "use-original-names:true"); | ||
|
||
String testClasses = "target/test-classes/"; | ||
soot.Main.main(new String[]{"-w", "-allow-phantom-refs", "-f", "J", "-keep-line-number", "-process-dir", testClasses}); | ||
} | ||
|
||
@Test | ||
public void interproceduralOverridingAssignmentTest() { | ||
Assert.assertEquals(0, analysis.getConflicts().size()); | ||
} | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
src/test/java/br/unb/cic/analysis/ioa/LocalVariablesNotConflictAnalysisTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package br.unb.cic.analysis.ioa; | ||
|
||
import br.unb.cic.analysis.AbstractMergeConflictDefinition; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import soot.G; | ||
import soot.PackManager; | ||
import soot.Transform; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Ignore | ||
public class LocalVariablesNotConflictAnalysisTest { | ||
|
||
private InterproceduralOverrideAssignment analysis; | ||
|
||
@Before | ||
public void configure() { | ||
G.reset(); | ||
|
||
AbstractMergeConflictDefinition definition = new AbstractMergeConflictDefinition() { | ||
@Override | ||
protected Map<String, List<Integer>> sourceDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(6); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentLocalVariablesNotConflictInterProceduralSample", lines); | ||
return res; | ||
} | ||
|
||
@Override | ||
protected Map<String, List<Integer>> sinkDefinitions() { | ||
Map<String, List<Integer>> res = new HashMap<>(); | ||
List<Integer> lines = new ArrayList<>(); | ||
lines.add(7); | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentLocalVariablesNotConflictInterProceduralSample", lines); | ||
return res; | ||
} | ||
}; | ||
|
||
analysis = new InterproceduralOverrideAssignment(definition); | ||
|
||
PackManager.v().getPack("wjtp").add(new Transform("wjtp.analysis", analysis)); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "on"); | ||
soot.options.Options.v().setPhaseOption("cg.spark", "verbose:true"); | ||
// PhaseOptions.v().setPhaseOption("jb", "use-original-names:true"); | ||
|
||
String testClasses = "target/test-classes/"; | ||
soot.Main.main(new String[]{"-w", "-allow-phantom-refs", "-f", "J", "-keep-line-number", "-process-dir", testClasses}); | ||
} | ||
|
||
@Test | ||
public void interproceduralOverridingAssignmentTest() { | ||
Assert.assertEquals(0, analysis.getConflicts().size()); | ||
} | ||
|
||
} |
Oops, something went wrong.