mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-26 17:18:04 +00:00
cleaning up
This commit is contained in:
parent
64721f2ab0
commit
13548771ca
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,6 +2,7 @@ target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
/personalNotes/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
@ -32,4 +33,4 @@ build/
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
.DS_Store
|
||||
|
@ -8,23 +8,6 @@ import static HelpClasses.TestFileTester.run;
|
||||
*/
|
||||
class AllE2ETests {
|
||||
|
||||
// @Test
|
||||
// void testPublicClass() {
|
||||
// byte[] resultE2E = Compiler.generateE2EArrayFromTypedAst();
|
||||
// assertEquals(AbstractSyntax_PublicClass.get(), resultE2E);
|
||||
// }
|
||||
|
||||
// @Test
|
||||
// void testMethodCall() {
|
||||
// assertDoesNotThrow(() -> {
|
||||
// E2ETestUtil testUtility = new E2ETestUtil("src/test/testFiles/ASTandTypedASTFeatures/MethodCall.java", "MethodCall");
|
||||
//
|
||||
// assertEquals(0, testUtility.invokeMethod("method", null));
|
||||
// assertEquals(1, testUtility.invokeMethod("method1", new Class<?>[]{int.class}, 1));
|
||||
// assertEquals(3, testUtility.invokeMethod("method2", new Class<?>[]{int.class, int.class}, 1, 2));
|
||||
// });
|
||||
// } TODO: Fix this test or remove it
|
||||
|
||||
@Test
|
||||
void runE2EBreakTests() {
|
||||
run(E2E_Break.class);
|
||||
@ -105,11 +88,6 @@ class AllE2ETests {
|
||||
run(E2E_MethodCall.class);
|
||||
}
|
||||
|
||||
// @Test
|
||||
// void runE2EMultipleClassesTests() {
|
||||
// run(E2E_MultipleClasses.class);
|
||||
// } TODO: Fix this test or remove it
|
||||
|
||||
@Test
|
||||
void runE2EOperatorsTests() {
|
||||
run(E2E_Operators.class);
|
||||
|
@ -1,29 +0,0 @@
|
||||
package E2ETests;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ByteClassLoader extends ClassLoader {
|
||||
// TODO: Use or remove this class
|
||||
|
||||
// Map to store the class name and its corresponding byte array
|
||||
private final Map<String, byte[]> classesBytes = new HashMap<>();
|
||||
|
||||
public ByteClassLoader() {
|
||||
super(ClassLoader.getSystemClassLoader());
|
||||
}
|
||||
|
||||
// Method to add a class byte array to the loader
|
||||
public void addClass(String name, byte[] classData) {
|
||||
classesBytes.put(name, classData);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> findClass(String name) throws ClassNotFoundException {
|
||||
byte[] classData = classesBytes.get(name);
|
||||
if (classData == null) {
|
||||
return super.findClass(name);
|
||||
}
|
||||
return defineClass(name, classData, 0, classData.length);
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package E2ETests;
|
||||
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
public class ClassNameExtractor {
|
||||
// TODO: Use or remove this class
|
||||
|
||||
public static String getClassName(byte[] classBytes) {
|
||||
ClassReader classReader = new ClassReader(classBytes);
|
||||
ClassNameVisitor classNameVisitor = new ClassNameVisitor();
|
||||
classReader.accept(classNameVisitor, 0);
|
||||
return classNameVisitor.getClassName();
|
||||
}
|
||||
|
||||
private static class ClassNameVisitor extends ClassVisitor {
|
||||
private String className;
|
||||
|
||||
public ClassNameVisitor() {
|
||||
super(Opcodes.ASM9);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
|
||||
this.className = name.replace('/', '.');
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ package E2ETests.Features;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
|
||||
/**
|
||||
* Test class for testing if the compilation of the class 'Break' at src/test/testFiles/E2EFeatures/Break.java was successful,
|
||||
@ -14,7 +14,7 @@ public class E2E_Break {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_Break {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Break.java", "Break");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Break.java", "Break");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package E2ETests.Features;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
|
||||
/**
|
||||
* Test class for testing if the compilation of the class 'Class' at src/test/testFiles/E2EFeatures/Class.java was successful,
|
||||
@ -14,7 +14,7 @@ public class E2E_Class {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_Class {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Class.java", "Class");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Class.java", "Class");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_ClassObjects {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_ClassObjects {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/ClassObjects.java", "ClassObjects");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/ClassObjects.java", "ClassObjects");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package E2ETests.Features;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
|
||||
/**
|
||||
* Test class for testing if the compilation of the class 'Comment' at src/test/testFiles/E2EFeatures/Comment.java was successful,
|
||||
@ -14,7 +14,7 @@ public class E2E_Comment {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_Comment {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Comment.java", "Comment");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Comment.java", "Comment");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_CompAssign {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_CompAssign {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/CompAssign.java", "CompAssign");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/CompAssign.java", "CompAssign");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_ComplexCalls {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_ComplexCalls {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/ComplexCalls.java", "ComplexCalls");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/ComplexCalls.java", "ComplexCalls");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_Constructor {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_Constructor {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Constructor.java", "Constructor");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Constructor.java", "Constructor");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_Continue {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_Continue {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Continue.java", "Continue");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Continue.java", "Continue");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -3,16 +3,14 @@ package E2ETests.Features;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
|
||||
import java.util.List;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
|
||||
public class E2E_DataTypes {
|
||||
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -20,7 +18,7 @@ public class E2E_DataTypes {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/DataTypes.java", "DataTypes");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/DataTypes.java", "DataTypes");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package E2ETests.Features;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
|
||||
/**
|
||||
* Test class for testing if the compilation of the class 'Field' at src/test/testFiles/E2EFeatures/Field.java was successful,
|
||||
@ -14,7 +14,7 @@ public class E2E_Field {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_Field {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Field.java", "Field");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Field.java", "Field");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package E2ETests.Features;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
|
||||
/**
|
||||
* Test class for testing if the compilation of the class 'For' at src/test/testFiles/E2EFeatures/For.java was successful,
|
||||
@ -14,7 +14,7 @@ public class E2E_For {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_For {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/For.java", "For");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/For.java", "For");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package E2ETests.Features;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
|
||||
/**
|
||||
* Test class for testing if the compilation of the class 'If' at src/test/testFiles/E2EFeatures/If.java was successful,
|
||||
@ -14,7 +14,7 @@ public class E2E_If {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_If {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/If.java", "If");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/If.java", "If");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_InDeCrement {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_InDeCrement {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/InDeCrement.java", "InDeCrement");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/InDeCrement.java", "InDeCrement");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_LogicExpr {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_LogicExpr {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/LogicExpr.java", "LogicExpr");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/LogicExpr.java", "LogicExpr");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -17,7 +17,7 @@ public class E2E_Main {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -25,7 +25,7 @@ public class E2E_Main {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Main.java", "Main");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Main.java", "Main");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -171,6 +171,4 @@ public class E2E_Main {
|
||||
Assertions.fail();
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Add test for invoking main method by starting the compiled class file?
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_Method {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_Method {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Method.java", "Method");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Method.java", "Method");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_MethodCall {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_MethodCall {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/MethodCall.java", "MethodCall");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/MethodCall.java", "MethodCall");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import de.maishai.Compiler;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_Operators {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_Operators {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Operators.java", "Operators");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Operators.java", "Operators");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_Overloaded {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_Overloaded {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Overloaded.java", "Overloaded");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Overloaded.java", "Overloaded");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package E2ETests.Features;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
@ -17,7 +17,7 @@ public class E2E_Print {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -25,7 +25,7 @@ public class E2E_Print {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Print.java", "Print");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Print.java", "Print");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package E2ETests.Features;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
|
||||
/**
|
||||
* Test class for testing if the compilation of the class 'Return' at src/test/testFiles/E2EFeatures/Return.java was successful,
|
||||
@ -14,7 +14,7 @@ public class E2E_Return {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_Return {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Return.java", "Return");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Return.java", "Return");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package E2ETests.Features;
|
||||
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -14,7 +14,7 @@ public class E2E_Unary {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_Unary {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/Unary.java", "Unary");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/Unary.java", "Unary");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package E2ETests.Features;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
|
||||
/**
|
||||
* Test class for testing if the compilation of the class 'VariableDefWithDecl' at src/test/testFiles/E2EFeatures/VariableDefWithDecl.java was successful,
|
||||
@ -14,7 +14,7 @@ public class E2E_VariableDefWithDecl {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_VariableDefWithDecl {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/VariableDefWithDecl.java",
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/VariableDefWithDecl.java",
|
||||
"VariableDefWithDecl");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
|
@ -3,7 +3,7 @@ package E2ETests.Features;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import E2ETests.BytecodeTestUtil;
|
||||
import E2ETests.ReflectionsTestUtil;
|
||||
|
||||
/**
|
||||
* Test class for testing if the compilation of the class 'While' at src/test/testFiles/E2EFeatures/While.java was successful,
|
||||
@ -14,7 +14,7 @@ public class E2E_While {
|
||||
/**
|
||||
* The BytecodeTestUtil instance for the test class, which provides methods for testing the compiled class
|
||||
*/
|
||||
private BytecodeTestUtil util;
|
||||
private ReflectionsTestUtil util;
|
||||
|
||||
/**
|
||||
* Initializes the BytecodeTestUtil instance for the test class
|
||||
@ -22,7 +22,7 @@ public class E2E_While {
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
try {
|
||||
util = new BytecodeTestUtil("src/test/testFiles/E2EFeatures/While.java", "While");
|
||||
util = new ReflectionsTestUtil("src/test/testFiles/E2EFeatures/While.java", "While");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class BytecodeTestUtil {
|
||||
public class ReflectionsTestUtil {
|
||||
|
||||
/**
|
||||
* Class object representing the class that was compiled and can be analysed using reflection
|
||||
@ -24,7 +24,7 @@ public class BytecodeTestUtil {
|
||||
/**
|
||||
* Logger to log exceptions
|
||||
*/
|
||||
private static final Logger LOGGER = Logger.getLogger(BytecodeTestUtil.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(ReflectionsTestUtil.class.getName());
|
||||
|
||||
/**
|
||||
* Constructor to compile the source files, load the Class<?>-Object and create an instance of the class
|
||||
@ -32,7 +32,7 @@ public class BytecodeTestUtil {
|
||||
* @param className Name of the class to be loaded into the Class<?>-Object and create an instance of
|
||||
* @throws Exception If any exception occurs
|
||||
*/
|
||||
public BytecodeTestUtil(String sourceFilePath, String className) throws Exception {
|
||||
public ReflectionsTestUtil(String sourceFilePath, String className) throws Exception {
|
||||
// Generate bytecode from source file
|
||||
byte[] resultBytecode = Compiler.generateByteCodeArrayFromFiles(List.of(sourceFilePath)).get(0);
|
||||
|
Loading…
Reference in New Issue
Block a user