From fe689b7253c146375653e6724f5b5eb8d493c796 Mon Sep 17 00:00:00 2001 From: i22011 <89882946+notbad3500@users.noreply.github.com> Date: Thu, 2 May 2024 16:09:24 +0200 Subject: [PATCH] Tests --- .idea/misc.xml | 3 +- .idea/uiDesigner.xml | 124 +++++++++++++++++++++++++++++++ pom.xml | 21 ++++++ src/main/test/java/MainTest.java | 18 +++++ src/main/test/java/TestSpecs.md | 48 ++++++++++++ 5 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 .idea/uiDesigner.xml create mode 100644 src/main/test/java/MainTest.java create mode 100644 src/main/test/java/TestSpecs.md diff --git a/.idea/misc.xml b/.idea/misc.xml index b173c63..e5d6295 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,3 +1,4 @@ + @@ -7,7 +8,7 @@ - + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index c188ae9..f1dc834 100644 --- a/pom.xml +++ b/pom.xml @@ -14,4 +14,25 @@ UTF-8 + + + + org.junit.jupiter + junit-jupiter-engine + 5.9.3 + test + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M5 + + + + \ No newline at end of file diff --git a/src/main/test/java/MainTest.java b/src/main/test/java/MainTest.java new file mode 100644 index 0000000..92d0239 --- /dev/null +++ b/src/main/test/java/MainTest.java @@ -0,0 +1,18 @@ +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + + +public class MainTest { + @Test + void testAdd() { + //Calculator calculator = new Calculator(); + //int result = calculator.add(2, 3); + //assertEquals(5, result, "2 + 3 should equal 5"); + } +} + + +/** + * run: mvn test + */ \ No newline at end of file diff --git a/src/main/test/java/TestSpecs.md b/src/main/test/java/TestSpecs.md new file mode 100644 index 0000000..e3f4c68 --- /dev/null +++ b/src/main/test/java/TestSpecs.md @@ -0,0 +1,48 @@ +# Scanner +## Scanner Input +### Beispiel 1: Empty Class + + String empty class = "class name {}"; + +### Beispiel 2: Filled Class + + String filled class = + "class Example {" + + "if (x < 5) {" + + "for (int i = 0; i < 10; i++) {" + + "while (true) {" + + "x = 5;" + + "}" + +## Scanner Output +### Beispiel 1: Empty Class + + [TokClass,TokIdentifier "name",TokLeftBrace,TokRightBrace] + +### Beispiel 2: Filled Class + + [TokClass,TokIdentifier "Example",TokLeftBrace] + [TokIf,TokLeftParen,TokIdentifier "x",TokLessThan,TokNumber 5,TokRightParen,TokLeftBrace] + [TokFor,TokLeftParen,TokIdentifier "int",TokIdentifier "i",TokAssign,TokNumber 0,TokSemicolon,TokIdentifier "i",TokLessThan,TokNumber 10,TokSemicolon,TokIdentifier "i",TokPlus,TokPlus,TokRightParen,TokLeftBrace] + [TokWhile,TokLeftParen,TokIdentifier "true",TokRightParen,TokLeftBrace] + [TokIdentifier "x",TokAssign,TokNumber 5,TokSemicolon] + [TokRightBrace] + +# Parser +## Parser Input +(Scanner Output) + +## Parser Output -> AST +### Beispiel 1: Empty Class + + + +### Beispiel 2: Filled Class + + + +# Semantische Analyse / Typcheck + +# Bytecodegenerierung + + \ No newline at end of file