Add Cycle Test

This commit is contained in:
JanUlrich 2020-12-18 09:12:23 +01:00
parent a4bc49f5c4
commit 5bfe2c906e
4 changed files with 19 additions and 1 deletions

View File

@ -40,7 +40,7 @@ public class AllgemeinTest {
//String className = "FCTest3";
//String className = "Var";
//String className = "Put";
String className = "Twice";
String className = "Cycle";
//PL 2019-10-24: genutzt fuer unterschiedliche Tests
path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/" + className + ".jav";
//path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav";

View File

@ -9,6 +9,7 @@ import de.dhbwstuttgart.bytecode.insertGenerics.PositionFinder;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -26,6 +27,7 @@ public class TestExample42 {
}
public HashMap<String, PositionFinder.Position> fillPosOfTphs() {
BufferedReader l;
HashMap<String, PositionFinder.Position> posOfTphs = new HashMap<>();
posOfTphs.put("K", PositionFinder.Position.FIELD);
posOfTphs.put("L", PositionFinder.Position.METHOD);

View File

@ -0,0 +1,11 @@
class Cycle{
<A> A und(A a, A b){
return a;
}
m(a){
return und(m(m(a)), a);
}
}

View File

@ -0,0 +1,5 @@
class Twice{
m(x, f){
return f.apply(f.apply(x));
}
}