Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
4048902442 |
@@ -1,9 +0,0 @@
|
||||
import java.util.Vector;
|
||||
import java.util.Collection;
|
||||
|
||||
class AddEle {
|
||||
addEle(x, y) {
|
||||
x.add(y);
|
||||
return x;
|
||||
}
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
import java.lang.Double;
|
||||
import java.lang.Integer;
|
||||
|
||||
public class Fac {
|
||||
|
||||
getFac(n){
|
||||
var res = 1;
|
||||
var i = 1;
|
||||
while(i<=n) {
|
||||
res = res * i;
|
||||
i++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.Float;
|
||||
|
||||
public class Faculty {
|
||||
public Fun1$$<Integer, Integer> fact = (x) -> {
|
||||
if (x == 1) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return x * (fact.apply(x-1));
|
||||
}
|
||||
};
|
||||
|
||||
public getFact(x) {
|
||||
return fact.apply(x);
|
||||
}
|
||||
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.Float;
|
||||
|
||||
public class FacultyBug {
|
||||
public Fun1$$<Float, Float> fact = (x) -> {
|
||||
if (x == 1) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return x * (fact.apply(x-1));
|
||||
}
|
||||
};
|
||||
|
||||
public getFact(x) {
|
||||
return fact.apply(x);
|
||||
}
|
||||
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
class Id {
|
||||
id2 = x -> x;
|
||||
|
||||
id(x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
id3(x) {
|
||||
return id(x);
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
public class Lambda {
|
||||
|
||||
m () {
|
||||
var lam1 = (x) -> {
|
||||
return x * x;
|
||||
};
|
||||
return lam1;
|
||||
}
|
||||
}
|
@@ -1,105 +0,0 @@
|
||||
import java.lang.String ;
|
||||
import java.lang.System;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.Character;
|
||||
import java.lang.Object;
|
||||
import java.lang.Integer;
|
||||
import fst;
|
||||
import Id;
|
||||
import OLMain;
|
||||
import Fac;
|
||||
import Faculty;
|
||||
import applyLambda;
|
||||
import java.util.Vector;
|
||||
import Matrix;
|
||||
|
||||
public class Main {
|
||||
public static main(x) {
|
||||
/*
|
||||
new fst().main(5);
|
||||
System.out.println(new fst().main(5));
|
||||
|
||||
//Id.jav: the identity-function
|
||||
//applied to an integer
|
||||
System.out.println(new Id().id(1));
|
||||
//applied to a string
|
||||
System.out.println(new Id().id("hallo"));
|
||||
//lamda-Expr
|
||||
//System.out.println(new Id().id2.apply(1));
|
||||
//Bug: https://gitea.hb.dhbw-stuttgart.de/JavaTX/JavaCompilerCore/issues/378
|
||||
|
||||
//OL.jav: Overloading
|
||||
OLMain ol = new OLMain();
|
||||
|
||||
//the function main is applied to an integer
|
||||
System.out.println(ol.main(2));
|
||||
//the main is applied to a double
|
||||
System.out.println(ol.main(2.0));
|
||||
System.out.println(ol.main("Hallo"));
|
||||
//Fac.jav
|
||||
System.out.println(new Fac().getFac(6));
|
||||
|
||||
|
||||
//Faculty.jav
|
||||
//System.out.println(new Faculty().fact.apply(6));
|
||||
//Bug: https://gitea.hb.dhbw-stuttgart.de/JavaTX/JavaCompilerCore/issues/378
|
||||
System.out.println(new Faculty().getFact(3));
|
||||
|
||||
//Lambda.jav: An lambda expression applied by the method apply
|
||||
//System.out.println(new Lambda().m().apply(77));
|
||||
//Bug: https://gitea.hb.dhbw-stuttgart.de/JavaTX/JavaCompilerCore/issues/378
|
||||
|
||||
//applyLambda.jav: A defined lambda expression is applied
|
||||
System.out.println(new applyLambda().m());
|
||||
*/
|
||||
Vector<Vector<Integer>> vv = new Vector<Vector<Integer>>();
|
||||
Vector<Integer> v1 = new Vector<Integer> ();
|
||||
v1.addElement(2);
|
||||
v1.addElement(2);
|
||||
Vector<Integer> v2 = new Vector<Integer> ();
|
||||
v2.addElement(3);
|
||||
v2.addElement(3);
|
||||
Matrix m1 = new Matrix();
|
||||
m1.addElement(v1);
|
||||
m1.addElement(v2);
|
||||
//vv.addElement(v1);
|
||||
//vv.addElement(v2);
|
||||
//Matrix m1 = new Matrix(vv);
|
||||
|
||||
Vector<Vector<Integer>> vv1 = new Vector<Vector<Integer>>();
|
||||
Vector<Integer> v3 = new Vector<Integer> ();
|
||||
v3.addElement(2);
|
||||
v3.addElement(2);
|
||||
Vector<Integer> v4 = new Vector<Integer> ();
|
||||
v4.addElement(3);
|
||||
v4.addElement(3);
|
||||
Matrix m2 = new Matrix();
|
||||
m2.addElement(v3);
|
||||
m2.addElement(v4);
|
||||
//vv1.addElement(v3);
|
||||
//vv1.addElement(v4);
|
||||
//Matrix m2 = new Matrix(vv1);
|
||||
|
||||
|
||||
//Matrix m3 = m1.mul(vv1);
|
||||
Matrix m3 = m1.mul(m2);
|
||||
System.out.println(m1.toString() + " * " + m2.toString() + " = " + m3.toString());
|
||||
/*
|
||||
//MatrixOP
|
||||
MatrixOP mOp1 = new MatrixOP();
|
||||
mOp1.addElement(v1);
|
||||
mOp1.addElement(v2);
|
||||
MatrixOP mOp2 = mOp1.mul.apply(mOp1, mOp1);
|
||||
System.out.println(m1.toString() + " * " + m2.toString() + " = " + mOp2.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public class MainBug {
|
||||
public static main(x) {
|
||||
System.out.println(new fst().main(5));
|
||||
//System.out.println(new FacultyBug().getFact(3));
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
import java.util.Vector;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Boolean;
|
||||
|
||||
public class Matrix extends Vector<Vector<Integer>> {
|
||||
|
||||
|
||||
public Matrix () {
|
||||
}
|
||||
|
||||
public Matrix(vv) {
|
||||
var i = 0;
|
||||
while(i < vv.size()) {
|
||||
this.add(vv.elementAt(i));
|
||||
i=i+1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mul(m) {
|
||||
var ret = new Matrix();
|
||||
var i = 0;
|
||||
while(i < size()) {
|
||||
var v1 = this.elementAt(i);
|
||||
var v2 = new Vector<Integer>();
|
||||
var j = 0;
|
||||
while(j < v1.size()) {
|
||||
var erg = 0;
|
||||
var k = 0;
|
||||
while(k < v1.size()) {
|
||||
erg = erg + v1.elementAt(k)
|
||||
* m.elementAt(k).elementAt(j);
|
||||
k++; }
|
||||
v2.addElement(erg);
|
||||
j++; }
|
||||
ret.addElement(v2);
|
||||
i++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
import java.util.Vector;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Byte;
|
||||
import java.lang.Boolean;
|
||||
|
||||
public class MatrixOP extends Vector<Vector<Integer>> {
|
||||
|
||||
MatrixOP () {
|
||||
}
|
||||
|
||||
MatrixOP(vv) {
|
||||
Integer i;
|
||||
i = 0;
|
||||
while(i < vv.size()) {
|
||||
this.add(vv.elementAt(i));
|
||||
i=i+1;
|
||||
}
|
||||
}
|
||||
|
||||
Fun2$$<Vector<? extends Vector<? extends Integer>>, Vector<? extends Vector<? extends Integer>>, MatrixOP> mul = (m1, m2) -> {
|
||||
var ret = new MatrixOP();
|
||||
var i = 0;
|
||||
while(i < m1.size()) {
|
||||
var v1 = m1.elementAt(i);
|
||||
var v2 = new Vector<Integer>();
|
||||
var j = 0;
|
||||
while(j < v1.size()) {
|
||||
var erg = 0;
|
||||
var k = 0;
|
||||
while(k < v1.size()) {
|
||||
erg = erg + v1.elementAt(k)
|
||||
* m2.elementAt(k).elementAt(j);
|
||||
k++; }
|
||||
// v2.addElement(new Integer(erg));
|
||||
v2.addElement(erg);
|
||||
j++; }
|
||||
ret.addElement(v2);
|
||||
i++;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
@@ -1,30 +0,0 @@
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Double;
|
||||
import java.lang.Boolean;
|
||||
import java.lang.Object;
|
||||
|
||||
|
||||
|
||||
|
||||
class OL {
|
||||
|
||||
m(x) { return x + x; }
|
||||
|
||||
|
||||
m(x) { return x || x; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class OLMain {
|
||||
|
||||
main(x) {
|
||||
var ol;
|
||||
ol = new OL();
|
||||
return ol.m(x);
|
||||
}
|
||||
}
|
||||
|
@@ -1,20 +0,0 @@
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Double;
|
||||
import java.util.Vector;
|
||||
import java.lang.Boolean;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class OLFun {
|
||||
x;
|
||||
|
||||
|
||||
m(f, y) {
|
||||
y = f.apply(x+x);
|
||||
return x;
|
||||
}
|
||||
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
class Pair {
|
||||
fst;
|
||||
snd;
|
||||
|
||||
Pair(fst, snd) { this.fst=fst; this.snd=snd; }
|
||||
|
||||
getfst() { return this.fst; }
|
||||
|
||||
swap() {
|
||||
return new Pair<>(this.snd, this.fst);
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.String;
|
||||
|
||||
public class Plus {
|
||||
|
||||
m(a, b) {
|
||||
return a+b;
|
||||
}
|
||||
}
|
@@ -1,25 +0,0 @@
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.lang.String;
|
||||
|
||||
public class Sorting{
|
||||
merge(a, b){
|
||||
a.addAll(b);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
sort(in){
|
||||
var firstHalf = in;
|
||||
var secondHalf = in;
|
||||
return merge(sort(firstHalf), sort(secondHalf));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void sort(a){
|
||||
a = merge(a,a);
|
||||
}
|
||||
*/
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
import java.lang.String;
|
||||
import java.lang.Object;
|
||||
import java.lang.System;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.Character;
|
||||
|
||||
public class Swap{
|
||||
<ZDP, ZEA, ZDO, YZP, ZCY, ZDZ> Fun1$$<ZCY, Fun1$$<ZDZ, ZEA>> swap(f){
|
||||
return x->y->f.apply(y).apply(x);
|
||||
}
|
||||
|
||||
Fun1$$<String, Fun1$$<String, Fun1$$<String, String>>> swap(f){
|
||||
return x -> y -> z -> f.apply(z).apply(x).apply(y);
|
||||
}
|
||||
|
||||
public static main (y) {
|
||||
var func = x -> y -> z -> x + y + z;
|
||||
var res = new Swap().swap(func).apply("A").apply("B").apply("C");
|
||||
System.out.println(res);}
|
||||
}
|
@@ -1,6 +0,0 @@
|
||||
class TPHMethod {
|
||||
void m(a, b) {
|
||||
a = b;
|
||||
b=a;
|
||||
}
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
class Test{
|
||||
void m( op, a, b ){
|
||||
op.myapply(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
class Atype{}
|
||||
class Btype{}
|
||||
|
||||
class Operator1{
|
||||
void myapply(Atype p1, Atype p2){...}
|
||||
}
|
||||
|
||||
class Operator2{
|
||||
void myapply(Btype p1, Btype p2){...}
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
public class Uncurrier{
|
||||
uncurry (f){
|
||||
return x -> f.apply(x);}
|
||||
uncurry (f){
|
||||
return (x, y) -> f.apply(x).apply(y);
|
||||
}
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
import Uncurrier;
|
||||
|
||||
class UncurrierMain {
|
||||
public static main(x) {
|
||||
var uc = new Uncurrier() ;
|
||||
}
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.String;
|
||||
import java.util.Vector;
|
||||
|
||||
class VectorAdd {
|
||||
vectorAdd(v1, v2) {
|
||||
var i = 0;
|
||||
var erg = new Vector<>();
|
||||
while (i < v1.size()) {
|
||||
erg.addElement(v1.elementAt(i) + v2.elementAt(i));
|
||||
i++;
|
||||
}
|
||||
return erg;
|
||||
}
|
||||
}
|
||||
|
@@ -1,16 +0,0 @@
|
||||
import java.util.Vector;
|
||||
class Apply { }
|
||||
|
||||
public class applyLambda {
|
||||
|
||||
public m () {
|
||||
var lam1 = (x) -> {
|
||||
return x;
|
||||
};
|
||||
|
||||
return lam1.apply(new Apply());
|
||||
//return lam1;
|
||||
//return new Vector();
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +0,0 @@
|
||||
//import java.lang.Integer;
|
||||
|
||||
class fst {
|
||||
main(x) {
|
||||
return x;
|
||||
}
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class genVector {
|
||||
|
||||
m(v) {
|
||||
return v.elementAt(0);
|
||||
}
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
import java.lang.Integer;
|
||||
import Id;
|
||||
|
||||
class Test {
|
||||
m() {
|
||||
Integer o1 = new Id<Integer,Integer>().id2.apply(1);
|
||||
}
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
public class lambdaId {
|
||||
lambdaId = x -> x;
|
||||
|
||||
/*
|
||||
id3 (x) {
|
||||
return lambdaId.apply(x);
|
||||
}
|
||||
*/
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
class mathStruc {
|
||||
model;
|
||||
|
||||
innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(model,ms.model));
|
||||
|
||||
mathStruc(m) {
|
||||
model =m;
|
||||
}
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
class mathStruc {
|
||||
model;
|
||||
|
||||
innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(model,ms.model));
|
||||
|
||||
mathStruc(m) {
|
||||
model =m;
|
||||
}
|
||||
}
|
||||
|
||||
class mathStrucIntegerUse {
|
||||
main() {
|
||||
var ms = new mathStruc<>(2);
|
||||
return ms.innerOp.apply((x,y) -> x+y).apply(ms);
|
||||
}
|
||||
}
|
@@ -1,90 +0,0 @@
|
||||
import java.util.Vector;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Boolean;
|
||||
|
||||
public class mathStrucMatrixOP {
|
||||
model;
|
||||
|
||||
innerOp = (o) -> (ms) -> new mathStrucMatrixOP<>(o.apply(model,ms.model));
|
||||
|
||||
public mathStrucMatrixOP(m) {
|
||||
model =m;
|
||||
}
|
||||
}
|
||||
|
||||
public class MatrixOP extends Vector<Vector<Integer>> {
|
||||
|
||||
MatrixOP () {
|
||||
}
|
||||
|
||||
MatrixOP(vv) {
|
||||
Integer i;
|
||||
i = 0;
|
||||
while(i < vv.size()) {
|
||||
// Boolean a = this.add(vv.elementAt(i));
|
||||
this.add(vv.elementAt(i));
|
||||
i=i+1;
|
||||
}
|
||||
}
|
||||
|
||||
public mul = (m1, m2) -> {
|
||||
var ret = new MatrixOP();
|
||||
var i = 0;
|
||||
while(i < m1.size()) {
|
||||
var v1 = m1.elementAt(i);
|
||||
var v2 = new Vector<Integer>();
|
||||
var j = 0;
|
||||
while(j < v1.size()) {
|
||||
var erg = 0;
|
||||
var k = 0;
|
||||
while(k < v1.size()) {
|
||||
erg = erg + v1.elementAt(k)
|
||||
* m2.elementAt(k).elementAt(j);
|
||||
k++; }
|
||||
// v2.addElement(new Integer(erg));
|
||||
v2.addElement(erg);
|
||||
j++; }
|
||||
ret.addElement(v2);
|
||||
i++;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class mathStrucUseMatrixOP {
|
||||
|
||||
main() {
|
||||
Vector<Vector<Integer>> vv = new Vector<Vector<Integer>>();
|
||||
Vector<Integer> v1 = new Vector<Integer>();
|
||||
v1.addElement(2);
|
||||
v1.addElement(2);
|
||||
Vector<Integer> v2 = new Vector<Integer>();
|
||||
v2.addElement(3);
|
||||
v2.addElement(3);
|
||||
vv.addElement(v1);
|
||||
vv.addElement(v2);
|
||||
|
||||
MatrixOP m1 = new MatrixOP(vv);
|
||||
|
||||
Vector<Vector<Integer>> vv1 = new Vector<Vector<Integer>>();
|
||||
Vector<Integer> v3 = new Vector<Integer>();
|
||||
v3.addElement(2);
|
||||
v3.addElement(2);
|
||||
Vector<Integer> v4 = new Vector<Integer>();
|
||||
v4.addElement(3);
|
||||
v4.addElement(3);
|
||||
vv1.addElement(v3);
|
||||
vv1.addElement(v4);
|
||||
|
||||
MatrixOP m2 = new MatrixOP(vv1);
|
||||
|
||||
var mms;
|
||||
mms = new mathStrucMatrixOP<>(m1);
|
||||
var mms2;
|
||||
mms2 = new mathStrucMatrixOP<>(m2);
|
||||
var mms3;
|
||||
mms3 = mms.innerOp.apply(m1.mul).apply(mms2);
|
||||
return mms3;
|
||||
}
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
import java.lang.String;
|
||||
import java.lang.Boolean;
|
||||
import java.lang.Integer;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class testclass{
|
||||
|
||||
public testMethod(ele){
|
||||
if(ele){
|
||||
return 1;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
3
resources/bytecode/javFiles/Bug378Id.jav
Normal file
3
resources/bytecode/javFiles/Bug378Id.jav
Normal file
@@ -0,0 +1,3 @@
|
||||
class Bug378Id {
|
||||
id2 = x -> x;
|
||||
}
|
8
resources/bytecode/javFiles/Bug378Main.jav
Normal file
8
resources/bytecode/javFiles/Bug378Main.jav
Normal file
@@ -0,0 +1,8 @@
|
||||
import Bug378Id;
|
||||
import java.lang.Integer;
|
||||
|
||||
class Bug378Main {
|
||||
static main(args) {
|
||||
var hallo = (new Bug378Id<Integer>().id2).apply(1);
|
||||
}
|
||||
}
|
@@ -2,7 +2,6 @@ import java.util.Vector;
|
||||
import java.lang.Integer;
|
||||
//import java.lang.Byte;
|
||||
import java.lang.Boolean;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class MatrixOP extends Vector<Vector<Integer>> {
|
||||
|
||||
|
@@ -161,7 +161,6 @@ public class StatementToTargetExpression implements ASTVisitor {
|
||||
|
||||
@Override
|
||||
public void visit(FieldVar fieldVar) {
|
||||
var isStatic = false;
|
||||
var type = converter.convert(fieldVar.receiver.getType());
|
||||
var clazz = converter.compiler.getClass(new JavaClassName(type.name()));
|
||||
var field = clazz.getField(fieldVar.fieldVarName).orElseThrow();
|
||||
|
@@ -33,4 +33,10 @@ public record TargetFunNType(String name, List<TargetType> funNParams, List<Targ
|
||||
public String getInternalName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toSignature() {
|
||||
var args = FunNGenerator.getArguments(params);
|
||||
return "LFun" + args.size() + "$$" + TargetSpecializedType.signatureParameters(params) + ";";
|
||||
}
|
||||
}
|
||||
|
@@ -8,14 +8,20 @@ public sealed interface TargetSpecializedType extends TargetType permits TargetF
|
||||
@Override
|
||||
default String toSignature() {
|
||||
String ret = "L" + getInternalName();
|
||||
if (!params().isEmpty()) {
|
||||
ret += signatureParameters(params());
|
||||
ret += ";";
|
||||
return ret;
|
||||
}
|
||||
|
||||
static String signatureParameters(List<TargetType> params) {
|
||||
var ret = "";
|
||||
if (!params.isEmpty()) {
|
||||
ret += "<";
|
||||
for (var param : params()) {
|
||||
for (var param : params) {
|
||||
ret += param.toSignature();
|
||||
}
|
||||
ret += ">";
|
||||
}
|
||||
ret += ";";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -63,13 +63,11 @@ public class AllgemeinTest {
|
||||
//String className = "Cycle";
|
||||
//String className = "TripleTest";
|
||||
//String className = "WildcardList";
|
||||
//String className = "List";
|
||||
String className = "List";
|
||||
//String className = "Box";
|
||||
//String className = "GenBox";
|
||||
//String className = "InnerInf";
|
||||
//String className = "Foo";
|
||||
//String className = "Uncurrier";
|
||||
String className = "UncurrierMain";
|
||||
//PL 2019-10-24: genutzt fuer unterschiedliche Tests
|
||||
path = System.getProperty("user.dir")+"/resources/AllgemeinTest/" + className + ".jav";
|
||||
//path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav";
|
||||
|
@@ -1,97 +0,0 @@
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static targetast.TestCodegen.generateClassFiles;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||
|
||||
public class KPSPresentation {
|
||||
|
||||
private static String path;
|
||||
private static File fileToTest;
|
||||
private static JavaTXCompiler compiler;
|
||||
private static ClassLoader loader;
|
||||
private static Class<?> classToTest;
|
||||
private static String pathToClassFile;
|
||||
private static Object instanceOfClass;
|
||||
|
||||
|
||||
public void testAlgo(String className) throws Exception {
|
||||
//PL 2019-10-24: genutzt fuer unterschiedliche Tests
|
||||
path = System.getProperty("user.dir")+"/resources/KPSPresentation/" + className + ".jav";
|
||||
//path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav";
|
||||
//path = System.getProperty("user.dir")+"/src/test/resources/bytecode/javFiles/mathStrucInteger.jav";
|
||||
//compiler = new JavaTXCompiler(Lists.newArrayList(new File(System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav")));
|
||||
///*
|
||||
compiler = new JavaTXCompiler(
|
||||
Lists.newArrayList(new File(path)),
|
||||
Lists.newArrayList(new File(System.getProperty("user.dir")+"/resources/KPSPresentation/classFiles/")),
|
||||
new File(System.getProperty("user.dir")+"/resources/KPSPresentation/classFiles/"));
|
||||
//*/
|
||||
compiler.generateBytecode();
|
||||
pathToClassFile = System.getProperty("user.dir")+"/resources/KPSPresentation/classFiles/";
|
||||
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
||||
classToTest = loader.loadClass(className);
|
||||
//classToTest = loader.loadClass("Overloading_Generics");
|
||||
//instanceOfClass = classToTest.getDeclaredConstructor().newInstance("A");
|
||||
//classToTest = loader.loadClass("Overloading_Generics1");
|
||||
//instanceOfClass = classToTest.getDeclaredConstructor(Object.class).newInstance("B");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MainTest() throws Exception {
|
||||
testAlgo("Main");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fstTest() throws Exception {
|
||||
testAlgo("fst");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IdTest() throws Exception {
|
||||
testAlgo("Id");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void OLTest() throws Exception {
|
||||
testAlgo("OL");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void FacTest() throws Exception {
|
||||
testAlgo("Fac");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void FacultyTest() throws Exception {
|
||||
testAlgo("Faculty");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Lambda() throws Exception {
|
||||
testAlgo("Lambda");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void applyLambda() throws Exception {
|
||||
testAlgo("applyLambda");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Matrix() throws Exception {
|
||||
testAlgo("Matrix");
|
||||
}
|
||||
|
||||
}
|
@@ -1476,4 +1476,14 @@ public class TestComplete {
|
||||
var m = clazz.getDeclaredMethod("main");
|
||||
m.invoke(null);
|
||||
}
|
||||
|
||||
@Disabled("Doesn't work yet")
|
||||
@Test
|
||||
public void testBug378() throws Exception {
|
||||
var classFiles = generateClassFiles(createClassLoader(), "Bug378Main.jav");
|
||||
var clazz = classFiles.get("Bug378Main");
|
||||
var main = clazz.getDeclaredMethod("main", List.class);
|
||||
main.setAccessible(true);
|
||||
main.invoke(null, List.of());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user