use of de.dagere.peass.dependency.analysis.data.TraceElement in project peass by DaGeRe.
the class TestSequiturSerialization method testDeepRepetition3.
@Test
public void testDeepRepetition3() throws ParseException, IOException {
final List<TraceElement> calls = new LinkedList<>();
for (int j = 0; j < 3; j++) {
for (int i = 0; i < 5; i++) {
calls.add(new TraceElement("CalleeSimpleFor", "methodA", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
for (int k = 0; k < 5; k++) {
calls.add(new TraceElement("CalleeSimpleFor", "method1", 0));
calls.add(new TraceElement("CalleeSimpleFor", "method2", 0));
}
calls.add(new TraceElement("CalleeSimpleFor", "methodG", 0));
}
calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodD", 0));
}
calls.add(new TraceElement("CalleeSimpleFor", "methodE", 0));
final TraceMethodReader reader = new TraceMethodReader(calls, new File("src/test/java/"));
final TraceWithMethods trace = reader.getTraceWithMethods();
testTrace(calls, trace);
}
use of de.dagere.peass.dependency.analysis.data.TraceElement in project peass by DaGeRe.
the class TestTraceElementContent method testEquality.
@Test
public void testEquality() {
TraceElement element = new TraceElement("Clazz", "method", 1);
element.setParameterTypes(new String[] { "String" });
TraceElementContent content1 = new TraceElementContent(element);
TraceElement element2 = new TraceElement("Clazz", "method", 1);
element2.setParameterTypes(new String[] { "String[]" });
TraceElementContent content2 = new TraceElementContent(element2);
Assert.assertFalse(content1.equals(content2));
}
use of de.dagere.peass.dependency.analysis.data.TraceElement in project peass by DaGeRe.
the class TestTraceMinimization method testSimple4NestedLoop.
@Test
public void testSimple4NestedLoop() throws ParseException, IOException {
final List<TraceElement> calls = new LinkedList<>();
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
calls.add(new TraceElement("CalleeSimpleFor", "methodA", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodD", 0));
}
calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
}
final TraceMethodReader reader = new TraceMethodReader(calls, new File("src/test/java/"));
final TraceWithMethods trace = reader.getTraceWithMethods();
System.out.println("trace");
System.out.println(trace);
Assert.assertEquals(" (6)", trace.getTraceElement(0).toString());
Assert.assertEquals(3, trace.getTraceOccurences(0));
Assert.assertEquals(" (4)", trace.getTraceElement(1).toString());
Assert.assertEquals(3, trace.getTraceOccurences(1));
Assert.assertEquals("CalleeSimpleFor#methodA", trace.getTraceElement(2).toString());
Assert.assertEquals("CalleeSimpleFor#methodB", trace.getTraceElement(3).toString());
Assert.assertEquals("CalleeSimpleFor#methodC", trace.getTraceElement(4).toString());
Assert.assertEquals("CalleeSimpleFor#methodD", trace.getTraceElement(5).toString());
Assert.assertEquals("CalleeSimpleFor#methodC", trace.getTraceElement(6).toString());
}
use of de.dagere.peass.dependency.analysis.data.TraceElement in project peass by DaGeRe.
the class TestTraceMinimization method testTwoMethodLoop.
@Test
public void testTwoMethodLoop() throws ParseException, IOException {
final List<TraceElement> calls = new LinkedList<>();
calls.add(new TraceElement("CalleeSimpleFor", "methodA", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
final TraceMethodReader reader = new TraceMethodReader(calls, new File("src/test/java/"));
final TraceWithMethods trace = reader.getTraceWithMethods();
System.out.println();
System.out.println("Trace");
System.out.println(trace);
Assert.assertEquals("CalleeSimpleFor#methodA", trace.getTraceElement(0).toString());
Assert.assertEquals(" (2)", trace.getTraceElement(1).toString());
// Assert.assertEquals("#0 (2)", trace.getTraceElement(1).toString());
Assert.assertEquals("CalleeSimpleFor#methodB", trace.getTraceElement(2).toString());
Assert.assertEquals("CalleeSimpleFor#methodC", trace.getTraceElement(3).toString());
// Assert.assertEquals("methodB", trace.getTraceElement(1).getMethod());
// Assert.assertEquals("methodC", trace.getTraceElement(2).getMethod());
Assert.assertEquals(3, trace.getTraceOccurences(1));
}
use of de.dagere.peass.dependency.analysis.data.TraceElement in project peass by DaGeRe.
the class TestTraceMinimization method testSimple2NestedLoop.
@Test
public void testSimple2NestedLoop() throws ParseException, IOException {
final List<TraceElement> calls = new LinkedList<>();
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
calls.add(new TraceElement("CalleeSimpleFor", "methodA", 0));
calls.add(new TraceElement("CalleeSimpleFor", "methodB", 0));
}
calls.add(new TraceElement("CalleeSimpleFor", "methodC", 0));
}
calls.add(new TraceElement("CalleeSimpleFor", "methodD", 0));
final TraceMethodReader reader = new TraceMethodReader(calls, new File("src/test/java/"));
final TraceWithMethods trace = reader.getTraceWithMethods();
System.out.println();
System.out.println("Trace");
System.out.println(trace);
Assert.assertEquals(" (4)", trace.getTraceElement(0).toString());
Assert.assertEquals(3, trace.getTraceOccurences(0));
Assert.assertEquals(" (2)", trace.getTraceElement(1).toString());
Assert.assertEquals(3, trace.getTraceOccurences(1));
Assert.assertEquals("CalleeSimpleFor#methodA", trace.getTraceElement(2).toString());
Assert.assertEquals("CalleeSimpleFor#methodB", trace.getTraceElement(3).toString());
Assert.assertEquals("CalleeSimpleFor#methodC", trace.getTraceElement(4).toString());
Assert.assertEquals("CalleeSimpleFor#methodD", trace.getTraceElement(5).toString());
}
Aggregations