Test update

This commit is contained in:
KingJulian 2024-07-04 15:50:04 +02:00
parent 8f55a15aef
commit 51240806b9
7 changed files with 15 additions and 13 deletions

View File

@ -76,10 +76,9 @@ public class CompareByteCodeBehaviour {
Constructor<?> constructor2 = constructors2[0]; Constructor<?> constructor2 = constructors2[0];
constructor1.setAccessible(true); constructor1.setAccessible(true);
constructor2.setAccessible(true); constructor2.setAccessible(true);
Object[] constructorArgs1 = getDefaultArguments(constructor1.getParameters()); Object[] constructorArgs = getDefaultArguments(constructor1.getParameters());
Object[] constructorArgs2 = getDefaultArguments(constructor2.getParameters()); Object obj1 = constructor1.newInstance(constructorArgs);
Object obj1 = constructor1.newInstance(constructorArgs1); Object obj2 = constructor2.newInstance(constructorArgs);
Object obj2 = constructor2.newInstance(constructorArgs2);
// Get methods // Get methods
Method[] methods1 = new Method[this.methodArray1.size()]; Method[] methods1 = new Method[this.methodArray1.size()];

View File

@ -77,10 +77,6 @@ public class CompareByteCodeSyntax {
System.out.println("Annotations do not match for methods " + method1.getName() + " and " + method2.getName()); System.out.println("Annotations do not match for methods " + method1.getName() + " and " + method2.getName());
return false; return false;
} }
if (method1.getModifiers() != method2.getModifiers()) {
System.out.println("Modifiers do not match for methods " + method1.getName() + " and " + method2.getName());
return false;
}
return true; return true;
} }

View File

@ -38,8 +38,8 @@ public class TestAll {
Program ast = FakultaetASTTyped.getProgram(); Program ast = FakultaetASTTyped.getProgram();
String className = "Fakultaet"; String className = "Fakultaet";
String javacode = "src/test/resources/basicClasses/Fakultaet.java"; String javacode = "src/test/resources/basicClasses/Fakultaet.java";
byteCodeTester.testByteCodeFromTypedAst(classPath, ast ,className); //byteCodeTester.testByteCodeFromTypedAst(classPath, ast ,className);
//byteCodeTester.testClassFileFromScratch(classPath, javacode, className); byteCodeTester.testClassFileFromScratch(classPath, javacode, className);
} }
@Test @Test
@ -58,7 +58,7 @@ public class TestAll {
Program ast = CharArgumentASTTyped.getProgram(); Program ast = CharArgumentASTTyped.getProgram();
String className = "CharArgument"; String className = "CharArgument";
String javacode = "src/test/resources/SimpleTests/CharArgument.java"; String javacode = "src/test/resources/SimpleTests/CharArgument.java";
byteCodeTester.testByteCodeFromTypedAst(classPath, ast ,className); //byteCodeTester.testByteCodeFromTypedAst(classPath, ast ,className);
byteCodeTester.testClassFileFromScratch(classPath, javacode, className); byteCodeTester.testClassFileFromScratch(classPath, javacode, className);
} }

View File

@ -0,0 +1,7 @@
class AddIntBool {
public int add(int myInt, bool myBool) {
int result = myInt + myBool;
}
}

View File

@ -1,12 +1,12 @@
class CharArgument { class CharArgument {
char c; public char c;
public CharArgument() { public CharArgument() {
this.c = foo('a'); this.c = foo('a');
} }
char foo(char c) { public char foo(char c) {
return c; return c;
} }