Skip to content

Commit

Permalink
test(spgroup#31): add use-original-names Soot options and add new tes…
Browse files Browse the repository at this point in the history
…t cases
  • Loading branch information
barbosamaatheus committed Feb 3, 2021
1 parent 4978a70 commit e800134
Showing 1 changed file with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ private void configureTest(InterproceduralOverrideAssignment analysis) {
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");
soot.options.Options.v().setPhaseOption("jb", "use-original-names: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});
Expand Down Expand Up @@ -69,10 +70,13 @@ public void classFieldNotConflict2() {
public void classFieldWithParameterNotConflict() {
String sampleClassPath = "br.unb.cic.analysis.samples.OverridingAssignmentClassFieldWithParameterNotConflictInterProceduralSample";
AbstractMergeConflictDefinition definition = DefinitionFactory
.definition(sampleClassPath, new int[]{8}, new int[]{9});
.definition(sampleClassPath, new int[]{9}, new int[]{10});
InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition);
configureTest(analysis);
Assert.assertEquals(0, analysis.getConflicts().size());

// Not Conflict - Not implemented yet. You will need constant propagation.
// Currently detected as conflict: [left, m():9] --> [right, foo():14]
Assert.assertEquals(1, analysis.getConflicts().size());
}

@Test
Expand Down Expand Up @@ -125,6 +129,36 @@ public void objectFieldNotConflict() {
Assert.assertEquals(0, analysis.getConflicts().size());
}

@Test
public void differentAttributeOnIdenticalClass() {
String sampleClassPath = "br.unb.cic.analysis.samples.OverridingAssignmentDifferentAttributeOnIdenticalClassNotConflictInterProceduralSample";
AbstractMergeConflictDefinition definition = DefinitionFactory
.definition(sampleClassPath, new int[]{13}, new int[]{14});
InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition);
configureTest(analysis);
Assert.assertEquals(0, analysis.getConflicts().size());
}

@Test
public void differentClassWithSameAttribute() {
String sampleClassPath = "br.unb.cic.analysis.samples.OverridingAssignmentDifferentClassWithSameAttributeNotConflictInterProceduralSample";
AbstractMergeConflictDefinition definition = DefinitionFactory
.definition(sampleClassPath, new int[]{14}, new int[]{15});
InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition);
configureTest(analysis);
Assert.assertEquals(0, analysis.getConflicts().size());
}

@Test
public void sameAttributeOnIdenticalClass() {
String sampleClassPath = "br.unb.cic.analysis.samples.OverridingAssignmentSameAttributeOnIdenticalClassConflictInterProceduralSample";
AbstractMergeConflictDefinition definition = DefinitionFactory
.definition(sampleClassPath, new int[]{13}, new int[]{14});
InterproceduralOverrideAssignment analysis = new InterproceduralOverrideAssignment(definition);
configureTest(analysis);
Assert.assertEquals(0, analysis.getConflicts().size());
}

@Test
public void concatMethodsConflict() {
String sampleClassPath = "br.unb.cic.analysis.samples.OverridingAssignmentConcatMethodsConflictInterProceduralSample";
Expand All @@ -135,7 +169,6 @@ public void concatMethodsConflict() {
Assert.assertEquals(1, analysis.getConflicts().size());
}

//@Ignore
@Test
public void ifBranchConflict() {
String sampleClassPath = "br.unb.cic.analysis.samples.OverridingAssignmentIfBranchConflictInterProceduralSample";
Expand Down

0 comments on commit e800134

Please sign in to comment.