Endabgabe #20
58
.lib/Kurzdokumentation.md
Normal file
58
.lib/Kurzdokumentation.md
Normal file
@ -0,0 +1,58 @@
|
||||
# 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**
|
@ -7,13 +7,25 @@ import java.util.Arrays;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.tools.JavaCompiler;
|
||||
import javax.tools.ToolProvider;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class E2EReflectionsTest {
|
||||
@Test
|
||||
public void AllFeaturesClassExampleTest(){
|
||||
try {
|
||||
Class<?> clazz = Class.forName("resources.input.combinedFeatureTests.AllFeaturesClassExample");
|
||||
Main.main(new String[]{"src/test/resources/input/combinedFeatureTests/AllFeaturesClassExample.java", "src/test/resources/output/raupenpiler"});
|
||||
// Get the system Java compiler
|
||||
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
||||
// Assert that the compiler is available
|
||||
assertNotNull(javac, "Java Compiler is not available");
|
||||
javac.run(null, null, null, "src/test/resources/input/combinedFeatureTests/AllFeaturesClassExample.java");
|
||||
|
||||
Class<?> clazz = Class.forName("src.resources.input.combinedFeatureTests.AllFeaturesClassExample");
|
||||
ClassLoader classLoader = getClass().getClassLoader();
|
||||
// Class<?> clazz = classLoader.loadClass("main.AllFeaturesClassExample");
|
||||
|
||||
// Class Name
|
||||
assertEquals("main.AllFeaturesClassExample", clazz.getName());
|
||||
@ -76,6 +88,8 @@ public class E2EReflectionsTest {
|
||||
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -54,19 +54,21 @@ public class InputFilesTest {
|
||||
* The test passes if all the files fail to compile.
|
||||
*/
|
||||
@Test
|
||||
public void areTestFilesActuallyFails() {
|
||||
public void areTestFilesActuallyFails() throws IOException {
|
||||
// Get the system Java compiler
|
||||
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
||||
// Assert that the compiler is available
|
||||
assertNotNull(javac, "Java Compiler is not available");
|
||||
|
||||
String directoryPath = "src/test/resources/input/failureTests";
|
||||
File folder = new File(directoryPath);
|
||||
|
||||
if (folder.isDirectory()) {
|
||||
File[] files = folder.listFiles((dir, name) -> name.endsWith(".java"));
|
||||
File folder1 = new File("src/test/resources/input/failureTests");
|
||||
File folder2 = new File("src/test/resources/input/typedAstExceptionsTest");
|
||||
|
||||
if (files != null) {
|
||||
List<File> files = getJavaFilesFromDirectory(folder1);
|
||||
files.addAll(getJavaFilesFromDirectory(folder2));
|
||||
|
||||
|
||||
if (!files.isEmpty()) {
|
||||
for (File file : files) {
|
||||
// Try to compile the file and get the result
|
||||
// The run method returns 0 if the compilation was successful, and non-zero otherwise
|
||||
@ -78,9 +80,7 @@ public class InputFilesTest {
|
||||
} else {
|
||||
System.out.println("No files found in the directory.");
|
||||
}
|
||||
} else {
|
||||
System.out.println("The provided path is not a directory.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@ public class AllFeaturesClassExample {
|
||||
char c;
|
||||
|
||||
// Konstruktor
|
||||
AllFeaturesClassExample(int a, boolean b, char c) {
|
||||
public AllFeaturesClassExample(int a, boolean b, char c) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
this.c = c;
|
||||
@ -19,12 +19,12 @@ public class AllFeaturesClassExample {
|
||||
|
||||
// while Schleife
|
||||
while (a > 0) {
|
||||
System.out.println("a ist " + a);
|
||||
a--;
|
||||
}
|
||||
|
||||
int c = 0;
|
||||
// for Schleife
|
||||
for (int i = 0; i < 5; i++) {
|
||||
c++;
|
||||
}
|
||||
|
||||
}
|
||||
@ -60,6 +60,10 @@ public class AllFeaturesClassExample {
|
||||
return a % b;
|
||||
}
|
||||
|
||||
boolean greaterThan(int a, int b) {
|
||||
return a > b;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
AllFeaturesClassExample obj = new AllFeaturesClassExample(12, true, 'a');
|
||||
obj.controlStructures();
|
||||
|
Loading…
Reference in New Issue
Block a user