From 48199b5d2e7938291adf55fde7a71440c3a33f3d Mon Sep 17 00:00:00 2001 From: luca9913 Date: Tue, 6 Jun 2023 21:21:26 +0200 Subject: [PATCH] Created test suite for syntaxtreegenerator including resources --- .../syntaxtreegenerator/ValidSourcesTest.java | 60 +++++++++++++++++++ .../syntaxtreegenerator/BinaryInMeth.ast | 22 +++++++ .../syntaxtreegenerator/ClassGenLam.ast | 14 +++++ .../resources/syntaxtreegenerator/Cycle.ast | 16 +++++ .../resources/syntaxtreegenerator/Fac.ast | 22 +++++++ .../resources/syntaxtreegenerator/Faculty.ast | 25 ++++++++ .../resources/syntaxtreegenerator/Field.ast | 16 +++++ .../syntaxtreegenerator/FieldTph2.ast | 21 +++++++ .../syntaxtreegenerator/FieldTphConsMeth.ast | 27 +++++++++ .../syntaxtreegenerator/FieldTphMMeth.ast | 33 ++++++++++ .../resources/syntaxtreegenerator/Gen.ast | 14 +++++ src/test/resources/syntaxtreegenerator/Id.ast | 18 ++++++ .../resources/syntaxtreegenerator/Inf.ast | 28 +++++++++ .../resources/syntaxtreegenerator/KompTph.ast | 26 ++++++++ .../resources/syntaxtreegenerator/Lambda.ast | 18 ++++++ .../syntaxtreegenerator/LambdaCapture.ast | 18 ++++++ .../resources/syntaxtreegenerator/Matrix.ast | 52 ++++++++++++++++ .../syntaxtreegenerator/MatrixOP.ast | 52 ++++++++++++++++ .../resources/syntaxtreegenerator/Merge.ast | 23 +++++++ src/test/resources/syntaxtreegenerator/OL.ast | 41 +++++++++++++ .../resources/syntaxtreegenerator/OLFun.ast | 22 +++++++ .../resources/syntaxtreegenerator/OLFun2.ast | 16 +++++ .../syntaxtreegenerator/Overloading.ast | 31 ++++++++++ .../resources/syntaxtreegenerator/Pair.ast | 20 +++++++ .../resources/syntaxtreegenerator/Plus.ast | 14 +++++ .../resources/syntaxtreegenerator/RelOps.ast | 14 +++++ .../resources/syntaxtreegenerator/Scalar.ast | 29 +++++++++ .../syntaxtreegenerator/SimpleCycle.ast | 18 ++++++ .../resources/syntaxtreegenerator/Sorting.ast | 23 +++++++ .../syntaxtreegenerator/SubMatrix.ast | 26 ++++++++ .../syntaxtreegenerator/TXGenerics.ast | 19 ++++++ .../resources/syntaxtreegenerator/Tph.ast | 20 +++++++ .../resources/syntaxtreegenerator/Tph2.ast | 18 ++++++ .../resources/syntaxtreegenerator/Tph3.ast | 21 +++++++ .../resources/syntaxtreegenerator/Tph4.ast | 22 +++++++ .../resources/syntaxtreegenerator/Tph5.ast | 19 ++++++ .../resources/syntaxtreegenerator/Tph6.ast | 21 +++++++ .../resources/syntaxtreegenerator/Tph7.ast | 20 +++++++ .../resources/syntaxtreegenerator/TypedID.ast | 22 +++++++ .../syntaxtreegenerator/VectorAdd.ast | 31 ++++++++++ .../syntaxtreegenerator/VectorSuper.ast | 17 ++++++ src/test/resources/syntaxtreegenerator/Y.ast | 16 +++++ .../syntaxtreegenerator/applyLambda.ast | 27 +++++++++ .../syntaxtreegenerator/mathStruc.ast | 19 ++++++ .../syntaxtreegenerator/mathStrucInteger.ast | 38 ++++++++++++ 45 files changed, 1089 insertions(+) create mode 100644 src/test/java/syntaxtreegenerator/ValidSourcesTest.java create mode 100644 src/test/resources/syntaxtreegenerator/BinaryInMeth.ast create mode 100644 src/test/resources/syntaxtreegenerator/ClassGenLam.ast create mode 100644 src/test/resources/syntaxtreegenerator/Cycle.ast create mode 100644 src/test/resources/syntaxtreegenerator/Fac.ast create mode 100644 src/test/resources/syntaxtreegenerator/Faculty.ast create mode 100644 src/test/resources/syntaxtreegenerator/Field.ast create mode 100644 src/test/resources/syntaxtreegenerator/FieldTph2.ast create mode 100644 src/test/resources/syntaxtreegenerator/FieldTphConsMeth.ast create mode 100644 src/test/resources/syntaxtreegenerator/FieldTphMMeth.ast create mode 100644 src/test/resources/syntaxtreegenerator/Gen.ast create mode 100644 src/test/resources/syntaxtreegenerator/Id.ast create mode 100644 src/test/resources/syntaxtreegenerator/Inf.ast create mode 100644 src/test/resources/syntaxtreegenerator/KompTph.ast create mode 100644 src/test/resources/syntaxtreegenerator/Lambda.ast create mode 100644 src/test/resources/syntaxtreegenerator/LambdaCapture.ast create mode 100644 src/test/resources/syntaxtreegenerator/Matrix.ast create mode 100644 src/test/resources/syntaxtreegenerator/MatrixOP.ast create mode 100644 src/test/resources/syntaxtreegenerator/Merge.ast create mode 100644 src/test/resources/syntaxtreegenerator/OL.ast create mode 100644 src/test/resources/syntaxtreegenerator/OLFun.ast create mode 100644 src/test/resources/syntaxtreegenerator/OLFun2.ast create mode 100644 src/test/resources/syntaxtreegenerator/Overloading.ast create mode 100644 src/test/resources/syntaxtreegenerator/Pair.ast create mode 100644 src/test/resources/syntaxtreegenerator/Plus.ast create mode 100644 src/test/resources/syntaxtreegenerator/RelOps.ast create mode 100644 src/test/resources/syntaxtreegenerator/Scalar.ast create mode 100644 src/test/resources/syntaxtreegenerator/SimpleCycle.ast create mode 100644 src/test/resources/syntaxtreegenerator/Sorting.ast create mode 100644 src/test/resources/syntaxtreegenerator/SubMatrix.ast create mode 100644 src/test/resources/syntaxtreegenerator/TXGenerics.ast create mode 100644 src/test/resources/syntaxtreegenerator/Tph.ast create mode 100644 src/test/resources/syntaxtreegenerator/Tph2.ast create mode 100644 src/test/resources/syntaxtreegenerator/Tph3.ast create mode 100644 src/test/resources/syntaxtreegenerator/Tph4.ast create mode 100644 src/test/resources/syntaxtreegenerator/Tph5.ast create mode 100644 src/test/resources/syntaxtreegenerator/Tph6.ast create mode 100644 src/test/resources/syntaxtreegenerator/Tph7.ast create mode 100644 src/test/resources/syntaxtreegenerator/TypedID.ast create mode 100644 src/test/resources/syntaxtreegenerator/VectorAdd.ast create mode 100644 src/test/resources/syntaxtreegenerator/VectorSuper.ast create mode 100644 src/test/resources/syntaxtreegenerator/Y.ast create mode 100644 src/test/resources/syntaxtreegenerator/applyLambda.ast create mode 100644 src/test/resources/syntaxtreegenerator/mathStruc.ast create mode 100644 src/test/resources/syntaxtreegenerator/mathStrucInteger.ast diff --git a/src/test/java/syntaxtreegenerator/ValidSourcesTest.java b/src/test/java/syntaxtreegenerator/ValidSourcesTest.java new file mode 100644 index 00000000..bf37d92c --- /dev/null +++ b/src/test/java/syntaxtreegenerator/ValidSourcesTest.java @@ -0,0 +1,60 @@ +package syntaxtreegenerator; + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileFilter; +import java.io.FileInputStream; +import java.io.FileReader; +import java.util.HashMap; + +import org.junit.BeforeClass; +import org.junit.Test; + +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.syntaxtree.visual.ASTPrinter; + +public class ValidSourcesTest { + private final String expectedASTDirectory = "src/test/resources/syntaxtreegenerator/"; + private static HashMap javFiles = new HashMap<>(); + + @BeforeClass + public static void setUpFiles() { + final String testFileDirectory = "src/test/resources/bytecode/javFiles/"; + File dir = new File(testFileDirectory); + for (File f : dir.listFiles(new JavFilter())) { + javFiles.put(f.getName().replace(".jav", ""), f); + } + } + + @Test + public void applyLambdaTest() { + try { + FileInputStream expInStream = new FileInputStream(new File(expectedASTDirectory + "applyLambda.ast")); + byte[] expectedAST = expInStream.readAllBytes(); + expectedAST = new String(expectedAST).replaceAll("TPH [A-Z]+", "TPH").getBytes(); + File sf = javFiles.get("applyLambda"); + JavaTXCompiler compiler = new JavaTXCompiler(sf); + byte[] resultingAST = new String(ASTPrinter.print(compiler.sourceFiles.get(sf)).getBytes()).replaceAll("TPH [A-Z]+", "TPH").getBytes(); + System.out.println("Expected:\n" + new String(expectedAST)); + System.out.println("Result:\n" + new String(resultingAST)); + assertArrayEquals("Comparing expected and resulting AST for applyLambda.jav", expectedAST, resultingAST); + } catch (Exception exc) { + exc.printStackTrace(); + fail("An error occured while generating the AST for applyLambda.jav"); + } + } + +} + +class JavFilter implements FileFilter { + + @Override + public boolean accept(File pathname) { + if (pathname.getName().contains(".jav")) + return true; + return false; + } + +} diff --git a/src/test/resources/syntaxtreegenerator/BinaryInMeth.ast b/src/test/resources/syntaxtreegenerator/BinaryInMeth.ast new file mode 100644 index 00000000..5bb1379c --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/BinaryInMeth.ast @@ -0,0 +1,22 @@ +class BinaryInMeth { + +BinaryInMeth(){ + super(()); + } + TPH CMNB m(TPH CMNC a){ + return ++a; + } + + TPH CMNF m2(TPH CMNG a, TPH CMNH b){ + return this.m Signature: [TPH CMNK, TPH CMNL](a op b); + } + + TPH CMNP m3(TPH CMNQ a){ + return this.m Signature: [TPH CMNT, TPH CMNU](++a); + } + + BinaryInMeth(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/ClassGenLam.ast b/src/test/resources/syntaxtreegenerator/ClassGenLam.ast new file mode 100644 index 00000000..30b43454 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/ClassGenLam.ast @@ -0,0 +1,14 @@ +class ClassGenLam { + + TPH HWDB lam; +ClassGenLam(){ + super(()); + this.lam = (TPH HWDC x) -> { + return x; + }; + } + ClassGenLam(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Cycle.ast b/src/test/resources/syntaxtreegenerator/Cycle.ast new file mode 100644 index 00000000..18b435a8 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Cycle.ast @@ -0,0 +1,16 @@ +class Cycle { + +Cycle(){ + super(()); + } + TPH GGXG m(TPH GGXH x, TPH GGXI y){ + y = x; + x = y; + return; + } + + Cycle(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Fac.ast b/src/test/resources/syntaxtreegenerator/Fac.ast new file mode 100644 index 00000000..b15ecdd5 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Fac.ast @@ -0,0 +1,22 @@ +class Fac { + +Fac(){ + super(()); + } + TPH BSTE getFac(TPH BSTF n){ + TPH BSTG res; + res = 1; + TPH BSTI i; + i = 1; + while(i op n){ + res = res op i; + i++; + }; + return res; + } + + Fac(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Faculty.ast b/src/test/resources/syntaxtreegenerator/Faculty.ast new file mode 100644 index 00000000..66c777a8 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Faculty.ast @@ -0,0 +1,25 @@ +class Faculty { + + TPH DDAL fact; +Faculty(){ + super(()); + } + TPH DDBK getFact(java.lang.Integer x){ + return this.fact.apply Signature: [TPH DDBM, TPH DDBN](x); + } + + Faculty(){ + super(()); + this.fact = (TPH DDAO x) -> { + if(x op 1) + { + return 1; + } + else + { + return x op this.fact.apply Signature: [TPH DDAW, TPH DDAX](x op 1); + }; + }; + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Field.ast b/src/test/resources/syntaxtreegenerator/Field.ast new file mode 100644 index 00000000..43ffa1a6 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Field.ast @@ -0,0 +1,16 @@ +class Field { + + TPH JBCG x; +Field(){ + super(()); + this.x = 5; + } + TPH JBCJ m(){ + return this.x; + } + + Field(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/FieldTph2.ast b/src/test/resources/syntaxtreegenerator/FieldTph2.ast new file mode 100644 index 00000000..23c7c163 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/FieldTph2.ast @@ -0,0 +1,21 @@ +class FieldTph2 { + + TPH DJBG a; +FieldTph2(){ + super(()); + } + TPH DJBH m(TPH DJBI b){ + b = this.a; + return b; + } + + TPH DJBL m2(TPH DJBM c){ + this.a = c; + return; + } + + FieldTph2(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/FieldTphConsMeth.ast b/src/test/resources/syntaxtreegenerator/FieldTphConsMeth.ast new file mode 100644 index 00000000..9ada6011 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/FieldTphConsMeth.ast @@ -0,0 +1,27 @@ +class FieldTphConsMeth { + + TPH AINS a; +FieldTphConsMeth(){ + super(()); + } + TPH AIOE id(TPH AIOF b){ + return b; + } + + TPH AIOH setA(TPH AIOI x){ + this.a = x; + return this.a; + } + + TPH AIOM m(TPH AION x, TPH AIOO y){ + x = this.id Signature: [TPH AIOQ, TPH AIOR](y); + return; + } + + FieldTphConsMeth(TPH AINU c){ + super(()); + this.a = this.id Signature: [TPH AINX, TPH AINY](c); + return; + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/FieldTphMMeth.ast b/src/test/resources/syntaxtreegenerator/FieldTphMMeth.ast new file mode 100644 index 00000000..3a0cacd1 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/FieldTphMMeth.ast @@ -0,0 +1,33 @@ +class FieldTphMMeth { + + TPH HBWQ a; +FieldTphMMeth(){ + super(()); + } + TPH HBXG m(TPH HBXH b, TPH HBXI d, TPH HBXJ e){ + if(e) + { + return this.m3 Signature: [TPH HBXL, TPH HBXM](b); + } + else + { + return this.m3 Signature: [TPH HBXR, TPH HBXS](d); + }; + } + + TPH HBXY m2(TPH HBXZ b){ + this.a = this.m3 Signature: [TPH HBYC, TPH HBYD](b); + return; + } + + TPH HBYH m3(TPH HBYI b){ + return b; + } + + FieldTphMMeth(TPH HBWS c, TPH HBWT d, TPH HBWU e){ + super(()); + this.a = this.m Signature: [TPH HBWX, TPH HBWY, TPH HBWZ, TPH HBXA](c, d, e); + return; + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Gen.ast b/src/test/resources/syntaxtreegenerator/Gen.ast new file mode 100644 index 00000000..20f54843 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Gen.ast @@ -0,0 +1,14 @@ +class Gen { + +Gen(){ + super(()); + } + java.util.Vector m(java.util.Vector v){ + return v; + } + + Gen(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Id.ast b/src/test/resources/syntaxtreegenerator/Id.ast new file mode 100644 index 00000000..4b375d27 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Id.ast @@ -0,0 +1,18 @@ +class Id { + + TPH BDGF id2; +Id(){ + super(()); + this.id2 = (TPH BDGG x) -> { + return x; + }; + } + TPH BDGM id3(TPH BDGN x){ + return this.id2.apply Signature: [TPH BDGP, TPH BDGQ](x); + } + + Id(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Inf.ast b/src/test/resources/syntaxtreegenerator/Inf.ast new file mode 100644 index 00000000..5425c25d --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Inf.ast @@ -0,0 +1,28 @@ +class Inf { + +Inf(){ + super(()); + } + TPH KYAM m(TPH KYAN x, TPH KYAO y, TPH KYAP a){ + TPH KYAQ z; + TPH KYAR v; + TPH KYAS w; + TPH KYAT b; + y = x; + z = x; + v = y; + w = y; + y = a; + b = a; + TPH KYAU c; + TPH KYAV d; + c = v; + d = v; + return; + } + + Inf(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/KompTph.ast b/src/test/resources/syntaxtreegenerator/KompTph.ast new file mode 100644 index 00000000..0cde6326 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/KompTph.ast @@ -0,0 +1,26 @@ +class KompTph { + +KompTph(){ + super(()); + } + TPH EOGX m(TPH EOGY a, TPH EOGZ b, TPH EOHA c){ + TPH EOHB d; + d = a; + TPH EOHC e; + e = a; + a = b; + c = b; + this.m2 Signature: [TPH EOHE, TPH EOHF, TPH EOHG](a, c); + return; + } + + TPH EOHK m2(TPH EOHL a, TPH EOHM b){ + this.m Signature: [TPH EOHO, TPH EOHP, TPH EOHQ, TPH EOHR](a, a, b); + return; + } + + KompTph(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Lambda.ast b/src/test/resources/syntaxtreegenerator/Lambda.ast new file mode 100644 index 00000000..1cdc8f14 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Lambda.ast @@ -0,0 +1,18 @@ +class Lambda { + +Lambda(){ + super(()); + } + TPH KIZQ m(){ + TPH KIZR lam1; + lam1 = (TPH KIZS x) -> { + return x; + }; + return lam1; + } + + Lambda(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/LambdaCapture.ast b/src/test/resources/syntaxtreegenerator/LambdaCapture.ast new file mode 100644 index 00000000..de4944bf --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/LambdaCapture.ast @@ -0,0 +1,18 @@ +class LambdaCapture { + + java.lang.Integer i; + TPH BIMD f; +LambdaCapture(){ + super(()); + this.i = 8; + } + LambdaCapture(){ + super(()); + java.lang.Integer w; + w = 7; + this.f = (TPH BIMH j) -> { + return w op this.i; + }; + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Matrix.ast b/src/test/resources/syntaxtreegenerator/Matrix.ast new file mode 100644 index 00000000..f4779af2 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Matrix.ast @@ -0,0 +1,52 @@ +class Matrix { + +Matrix(){ + super(()); + } + TPH SBB mul(TPH SBC m){ + TPH SBD ret; + ret = new Matrix(); + TPH SBF i; + i = 0; + while(i op this.size Signature: [TPH SBJ]()){ + TPH SBM v1; + v1 = this.elementAt Signature: [TPH SBO, TPH SBP](i); + TPH SBS v2; + v2 = new java.util.Vector(); + TPH SBU j; + j = 0; + while(j op v1.size Signature: [TPH SBX]()){ + TPH SCA erg; + erg = 0; + TPH SCC k; + k = 0; + while(k op v1.size Signature: [TPH SCF]()){ + erg = erg op v1.elementAt Signature: [TPH SCI, TPH SCJ](k) op m.elementAt Signature: [TPH SCM, TPH SCN](k).elementAt Signature: [TPH SCQ, TPH SCR](j); + k++; + }; + v2.addElement Signature: [TPH SCZ, TPH SDA](erg); + j++; + }; + ret.addElement Signature: [TPH SDG, TPH SDH](v2); + i++; + }; + return ret; + } + + Matrix(){ + super(()); + return; + } + + Matrix(TPH SAF vv){ + super(()); + java.lang.Integer i; + i = 0; + while(i op vv.size Signature: [TPH SAI]()){ + this.add Signature: [TPH SAQ, TPH SAR](vv.elementAt Signature: [TPH SAM, TPH SAN](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/MatrixOP.ast b/src/test/resources/syntaxtreegenerator/MatrixOP.ast new file mode 100644 index 00000000..4ea4d5e0 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/MatrixOP.ast @@ -0,0 +1,52 @@ +class MatrixOP { + + TPH JGDT mul; +MatrixOP(){ + super(()); + this.mul = (TPH JGDU m1, TPH JGDV m2) -> { + TPH JGDW ret; + ret = new MatrixOP(); + TPH JGDY i; + i = 0; + while(i op m1.size Signature: [TPH JGEB]()){ + TPH JGEE v1; + v1 = m1.elementAt Signature: [TPH JGEF, TPH JGEG](i); + TPH JGEJ v2; + v2 = new java.util.Vector(); + TPH JGEL j; + j = 0; + while(j op v1.size Signature: [TPH JGEO]()){ + TPH JGER erg; + erg = 0; + TPH JGET k; + k = 0; + while(k op v1.size Signature: [TPH JGEW]()){ + erg = erg op v1.elementAt Signature: [TPH JGEZ, TPH JGFA](k) op m2.elementAt Signature: [TPH JGFD, TPH JGFE](k).elementAt Signature: [TPH JGFH, TPH JGFI](j); + k++; + }; + v2.addElement Signature: [TPH JGFQ, TPH JGFR](erg); + j++; + }; + ret.addElement Signature: [TPH JGFX, TPH JGFY](v2); + i++; + }; + return ret; + }; + } + MatrixOP(){ + super(()); + return; + } + + MatrixOP(TPH JGGP vv){ + super(()); + java.lang.Integer i; + i = 0; + while(i op vv.size Signature: [TPH JGGS]()){ + this.add Signature: [TPH JGHA, TPH JGHB](vv.elementAt Signature: [TPH JGGW, TPH JGGX](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Merge.ast b/src/test/resources/syntaxtreegenerator/Merge.ast new file mode 100644 index 00000000..c3632d11 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Merge.ast @@ -0,0 +1,23 @@ +class Merge { + +Merge(){ + super(()); + } + TPH JQYM merge(TPH JQYN a, TPH JQYO b){ + a.addAll Signature: [TPH JQYP, TPH JQYQ](b); + return a; + } + + TPH JQYU sort(TPH JQYV in){ + TPH JQYW firstHalf; + firstHalf = in.subList Signature: [TPH JQYZ, TPH JQZA, TPH JQZB](1, 2); + TPH JQZE secondHalf; + secondHalf = in.subList Signature: [TPH JQZH, TPH JQZI, TPH JQZJ](1, 2); + return this.merge Signature: [TPH JQZX, TPH JQZY, TPH JQZZ](this.sort Signature: [TPH JQZO, TPH JQZP](firstHalf), this.sort Signature: [TPH JQZT, TPH JQZU](secondHalf)); + } + + Merge(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/OL.ast b/src/test/resources/syntaxtreegenerator/OL.ast new file mode 100644 index 00000000..96ea1505 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/OL.ast @@ -0,0 +1,41 @@ +class OL { + +OL(){ + super(()); + } + java.lang.Double m(java.lang.Double x){ + return x op x; + } + + java.lang.Integer m(java.lang.Integer x){ + return x op x; + } + + java.lang.String m(java.lang.String x){ + return x op x; + } + + java.lang.Boolean m(java.lang.Boolean x){ + return x; + } + + OL(){ + super(()); + } + +}class OLMain { + +OLMain(){ + super(()); + } + TPH BYOF main(TPH BYOG x){ + TPH BYOH ol; + ol = new OL(); + return ol.m Signature: [TPH BYOJ, TPH BYOK](x); + } + + OLMain(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/OLFun.ast b/src/test/resources/syntaxtreegenerator/OLFun.ast new file mode 100644 index 00000000..4f5e08f1 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/OLFun.ast @@ -0,0 +1,22 @@ +class OLFun { + +OLFun(){ + super(()); + } + TPH JXJR m(TPH JXJS f, TPH JXJT x){ + x = f.apply Signature: [TPH JXJV, TPH JXJW](x op x); + return x; + } + + TPH JXKA m2(TPH JXKB y){ + this.m Signature: [TPH JXKK, TPH JXKL, TPH JXKM]((TPH JXKD x) -> { + return x op 2; + }, y); + return; + } + + OLFun(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/OLFun2.ast b/src/test/resources/syntaxtreegenerator/OLFun2.ast new file mode 100644 index 00000000..57415e3d --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/OLFun2.ast @@ -0,0 +1,16 @@ +class OLFun2 { + + TPH CTXA x; +OLFun2(){ + super(()); + } + TPH CTXB m(TPH CTXC f){ + this.x = f.apply Signature: [TPH CTXH, TPH CTXI](this.x op this.x); + return; + } + + OLFun2(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Overloading.ast b/src/test/resources/syntaxtreegenerator/Overloading.ast new file mode 100644 index 00000000..29fd0bb1 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Overloading.ast @@ -0,0 +1,31 @@ +class Overloading { + +Overloading(){ + super(()); + } + TPH N test(TPH O x){ + return x.methode Signature: [TPH P](); + } + + TPH T methode(){ + return Overloading; + } + + Overloading(){ + super(()); + } + +}class Overloading2 { + +Overloading2(){ + super(()); + } + TPH AO methode(){ + return Overloading2; + } + + Overloading2(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Pair.ast b/src/test/resources/syntaxtreegenerator/Pair.ast new file mode 100644 index 00000000..67a01833 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Pair.ast @@ -0,0 +1,20 @@ +class Pair { + + U a; + T b; +Pair(){ + super(()); + } + TPH IURS make(TPH IURT x){ + TPH IURU ret; + ret = new Pair(); + ret.a = x.elementAt Signature: [TPH IUSA, TPH IUSB](0); + ret.b = x.elementAt Signature: [TPH IUSG, TPH IUSH](1); + return ret; + } + + Pair(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Plus.ast b/src/test/resources/syntaxtreegenerator/Plus.ast new file mode 100644 index 00000000..c395f007 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Plus.ast @@ -0,0 +1,14 @@ +class Plus { + +Plus(){ + super(()); + } + TPH ACHZ m(TPH ACIA a, TPH ACIB b){ + return a op b; + } + + Plus(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/RelOps.ast b/src/test/resources/syntaxtreegenerator/RelOps.ast new file mode 100644 index 00000000..4b8fa1dd --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/RelOps.ast @@ -0,0 +1,14 @@ +class RelOps { + +RelOps(){ + super(()); + } + TPH IPBY m(TPH IPBZ a, TPH IPCA b){ + return a op b; + } + + RelOps(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Scalar.ast b/src/test/resources/syntaxtreegenerator/Scalar.ast new file mode 100644 index 00000000..fddde3ad --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Scalar.ast @@ -0,0 +1,29 @@ +class Scalar { + +Scalar(){ + super(()); + } + TPH KOXT mul(TPH KOXU v){ + TPH KOXV ret; + ret = 0; + TPH KOXX i; + i = 0; + while(i op this.size Signature: [TPH KOYB]()){ + ret = ret op this.elementAt Signature: [TPH KOYF, TPH KOYG](i) op v.elementAt Signature: [TPH KOYJ, TPH KOYK](i); + i = i op 1; + }; + return ret; + } + + Scalar(TPH KOWX v){ + super(()); + java.lang.Integer i; + i = 0; + while(i op v.size Signature: [TPH KOXA]()){ + this.add Signature: [TPH KOXI, TPH KOXJ](v.elementAt Signature: [TPH KOXE, TPH KOXF](i)); + i = i op 1; + }; + return; + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/SimpleCycle.ast b/src/test/resources/syntaxtreegenerator/SimpleCycle.ast new file mode 100644 index 00000000..771757a9 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/SimpleCycle.ast @@ -0,0 +1,18 @@ +class SimpleCycle { + +SimpleCycle(){ + super(()); + } + TPH ETMJ m(){ + TPH ETMK g; + TPH ETML h; + g = h; + h = g; + return; + } + + SimpleCycle(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Sorting.ast b/src/test/resources/syntaxtreegenerator/Sorting.ast new file mode 100644 index 00000000..979d2687 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Sorting.ast @@ -0,0 +1,23 @@ +class Sorting { + +Sorting(){ + super(()); + } + TPH JNN merge(TPH JNO a, TPH JNP b){ + a.addAll Signature: [TPH JNQ, TPH JNR](b); + return a; + } + + TPH JNV sort(TPH JNW in){ + TPH JNX firstHalf; + firstHalf = in; + TPH JNY secondHalf; + secondHalf = in; + return this.merge Signature: [TPH JOK, TPH JOL, TPH JOM](this.sort Signature: [TPH JOB, TPH JOC](firstHalf), this.sort Signature: [TPH JOG, TPH JOH](secondHalf)); + } + + Sorting(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/SubMatrix.ast b/src/test/resources/syntaxtreegenerator/SubMatrix.ast new file mode 100644 index 00000000..61ab2f22 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/SubMatrix.ast @@ -0,0 +1,26 @@ +class Matrix2 { + +Matrix2(){ + super(()); + } + Matrix2(){ + super(()); + } + +}class SubMatrix { + +SubMatrix(){ + super(()); + } + TPH DOFK m(){ + java.util.Vector v; + v = new java.util.Vector(); + v.add Signature: [TPH DOFN, TPH DOFO](1); + return; + } + + SubMatrix(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/TXGenerics.ast b/src/test/resources/syntaxtreegenerator/TXGenerics.ast new file mode 100644 index 00000000..1c4a0eab --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/TXGenerics.ast @@ -0,0 +1,19 @@ +class TXGenerics { + + TPH GLEG a; + TPH GLEH b; +TXGenerics(){ + super(()); + } + TPH GLEI test(){ + TPH GLEJ c; + c = new Cycle(); + c.m Signature: [TPH GLEN, TPH GLEO, TPH GLEP](this.a, this.b); + return; + } + + TXGenerics(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Tph.ast b/src/test/resources/syntaxtreegenerator/Tph.ast new file mode 100644 index 00000000..939f9a57 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Tph.ast @@ -0,0 +1,20 @@ +class Tph { + +Tph(){ + super(()); + } + TPH BNOP m(TPH BNOQ a, TPH BNOR b){ + TPH BNOS c; + c = this.m2 Signature: [TPH BNOU, TPH BNOV](b); + return a; + } + + TPH BNOZ m2(TPH BNPA b){ + return b; + } + + Tph(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Tph2.ast b/src/test/resources/syntaxtreegenerator/Tph2.ast new file mode 100644 index 00000000..f138866a --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Tph2.ast @@ -0,0 +1,18 @@ +class Tph2 { + + TPH FGYW id; +Tph2(){ + super(()); + this.id = (TPH FGYX x) -> { + return x; + }; + } + TPH FGZD id3(TPH FGZE x){ + return this.id.apply Signature: [TPH FGZG, TPH FGZH](x); + } + + Tph2(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Tph3.ast b/src/test/resources/syntaxtreegenerator/Tph3.ast new file mode 100644 index 00000000..cfbf0bc3 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Tph3.ast @@ -0,0 +1,21 @@ +class Tph3 { + +Tph3(){ + super(()); + } + TPH FMEJ m1(TPH FMEK x, TPH FMEL y){ + this.m2 Signature: [TPH FMEN, TPH FMEO](x); + x = y; + return; + } + + TPH FMES m2(TPH FMET y){ + this.m1 Signature: [TPH FMEV, TPH FMEW, TPH FMEX](y, y); + return; + } + + Tph3(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Tph4.ast b/src/test/resources/syntaxtreegenerator/Tph4.ast new file mode 100644 index 00000000..2ed453b8 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Tph4.ast @@ -0,0 +1,22 @@ +class Tph4 { + +Tph4(){ + super(()); + } + TPH FRJD m(TPH FRJE a, TPH FRJF b){ + TPH FRJG c; + c = this.m2 Signature: [TPH FRJI, TPH FRJJ](b); + TPH FRJM d; + d = this.m2 Signature: [TPH FRJO, TPH FRJP](c); + return d; + } + + TPH FRJT m2(TPH FRJU b){ + return b; + } + + Tph4(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Tph5.ast b/src/test/resources/syntaxtreegenerator/Tph5.ast new file mode 100644 index 00000000..dfdda9d1 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Tph5.ast @@ -0,0 +1,19 @@ +class Tph5 { + +Tph5(){ + super(()); + } + TPH FWNY m(TPH FWNZ x, TPH FWOA y){ + x = this.m2 Signature: [TPH FWOC, TPH FWOD](y); + return; + } + + TPH FWOH m2(TPH FWOI y){ + return y; + } + + Tph5(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Tph6.ast b/src/test/resources/syntaxtreegenerator/Tph6.ast new file mode 100644 index 00000000..eba65bc1 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Tph6.ast @@ -0,0 +1,21 @@ +class Tph6 { + +Tph6(){ + super(()); + } + TPH GBSM m(TPH GBSN x, TPH GBSO y){ + TPH GBSP c; + c = this.m2 Signature: [TPH GBSR, TPH GBSS](y); + c = this.m2 Signature: [TPH GBSW, TPH GBSX](x); + return; + } + + TPH GBTB m2(TPH GBTC y){ + return y; + } + + Tph6(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Tph7.ast b/src/test/resources/syntaxtreegenerator/Tph7.ast new file mode 100644 index 00000000..8d2ebe4b --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Tph7.ast @@ -0,0 +1,20 @@ +class Tph7 { + +Tph7(){ + super(()); + } + TPH GQRI m(TPH GQRJ a, TPH GQRK b){ + TPH GQRL c; + c = this.m2 Signature: [TPH GQRN, TPH GQRO](b); + return this.m2 Signature: [TPH GQRS, TPH GQRT](b); + } + + TPH GQRX m2(TPH GQRY b){ + return b; + } + + Tph7(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/TypedID.ast b/src/test/resources/syntaxtreegenerator/TypedID.ast new file mode 100644 index 00000000..0a56861d --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/TypedID.ast @@ -0,0 +1,22 @@ +class TypedID { + + TPH GVWK lam; +TypedID(){ + super(()); + this.lam = (TPH GVWL x) -> { + return x; + }; + } + TPH GVWR id(TPH GVWS b){ + return b; + } + + TPH GVWU m(){ + return this.lam; + } + + TypedID(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/VectorAdd.ast b/src/test/resources/syntaxtreegenerator/VectorAdd.ast new file mode 100644 index 00000000..992c9c1e --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/VectorAdd.ast @@ -0,0 +1,31 @@ +class VectorAdd { + +VectorAdd(){ + super(()); + } + TPH EXVJ vectorAdd(TPH EXVK v1, TPH EXVL v2){ + TPH EXVM i; + i = 0; + v1 = new java.util.Vector(); + TPH EXVP erg; + erg = new java.util.Vector(); + while(i op v1.size Signature: [TPH EXVT]()){ + erg.addElement Signature: [TPH EXWF, TPH EXWG](v1.elementAt Signature: [TPH EXVW, TPH EXVX](i) op v2.elementAt Signature: [TPH EXWA, TPH EXWB](i)); + i++; + }; + return erg; + } + + TPH EXWN m(TPH EXWO x, TPH EXWP y, TPH EXWQ z){ + x = new java.util.Vector(); + y = new java.util.Vector(); + x.add Signature: [TPH EXWU, TPH EXWV](1); + y.add Signature: [TPH EXWY, TPH EXWZ](2); + return z.addAll Signature: [TPH EXXC, TPH EXXD](x); + } + + VectorAdd(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/VectorSuper.ast b/src/test/resources/syntaxtreegenerator/VectorSuper.ast new file mode 100644 index 00000000..ec2faf35 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/VectorSuper.ast @@ -0,0 +1,17 @@ +class VectorSuper { + +VectorSuper(){ + super(()); + } + TPH HPGR m(TPH HPGS x){ + java.lang.Integer y; + y = 1; + x.addElement Signature: [TPH HPGU, TPH HPGV](y); + return; + } + + VectorSuper(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/Y.ast b/src/test/resources/syntaxtreegenerator/Y.ast new file mode 100644 index 00000000..6a736191 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/Y.ast @@ -0,0 +1,16 @@ +class Y { + + TPH IBFH y; +Y(){ + super(()); + } + Y(){ + super(()); + this.y = (TPH IBFK f) -> { + return (TPH IBFL t) -> { + return f.apply Signature: [TPH IBFR, TPH IBFS](this.y.apply Signature: [TPH IBFN, TPH IBFO](f)).apply Signature: [TPH IBFV, TPH IBFW](t); + }; + }; + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/applyLambda.ast b/src/test/resources/syntaxtreegenerator/applyLambda.ast new file mode 100644 index 00000000..504dddec --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/applyLambda.ast @@ -0,0 +1,27 @@ +class Apply { + +Apply(){ + super(()); + } + Apply(){ + super(()); + } + +}class applyLambda { + +applyLambda(){ + super(()); + } + TPH ASWH m(){ + TPH ASWI lam1; + lam1 = (TPH ASWJ x) -> { + return x; + }; + return lam1.apply Signature: [TPH ASWP, TPH ASWQ](new Apply()); + } + + applyLambda(){ + super(()); + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/mathStruc.ast b/src/test/resources/syntaxtreegenerator/mathStruc.ast new file mode 100644 index 00000000..85318505 --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/mathStruc.ast @@ -0,0 +1,19 @@ +class mathStruc { + + TPH IHHZ model; + TPH IHIA innerOp; +mathStruc(){ + super(()); + this.innerOp = (TPH IHIB o) -> { + return (TPH IHIC ms) -> { + return new mathStruc(o.apply Signature: [TPH IHIF, TPH IHIG, TPH IHIH](this.model, ms.model)); + }; + }; + } + mathStruc(TPH IHIW m){ + super(()); + this.model = m; + return; + } + +} \ No newline at end of file diff --git a/src/test/resources/syntaxtreegenerator/mathStrucInteger.ast b/src/test/resources/syntaxtreegenerator/mathStrucInteger.ast new file mode 100644 index 00000000..c36d537a --- /dev/null +++ b/src/test/resources/syntaxtreegenerator/mathStrucInteger.ast @@ -0,0 +1,38 @@ +class mathStrucInteger { + + TPH EBJW model; + TPH EBJX innerOp; +mathStrucInteger(){ + super(()); + this.innerOp = (TPH EBJY o) -> { + return (TPH EBJZ ms) -> { + return new mathStrucInteger(o.apply Signature: [TPH EBKC, TPH EBKD, TPH EBKE](this.model, ms.model)); + }; + }; + } + mathStrucInteger(TPH EBKT m){ + super(()); + this.model = m; + return; + } + +}class mathStrucIntegerUse { + +mathStrucIntegerUse(){ + super(()); + } + TPH EBLO main(){ + TPH EBLP ms; + ms = new mathStrucInteger(2); + TPH EBLT ms2; + ms2 = ms.innerOp.apply Signature: [TPH EBMD, TPH EBME]((TPH EBLV x, TPH EBLW y) -> { + return x op y; + }).apply Signature: [TPH EBMH, TPH EBMI](ms); + return ms2; + } + + mathStrucIntegerUse(){ + super(()); + } + +} \ No newline at end of file