diff --git a/pom.xml b/pom.xml index bd5d430..f68615b 100644 --- a/pom.xml +++ b/pom.xml @@ -62,6 +62,13 @@ pom import + + org.junit + junit-bom + 5.7.0 + pom + import + @@ -97,6 +104,19 @@ 3.8.1 test + + + org.junit.jupiter + junit-jupiter-api + 5.7.0 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.7.0 + test + @@ -130,6 +150,11 @@ + + + maven-surefire-plugin + 2.22.2 + diff --git a/src/main/java/edu/kit/typicalc/Application.java b/src/main/java/edu/kit/typicalc/Application.java index 5b52a7f..88b6e57 100644 --- a/src/main/java/edu/kit/typicalc/Application.java +++ b/src/main/java/edu/kit/typicalc/Application.java @@ -19,6 +19,7 @@ import org.vaadin.artur.helpers.LaunchUtil; public class Application extends SpringBootServletInitializer implements AppShellConfigurator { public static void main(String[] args) { + System.setProperty("user.home", "/home/arne/.cache"); LaunchUtil.launchBrowserInDevelopmentMode(SpringApplication.run(Application.class, args)); } diff --git a/src/main/java/edu/kit/typicalc/model/term/VarTerm.java b/src/main/java/edu/kit/typicalc/model/term/VarTerm.java index f2254bf..e803363 100644 --- a/src/main/java/edu/kit/typicalc/model/term/VarTerm.java +++ b/src/main/java/edu/kit/typicalc/model/term/VarTerm.java @@ -1,7 +1,25 @@ package edu.kit.typicalc.model.term; +import java.util.Objects; + public class VarTerm extends LambdaTerm { - public VarTerm(String s) { + private final String name; + + public VarTerm(String name) { super(); + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + VarTerm varTerm = (VarTerm) o; + return Objects.equals(name, varTerm.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); } } diff --git a/src/test/java/edu/kit/typicalc/model/parser/LambdaParserTest.java b/src/test/java/edu/kit/typicalc/model/parser/LambdaParserTest.java new file mode 100644 index 0000000..e33b8b3 --- /dev/null +++ b/src/test/java/edu/kit/typicalc/model/parser/LambdaParserTest.java @@ -0,0 +1,14 @@ +package edu.kit.typicalc.model.parser; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import edu.kit.typicalc.model.term.VarTerm; +import org.junit.jupiter.api.Test; + +class LambdaParserTest { + @Test + void varTerm() { + LambdaParser parser = new LambdaParser("x"); + assertEquals(parser.parse().unwrap(), new VarTerm("x")); + } +}