diff --git a/.gitignore b/.gitignore index 5d19a24..5eaf75c 100644 --- a/.gitignore +++ b/.gitignore @@ -78,7 +78,7 @@ fabric.properties /target src/main/resources/logs/miniCompilerLog.log -src/main/resources/output/CompilerInput.class +src/test/java/main/CompilerInput.class src/test/resources/output/javac/CompilerInput$Test.class src/test/resources/output/javac/CompilerInput.class src/test/resources/output/miniCompiler/CompilerInput.class diff --git a/.lib/Kurzdokumentation.md b/.lib/Kurzdokumentation.md deleted file mode 100644 index b298cf9..0000000 --- a/.lib/Kurzdokumentation.md +++ /dev/null @@ -1,58 +0,0 @@ -# Kurzdokumentation - -## Aufgabenverteilung - -### Maximilian Stahl und Jannik Rombach: -- **Scanner** -- **Parser** -- **AST** -- **AstBuilder** - - **Modul: ast** - - Alle - - **Modul: parser** - - Alle - - **Modul: visitor** - - Alle - - **Testmodul: parser** - - AstBuildertest.java - - Helper.java - - **Testfiles: singleFeatureTests** - - Alle - -### Johannes Ehlert: -- **Semantische Analyse** - - **Modul: semantic** - - **Modul: typecheck** - - **Testmodul: parser** - - AstBuildertest.java - - **Testfiles: typedAstFeatureTests** - - Großteil - - **Testfiles: typedAstExceptionsTests** - - Großteil - -### David Große: -- **Bytecodegenerator** - - **Modul: bytecode** - - Alle - -### Lucas Janker: -- **Tests** - - **Modul: main** - - Alle - - **Testmodul: main** - - Alle - - **Testmodul: parser** - - ScannerTest.java - - ParserTest.java - - **Testmodul: semantic** - - **Testfiles: combinedFeatureTests** - - Alle - - **Testfiles: failureTests** - - Alle - - **Testfiles: Alle** - - Refactoring - - **Ordnerstrukturen** - - Großteil - - **Build** - - **Makefile** - - **Dokumentation** \ No newline at end of file diff --git a/JavaCompiler-1.0-jar-with-dependencies.jar b/JavaCompiler-1.0-jar-with-dependencies.jar new file mode 100644 index 0000000..33cbd97 Binary files /dev/null and b/JavaCompiler-1.0-jar-with-dependencies.jar differ diff --git a/Parser_Dokumentation.pdf b/Parser_Dokumentation.pdf index bcd6ebc..9a17f9d 100644 Binary files a/Parser_Dokumentation.pdf and b/Parser_Dokumentation.pdf differ diff --git a/README.md b/README.md index 65ffb7a..c411d48 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,10 @@ test/ ## Distribution of the realisation ### i22030 & i22035 -Ausführliche Beschreibung der Parser Umsetzung: ![Parserumsetzung](Parser_Dokumentation.pdf) +Ausführliche Beschreibung der Parser Umsetzung: + +![Parserumsetzung](Parser_Dokumentation.pdf) + Parser: - Grammar -> (src/main/java/parser/grammar) - Scanner @@ -110,7 +113,7 @@ cd .\src\test\ ; make clean compile-miniCompiler ``` ### 2. Start miniCompiler using jar: -If you do not have the .jar, download it [here](https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0/src/branch/Endabgabe/src) or compile it using mvn package or make first +If you do not have the .jar, download it [here](https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0/src/branch/main/JavaCompiler-1.0-jar-with-dependencies.jar) or compile it using mvn package or make first ``` java.exe -DgenJar=bool -DgenClass=bool -jar path_to_jar\jarName.jar 'path_to_input_file.java' 'path_to_output_directory' ``` diff --git a/src/main/resources/logs/miniCompiler.log b/src/main/resources/logs/miniCompiler.log new file mode 100644 index 0000000..a7fbc81 --- /dev/null +++ b/src/main/resources/logs/miniCompiler.log @@ -0,0 +1,809 @@ +Log Start Time: 13:14:21 08-07-2024 +Logger Name: main.MiniCompilerLogger$1CustomFormatter + +-------------------- Scanner -> Tokens -------------------- +AccessModifier public +Class class +Identifier CompilerInput +OpenCurlyBracket { +AccessModifier public +Int int +Identifier ps +Semicolon ; +AccessModifier public +Char char +Identifier brand +Semicolon ; +AccessModifier public +Int int +Identifier tires +Semicolon ; +AccessModifier public +Int int +Identifier drivenKilometers +Semicolon ; +AccessModifier public +Identifier CompilerInput +OpenRoundBracket ( +Int int +Identifier horsePower +ClosedRoundBracket ) +OpenCurlyBracket { +This this +Dot . +Identifier ps +Assign = +Identifier horsePower +Semicolon ; +This this +Dot . +Identifier tires +Assign = +IntValue 4 +Semicolon ; +ClosedCurlyBracket } +AccessModifier public +Int int +Identifier getTires +OpenRoundBracket ( +ClosedRoundBracket ) +OpenCurlyBracket { +Return return +This this +Dot . +Identifier tires +Semicolon ; +ClosedCurlyBracket } +AccessModifier public +Boolean boolean +Identifier isSuperCar +OpenRoundBracket ( +ClosedRoundBracket ) +OpenCurlyBracket { +If if +OpenRoundBracket ( +This this +Dot . +Identifier ps +ComparisonOperator > +IntValue 300 +ClosedRoundBracket ) +OpenCurlyBracket { +Return return +BooleanValue true +Semicolon ; +ClosedCurlyBracket } +Else else +OpenCurlyBracket { +Return return +BooleanValue false +Semicolon ; +ClosedCurlyBracket } +ClosedCurlyBracket } +AccessModifier public +Void void +Identifier tune +OpenRoundBracket ( +Int int +Identifier horsePower +ClosedRoundBracket ) +OpenCurlyBracket { +This this +Dot . +Identifier ps +Assign = +This this +Dot . +Identifier ps +LineOperator + +Identifier horsePower +Semicolon ; +ClosedCurlyBracket } +AccessModifier public +Void void +Identifier tune +OpenRoundBracket ( +ClosedRoundBracket ) +OpenCurlyBracket { +This this +Dot . +Identifier ps +Assign = +This this +Dot . +Identifier ps +LineOperator + +IntValue 50 +Semicolon ; +ClosedCurlyBracket } +AccessModifier public +Void void +Identifier driveCircels +OpenRoundBracket ( +Int int +Identifier circels +ClosedRoundBracket ) +OpenCurlyBracket { +For for +OpenRoundBracket ( +Int int +Identifier i +Assign = +IntValue 0 +Semicolon ; +Identifier i +ComparisonOperator < +Identifier circels +Semicolon ; +Identifier i +null ++ +ClosedRoundBracket ) +OpenCurlyBracket { +This this +Dot . +Identifier drivenKilometers +Assign = +This this +Dot . +Identifier drivenKilometers +LineOperator + +IntValue 5 +Semicolon ; +ClosedCurlyBracket } +ClosedCurlyBracket } +AccessModifier public +Void void +Identifier isTunable +OpenRoundBracket ( +Boolean boolean +Identifier hasEngine +Comma , +Boolean boolean +Identifier hasTires +ClosedRoundBracket ) +OpenCurlyBracket { +If if +OpenRoundBracket ( +Identifier hasEngine +LogicalOperator && +Identifier hasTires +ClosedRoundBracket ) +OpenCurlyBracket { +This this +Dot . +Identifier tune +OpenRoundBracket ( +IntValue 5 +ClosedRoundBracket ) +Semicolon ; +ClosedCurlyBracket } +ClosedCurlyBracket } +AccessModifier public +Char char +Identifier race +OpenRoundBracket ( +ClosedRoundBracket ) +OpenCurlyBracket { +Int int +Identifier enemyHorsePower +Assign = +IntValue 200 +Semicolon ; +Char char +Identifier win +Assign = +CharValue 'W' +Semicolon ; +Char char +Identifier lose +Assign = +CharValue 'L' +Semicolon ; +Identifier CompilerInput +Identifier enemy +Assign = +New new +Identifier CompilerInput +OpenRoundBracket ( +Identifier ps +ClosedRoundBracket ) +Semicolon ; +If if +OpenRoundBracket ( +This this +Dot . +Identifier ps +ComparisonOperator > +Identifier enemyHorsePower +ClosedRoundBracket ) +OpenCurlyBracket { +Return return +Identifier win +Semicolon ; +ClosedCurlyBracket } +Else else +OpenCurlyBracket { +Return return +Identifier lose +Semicolon ; +ClosedCurlyBracket } +ClosedCurlyBracket } +AccessModifier public +Int int +Identifier refuel +OpenRoundBracket ( +Int int +Identifier currentTank +Comma , +Int int +Identifier maxTank +ClosedRoundBracket ) +OpenCurlyBracket { +Int int +Identifier tank +Assign = +Identifier currentTank +Semicolon ; +Do do +OpenCurlyBracket { +Identifier tank +null ++ +Semicolon ; +ClosedCurlyBracket } +While while +OpenRoundBracket ( +Identifier tank +ComparisonOperator < +Identifier maxTank +ClosedRoundBracket ) +Semicolon ; +Return return +Identifier tank +Semicolon ; +ClosedCurlyBracket } +ClosedCurlyBracket } +EOF + + +-------------------- Parser -> Parsetree -------------------- +(program (classDeclaration public class CompilerInput { (memberDeclaration (fieldDeclaration public (type int) ps ;)) (memberDeclaration (fieldDeclaration public (type char) brand ;)) (memberDeclaration (fieldDeclaration public (type int) tires ;)) (memberDeclaration (fieldDeclaration public (type int) drivenKilometers ;)) (memberDeclaration (constructorDeclaration public CompilerInput ( (parameterList (parameter (type int) horsePower)) ) (blockStatement { (statement (statementExpression (assign (assignableExpression (memberAccess this . ps)) = (expression (unaryExpression horsePower)))) ;) (statement (statementExpression (assign (assignableExpression (memberAccess this . tires)) = (expression (unaryExpression (value 4))))) ;) }))) (memberDeclaration (methodDeclaration public (type int) getTires ( ) (blockStatement { (statement (returnStatement return (expression (unaryExpression (memberAccess this . tires)))) ;) }))) (memberDeclaration (methodDeclaration public (type boolean) isSuperCar ( ) (blockStatement { (statement (ifElseStatement (ifStatement if ( (expression (binaryExpression (nonCalculationExpression (unaryExpression (memberAccess this . ps)) (nonCalculationOperator >) (expression (unaryExpression (value 300)))))) ) (blockStatement { (statement (returnStatement return (expression (unaryExpression (value true)))) ;) })) (elseStatement else (blockStatement { (statement (returnStatement return (expression (unaryExpression (value false)))) ;) })))) }))) (memberDeclaration (methodDeclaration public void tune ( (parameterList (parameter (type int) horsePower)) ) (blockStatement { (statement (statementExpression (assign (assignableExpression (memberAccess this . ps)) = (expression (binaryExpression (calculationExpression (calculationExpression (dotExpression (dotSubtractionExpression (memberAccess this . ps)))) + (dotExpression (dotSubtractionExpression horsePower))))))) ;) }))) (memberDeclaration (methodDeclaration public void tune ( ) (blockStatement { (statement (statementExpression (assign (assignableExpression (memberAccess this . ps)) = (expression (binaryExpression (calculationExpression (calculationExpression (dotExpression (dotSubtractionExpression (memberAccess this . ps)))) + (dotExpression (dotSubtractionExpression 50))))))) ;) }))) (memberDeclaration (methodDeclaration public void driveCircels ( (parameterList (parameter (type int) circels)) ) (blockStatement { (statement (forStatement for ( (localVariableDeclaration (type int) i = (expression (unaryExpression (value 0)))) ; (expression (binaryExpression (nonCalculationExpression (unaryExpression i) (nonCalculationOperator <) (expression (unaryExpression circels))))) ; (statementExpression (crementExpression (incrementExpression (suffixIncrementExpression (assignableExpression i) ++)))) ) (blockStatement { (statement (statementExpression (assign (assignableExpression (memberAccess this . drivenKilometers)) = (expression (binaryExpression (calculationExpression (calculationExpression (dotExpression (dotSubtractionExpression (memberAccess this . drivenKilometers)))) + (dotExpression (dotSubtractionExpression 5))))))) ;) }))) }))) (memberDeclaration (methodDeclaration public void isTunable ( (parameterList (parameter (type boolean) hasEngine) , (parameter (type boolean) hasTires)) ) (blockStatement { (statement (ifElseStatement (ifStatement if ( (expression (binaryExpression (nonCalculationExpression (unaryExpression hasEngine) (nonCalculationOperator &&) (expression (unaryExpression hasTires))))) ) (blockStatement { (statement (statementExpression (methodCall (target this .) tune ( (argumentList (expression (unaryExpression (value 5)))) ))) ;) })))) }))) (memberDeclaration (methodDeclaration public (type char) race ( ) (blockStatement { (statement (localVariableDeclaration (type int) enemyHorsePower = (expression (unaryExpression (value 200)))) ;) (statement (localVariableDeclaration (type char) win = (expression (unaryExpression (value 'W')))) ;) (statement (localVariableDeclaration (type char) lose = (expression (unaryExpression (value 'L')))) ;) (statement (localVariableDeclaration (type CompilerInput) enemy = (expression (unaryExpression (statementExpression (newDeclaration new CompilerInput ( (argumentList (expression (unaryExpression ps))) )))))) ;) (statement (ifElseStatement (ifStatement if ( (expression (binaryExpression (nonCalculationExpression (unaryExpression (memberAccess this . ps)) (nonCalculationOperator >) (expression (unaryExpression enemyHorsePower))))) ) (blockStatement { (statement (returnStatement return (expression (unaryExpression win))) ;) })) (elseStatement else (blockStatement { (statement (returnStatement return (expression (unaryExpression lose))) ;) })))) }))) (memberDeclaration (methodDeclaration public (type int) refuel ( (parameterList (parameter (type int) currentTank) , (parameter (type int) maxTank)) ) (blockStatement { (statement (localVariableDeclaration (type int) tank = (expression (unaryExpression currentTank))) ;) (statement (doWhileStatement do (blockStatement { (statement (statementExpression (crementExpression (incrementExpression (suffixIncrementExpression (assignableExpression tank) ++)))) ;) }) while ( (expression (binaryExpression (nonCalculationExpression (unaryExpression tank) (nonCalculationOperator <) (expression (unaryExpression maxTank))))) ) ;)) (statement (returnStatement return (expression (unaryExpression tank))) ;) }))) })) +program + classDeclaration + public + class + CompilerInput + { + memberDeclaration + fieldDeclaration + public + type + int + ps + ; + memberDeclaration + fieldDeclaration + public + type + char + brand + ; + memberDeclaration + fieldDeclaration + public + type + int + tires + ; + memberDeclaration + fieldDeclaration + public + type + int + drivenKilometers + ; + memberDeclaration + constructorDeclaration + public + CompilerInput + ( + parameterList + parameter + type + int + horsePower + ) + blockStatement + { + statement + statementExpression + assign + assignableExpression + memberAccess + this + . + ps + = + expression + unaryExpression + horsePower + ; + statement + statementExpression + assign + assignableExpression + memberAccess + this + . + tires + = + expression + unaryExpression + value + 4 + ; + } + memberDeclaration + methodDeclaration + public + type + int + getTires + ( + ) + blockStatement + { + statement + returnStatement + return + expression + unaryExpression + memberAccess + this + . + tires + ; + } + memberDeclaration + methodDeclaration + public + type + boolean + isSuperCar + ( + ) + blockStatement + { + statement + ifElseStatement + ifStatement + if + ( + expression + binaryExpression + nonCalculationExpression + unaryExpression + memberAccess + this + . + ps + nonCalculationOperator + > + expression + unaryExpression + value + 300 + ) + blockStatement + { + statement + returnStatement + return + expression + unaryExpression + value + true + ; + } + elseStatement + else + blockStatement + { + statement + returnStatement + return + expression + unaryExpression + value + false + ; + } + } + memberDeclaration + methodDeclaration + public + void + tune + ( + parameterList + parameter + type + int + horsePower + ) + blockStatement + { + statement + statementExpression + assign + assignableExpression + memberAccess + this + . + ps + = + expression + binaryExpression + calculationExpression + calculationExpression + dotExpression + dotSubtractionExpression + memberAccess + this + . + ps + + + dotExpression + dotSubtractionExpression + horsePower + ; + } + memberDeclaration + methodDeclaration + public + void + tune + ( + ) + blockStatement + { + statement + statementExpression + assign + assignableExpression + memberAccess + this + . + ps + = + expression + binaryExpression + calculationExpression + calculationExpression + dotExpression + dotSubtractionExpression + memberAccess + this + . + ps + + + dotExpression + dotSubtractionExpression + 50 + ; + } + memberDeclaration + methodDeclaration + public + void + driveCircels + ( + parameterList + parameter + type + int + circels + ) + blockStatement + { + statement + forStatement + for + ( + localVariableDeclaration + type + int + i + = + expression + unaryExpression + value + 0 + ; + expression + binaryExpression + nonCalculationExpression + unaryExpression + i + nonCalculationOperator + < + expression + unaryExpression + circels + ; + statementExpression + crementExpression + incrementExpression + suffixIncrementExpression + assignableExpression + i + ++ + ) + blockStatement + { + statement + statementExpression + assign + assignableExpression + memberAccess + this + . + drivenKilometers + = + expression + binaryExpression + calculationExpression + calculationExpression + dotExpression + dotSubtractionExpression + memberAccess + this + . + drivenKilometers + + + dotExpression + dotSubtractionExpression + 5 + ; + } + } + memberDeclaration + methodDeclaration + public + void + isTunable + ( + parameterList + parameter + type + boolean + hasEngine + , + parameter + type + boolean + hasTires + ) + blockStatement + { + statement + ifElseStatement + ifStatement + if + ( + expression + binaryExpression + nonCalculationExpression + unaryExpression + hasEngine + nonCalculationOperator + && + expression + unaryExpression + hasTires + ) + blockStatement + { + statement + statementExpression + methodCall + target + this + . + tune + ( + argumentList + expression + unaryExpression + value + 5 + ) + ; + } + } + memberDeclaration + methodDeclaration + public + type + char + race + ( + ) + blockStatement + { + statement + localVariableDeclaration + type + int + enemyHorsePower + = + expression + unaryExpression + value + 200 + ; + statement + localVariableDeclaration + type + char + win + = + expression + unaryExpression + value + 'W' + ; + statement + localVariableDeclaration + type + char + lose + = + expression + unaryExpression + value + 'L' + ; + statement + localVariableDeclaration + type + CompilerInput + enemy + = + expression + unaryExpression + statementExpression + newDeclaration + new + CompilerInput + ( + argumentList + expression + unaryExpression + ps + ) + ; + statement + ifElseStatement + ifStatement + if + ( + expression + binaryExpression + nonCalculationExpression + unaryExpression + memberAccess + this + . + ps + nonCalculationOperator + > + expression + unaryExpression + enemyHorsePower + ) + blockStatement + { + statement + returnStatement + return + expression + unaryExpression + win + ; + } + elseStatement + else + blockStatement + { + statement + returnStatement + return + expression + unaryExpression + lose + ; + } + } + memberDeclaration + methodDeclaration + public + type + int + refuel + ( + parameterList + parameter + type + int + currentTank + , + parameter + type + int + maxTank + ) + blockStatement + { + statement + localVariableDeclaration + type + int + tank + = + expression + unaryExpression + currentTank + ; + statement + doWhileStatement + do + blockStatement + { + statement + statementExpression + crementExpression + incrementExpression + suffixIncrementExpression + assignableExpression + tank + ++ + ; + } + while + ( + expression + binaryExpression + nonCalculationExpression + unaryExpression + tank + nonCalculationOperator + < + expression + unaryExpression + maxTank + ) + ; + statement + returnStatement + return + expression + unaryExpression + tank + ; + } + } + + +-------------------- AST builder -> AST -------------------- +Abstract Syntax Tree generated, Startnode: +class ast.ProgramNode + + +-------------------- Semantic Analyzer -> typed AST -------------------- +Typed Abstract Syntax Tree generated without errors + + +-------------------- Bytecode Generator -> Bytecode -------------------- +Bytecode generated without errors + + diff --git a/src/main/resources/output/CompilerInput.class b/src/main/resources/output/CompilerInput.class new file mode 100644 index 0000000..d95919c Binary files /dev/null and b/src/main/resources/output/CompilerInput.class differ diff --git a/src/main/resources/output/output.jar b/src/main/resources/output/output.jar new file mode 100644 index 0000000..5fd7add Binary files /dev/null and b/src/main/resources/output/output.jar differ diff --git a/src/test/Makefile b/src/test/Makefile index 70d6bcd..eb27930 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -5,23 +5,12 @@ all: compile-javac compile-miniCompiler compile-javac: - javac -d .\resources\output\javac .\resources\input\CompilerInput.java + javac -d .\resources\output\javac ..\main\resources\input\CompilerInput.java compile-miniCompiler: cd ../.. ; mvn -DskipTests install cd ../.. ; mvn exec:java -DgenJar=true -DgenClass=true -Dexec.mainClass="main.Main" -Dexec.args="'src/main/resources/input/CompilerInput.java' 'src/main/resources/output'" - -test: compile-miniCompiler test-miniCompiler - -test-miniCompiler: - # move the compiled class to the test/main folder - mv ../main/resources/output/Compiler.class .java/ - # compile the test class - javac .java/main.EndToEndTester.java - # run the test class - java .java/main.EndToEndTester - - + cp ..\main\resources\output\CompilerInput.class .\resources\output\miniCompiler clean: # clean main output folders diff --git a/src/test/java/main/E2EReflectionsTest.java b/src/test/java/main/E2EReflectionsTest.java index 8c2d591..aa598ed 100644 --- a/src/test/java/main/E2EReflectionsTest.java +++ b/src/test/java/main/E2EReflectionsTest.java @@ -107,12 +107,6 @@ public class E2EReflectionsTest { runTest("MultipleClasses"); } - @Test - @Disabled - public void SelfReferenceTest() { - runTest("SelfReference"); - } - @Test public void ThisDotTest() { runTest("ThisDot"); diff --git a/src/test/java/main/EndToEndTester.java b/src/test/java/main/EndToEndTester.java deleted file mode 100644 index 443890d..0000000 --- a/src/test/java/main/EndToEndTester.java +++ /dev/null @@ -1,43 +0,0 @@ -package main; - -/** - * This class is used to test the output of the compiler. - * - *

