From c3343959c5fa8466a0d2257cb2686ebfa2aafded Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Wed, 15 May 2024 14:26:42 +0200 Subject: [PATCH] modified: ../resources/AllgemeinTest/Box.jav modified: ../resources/bytecode/javFiles/Box.jav modified: ../src/test/java/AllgemeinTest.java modified: ../src/test/java/TestComplete.java --- resources/AllgemeinTest/Box.jav | 6 ++---- resources/bytecode/javFiles/Box.jav | 16 +++++++++------- src/test/java/AllgemeinTest.java | 8 ++++++-- src/test/java/TestComplete.java | 4 ++-- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/resources/AllgemeinTest/Box.jav b/resources/AllgemeinTest/Box.jav index bd5c39e5..b2716354 100644 --- a/resources/AllgemeinTest/Box.jav +++ b/resources/AllgemeinTest/Box.jav @@ -2,9 +2,7 @@ class Box { A a; - Box(A a) { + public Box(A a) { this.a = a; } -} - - +} \ No newline at end of file diff --git a/resources/bytecode/javFiles/Box.jav b/resources/bytecode/javFiles/Box.jav index 4859d611..6dac7a38 100644 --- a/resources/bytecode/javFiles/Box.jav +++ b/resources/bytecode/javFiles/Box.jav @@ -1,7 +1,9 @@ -class B { } -class Box_Main extends B { - m(b) { - b.m(new Box_Main()); - b.m(new B()); - } -} +class Box { + + A a; + + Box() { } + Box(A a) { + //this.a = a; + } +} \ No newline at end of file diff --git a/src/test/java/AllgemeinTest.java b/src/test/java/AllgemeinTest.java index 2d89ec83..adc91ad6 100644 --- a/src/test/java/AllgemeinTest.java +++ b/src/test/java/AllgemeinTest.java @@ -1,6 +1,7 @@ import static org.junit.Assert.*; +import static targetast.TestCodegen.generateClassFiles; import java.io.File; import java.lang.reflect.Field; @@ -14,6 +15,7 @@ import org.junit.Test; import com.google.common.collect.Lists; import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.environment.ByteArrayClassLoader; public class AllgemeinTest { @@ -62,7 +64,9 @@ public class AllgemeinTest { //String className = "Cycle"; //String className = "TripleTest"; //String className = "WildcardList"; - String className = "List"; + //String className = "List"; + //String className = "Box"; + String className = "GenBox"; //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"; @@ -74,7 +78,7 @@ public class AllgemeinTest { Lists.newArrayList(new File(System.getProperty("user.dir")+"/resources/bytecode/classFiles/")), new File(System.getProperty("user.dir")+"/resources/bytecode/classFiles/")); //*/ - compiler.generateBytecode(new File(path)); + compiler.generateBytecode(); pathToClassFile = System.getProperty("user.dir")+"/resources/bytecode/classFiles/"; loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)}); classToTest = loader.loadClass(className); diff --git a/src/test/java/TestComplete.java b/src/test/java/TestComplete.java index ad2fd648..de1d24ef 100644 --- a/src/test/java/TestComplete.java +++ b/src/test/java/TestComplete.java @@ -606,10 +606,10 @@ public class TestComplete { } @Test - @Ignore("This one isn't working") + //@Ignore("This one isn't working") public void boxTest() throws Exception { var classFiles = generateClassFiles(new ByteArrayClassLoader(), "Box.jav"); - var instance = classFiles.get("Box_Main").getDeclaredConstructor().newInstance(); + var instance = classFiles.get("Box").getDeclaredConstructor().newInstance(); } @Test