diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1f58140..6b6a807 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,3 +2,7 @@ build:
script:
- mvn -Dmaven.repo.local=/tmp/m2/repository -Duser.home=/tmp checkstyle:check
- mvn -Dmaven.repo.local=/tmp/m2/repository -Duser.home=/tmp test
+ - mvn -Dmaven.repo.local=/tmp/m2/repository -Duser.home=/tmp cobertura:cobertura
+ artifacts:
+ reports:
+ cobertura: target/site/cobertura/coverage.xml
diff --git a/pom.xml b/pom.xml
index 30663be..fc13d67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -154,6 +154,17 @@
maven-surefire-plugin
2.22.2
+
+ org.codehaus.mojo
+ cobertura-maven-plugin
+ 2.7
+
+
+
+ xml
+
+
+
maven-checkstyle-plugin
@@ -255,4 +266,20 @@
+
+
+
+
+ org.codehaus.mojo
+ cobertura-maven-plugin
+ 2.7
+
+
+
+ xml
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/edu/kit/typicalc/model/parser/ParseError.java b/src/main/java/edu/kit/typicalc/model/parser/ParseError.java
index 4bb340b..4b11451 100644
--- a/src/main/java/edu/kit/typicalc/model/parser/ParseError.java
+++ b/src/main/java/edu/kit/typicalc/model/parser/ParseError.java
@@ -6,11 +6,14 @@ public enum ParseError {
* the lambda term didn't meet the specified syntax
*/
UNEXPECTED_TOKEN,
-
+
+ /**
+ * some tokens were remaining after parsing a full lambda term
+ */
TOO_MANY_TOKENS,
/**
- * the String contained a character not allowed in that place
+ * the string contained a character not allowed in that context
*/
UNEXPECTED_CHARACTER
}
diff --git a/src/main/java/edu/kit/typicalc/model/term/BooleanTerm.java b/src/main/java/edu/kit/typicalc/model/term/BooleanTerm.java
index a4c2f52..06626f7 100644
--- a/src/main/java/edu/kit/typicalc/model/term/BooleanTerm.java
+++ b/src/main/java/edu/kit/typicalc/model/term/BooleanTerm.java
@@ -2,6 +2,8 @@ package edu.kit.typicalc.model.term;
import edu.kit.typicalc.model.type.NamedType;
+import java.util.Objects;
+
/**
* Representation of a constant boolean lambda term: either false or true.
*/
@@ -30,4 +32,21 @@ public class BooleanTerm extends ConstTerm {
public String toString() {
return Boolean.toString(value);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ BooleanTerm that = (BooleanTerm) o;
+ return value == that.value;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
}
diff --git a/src/test/java/edu/kit/typicalc/model/parser/LambdaParserTest.java b/src/test/java/edu/kit/typicalc/model/parser/LambdaParserTest.java
index eecba8c..ec5409d 100644
--- a/src/test/java/edu/kit/typicalc/model/parser/LambdaParserTest.java
+++ b/src/test/java/edu/kit/typicalc/model/parser/LambdaParserTest.java
@@ -4,6 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import edu.kit.typicalc.model.term.AbsTerm;
import edu.kit.typicalc.model.term.AppTerm;
+import edu.kit.typicalc.model.term.BooleanTerm;
import edu.kit.typicalc.model.term.ConstTerm;
import edu.kit.typicalc.model.term.IntegerTerm;
import edu.kit.typicalc.model.term.LambdaTerm;
@@ -49,4 +50,31 @@ class LambdaParserTest {
)
));
}
+ @Test
+ void complicatedTerm() {
+ LambdaParser parser = new LambdaParser("(λx.λy.x y 5)(λz.z)(true)");
+ assertEquals(parser.parse().unwrap(),
+ new AppTerm(
+ new AppTerm(
+ new AbsTerm(
+ new VarTerm("x"),
+ new AbsTerm(
+ new VarTerm("y"),
+ new AppTerm(
+ new AppTerm(
+ new VarTerm("x"),
+ new VarTerm("y")
+ ),
+ new IntegerTerm(5)
+ )
+ )
+ ),
+ new AbsTerm(
+ new VarTerm("z"),
+ new VarTerm("z")
+ )
+ ),
+ new BooleanTerm(true)
+ ));
+ }
}