Im gleichen Ordner wie diese Datei (EndToEndTester.java) muss die selbst kompilierte CompilerInput.class Datei sein. - *
Hinweis: Diese muss man also vom Ordner main/resources/output in diesen Ordner hier (test/java/main) rein kopieren. (bis es eine bessere Lösung gibt -> bin grad in der Make dran das alles hier automatisch zu machen)

- * - *

Die selbst kompilierte .class Datei wird dann hier drin geladen und eine Instanz von ihr erstellt, es können auch Methoden aufgerufen werden. - *

Diese EndToEndTester.java Datei wird dann in \src\test\java> mit javac .\main.EndToEndTester.java kompiliert und mit java main.EndToEndTester ausgeführt. - * Wenn unser Compiler funktioniert, sollten keine Errors kommen (sondern nur die Ausgaben, die wir in der CompilerInput.java Datei gemacht haben, - * oder Methoden, die wir hier aufrufen).

- * - */ -public class EndToEndTester { - public static void main(String[] args) { - try { - // Try to load the class named "CompilerInput" - Class cls = Class.forName("Compiler"); - // Print a success message if the class is loaded successfully - System.out.println("Class loaded successfully: " + cls.getName()); - - // Try to create an instance of the loaded class - Object instance = cls.getDeclaredConstructor().newInstance(); - // Print a success message if the instance is created successfully - System.out.println("Instance created: " + instance); - - - // If the class has a main method, you can invoke it - // cls.getMethod("main", String[].class).invoke(null, (Object) new String[]{}); - - // If the class has other methods, you can invoke them as well - // Example: cls.getMethod("someMethod").invoke(instance); - - } catch (ClassNotFoundException e) { - // Print an error message if the class is not found - System.err.println("Class not found: " + e.getMessage()); - } catch (Exception e) { - // Print an error message if any other exception occurs during class loading or instance creation - System.err.println("Error during class loading or execution: " + e.getMessage()); - } - } -} diff --git a/src/test/java/main/InputFilesTest.java b/src/test/java/main/InputFilesTest.java index 6997510..9edb2d4 100644 --- a/src/test/java/main/InputFilesTest.java +++ b/src/test/java/main/InputFilesTest.java @@ -1,6 +1,5 @@ package main; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import javax.tools.JavaCompiler; @@ -78,55 +77,6 @@ public class InputFilesTest { } } - @Test - @Disabled - public void areEndabgabeTestsActuallyValid() throws IOException { - // Get the system Java compiler - JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); - // Assert that the compiler is available - assertNotNull(javac, "Java Compiler is not available"); - - File endabgabeTests = new File("src/test/resources/input/endabgabeTests"); - - List files = getJavaFilesFromDirectory(endabgabeTests); - - if (!files.isEmpty()) { - for (File file : files) { - // Try to compile the file and get the result - int result = javac.run(null, null, null, file.getPath()); - - // Assert that the compilation succeeded (i.e., the result is zero) - assertEquals(0, result, "Expected compilation success for " + file.getName()); - } - } else { - System.out.println("No files found in the directories."); - } - } - - @Test - @Disabled - public void areSingleFeatureSemanticTestsActuallyValid() throws IOException { - // Get the system Java compiler - JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); - // Assert that the compiler is available - assertNotNull(javac, "Java Compiler is not available"); - - File singleFeatureSemanticTests = new File("src/test/resources/input/singleFeatureSemanticTests"); - - List files = getJavaFilesFromDirectory(singleFeatureSemanticTests); - - if (!files.isEmpty()) { - for (File file : files) { - // Try to compile the file and get the result - int result = javac.run(null, null, null, file.getPath()); - - // Assert that the compilation succeeded (i.e., the result is zero) - assertEquals(0, result, "Expected compilation success for " + file.getName()); - } - } else { - System.out.println("No files found in the directories."); - } - } @Test @@ -154,34 +104,6 @@ public class InputFilesTest { } - @Test - @Disabled - public void areTypedAstFeatureTestsActuallyValid() throws IOException { - // Get the system Java compiler - JavaCompiler javac = ToolProvider.getSystemJavaCompiler(); - // Assert that the compiler is available - assertNotNull(javac, "Java Compiler is not available"); - - File typedAstFeatureTests = new File("src/test/resources/input/typedAstFeatureTests"); - - List files = getJavaFilesFromDirectory(typedAstFeatureTests); - - if (!files.isEmpty()) { - for (File file : files) { - // Try to compile the file and get the result - int result = javac.run(null, null, null, file.getPath()); - - // Assert that the compilation succeeded (i.e., the result is zero) - assertEquals(0, result, "Expected compilation success for " + file.getName()); - } - } else { - System.out.println("No files found in the directories."); - } - } - - - - /** * This test method checks if invalid Java files fail to compile as expected. * It uses the JavaCompiler from the ToolProvider to compile the files. diff --git a/src/test/java/main/MainTest.java b/src/test/java/main/MainTest.java index 45f07f4..bd1098b 100644 --- a/src/test/java/main/MainTest.java +++ b/src/test/java/main/MainTest.java @@ -12,9 +12,6 @@ import semantic.SemanticTest; */ @RunWith(Suite.class) @Suite.SuiteClasses({ - InputFilesTest.class, - SemanticTest.class, - EndToTypedAstTest.class }) public class MainTest { // This class remains empty, it is used only as a holder for the above annotations diff --git a/src/test/resources/output/javac/test b/src/test/resources/output/javac/test deleted file mode 100644 index e69de29..0000000