-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from galilasmb/develop
Resolving old merge conflicts
- Loading branch information
Showing
7 changed files
with
270 additions
and
58 deletions.
There are no files selected for viewing
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
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
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
63 changes: 63 additions & 0 deletions
63
src/test/java/br/unb/cic/analysis/df/OverridingAssignmentAnalysisMethodCallConflictTest.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,63 @@ | ||
package br.unb.cic.analysis.df; | ||
|
||
import br.unb.cic.analysis.AbstractMergeConflictDefinition; | ||
import br.unb.cic.analysis.SootWrapper; | ||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import soot.*; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class OverridingAssignmentAnalysisMethodCallConflictTest { | ||
|
||
private OverridingAssignmentAnalysis analysis; | ||
|
||
@Before | ||
public void configure() { | ||
G.reset(); | ||
Collector.instance().clear(); | ||
|
||
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); //left | ||
lines.add(10); //left | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentMethodCallSample", 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); //right | ||
res.put("br.unb.cic.analysis.samples.OverridingAssignmentMethodCallSample", lines); | ||
return res; | ||
} | ||
}; | ||
|
||
PackManager.v().getPack("jtp").add( | ||
new Transform("jtp.oneConflict", new BodyTransformer() { | ||
@Override | ||
protected void internalTransform(Body body, String phaseName, Map<String, String> options) { | ||
analysis = new OverridingAssignmentAnalysis(body, definition); | ||
} | ||
})); | ||
String cp = "target/test-classes"; | ||
String targetClass = "br.unb.cic.analysis.samples.OverridingAssignmentMethodCallSample"; | ||
PhaseOptions.v().setPhaseOption("jb", "use-original-names:true"); | ||
|
||
SootWrapper.builder().withClassPath(cp).addClass(targetClass).build().execute(); | ||
} | ||
|
||
@Test | ||
public void testDataFlowAnalysisExpectingOneConflict() { | ||
Assert.assertEquals(1, analysis.getConflicts().size()); | ||
} | ||
} |
Oops, something went wrong.