mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
CI: test coverage
And a complicated parser test
This commit is contained in:
parent
cd3612b60b
commit
c5a3cce7bf
@ -2,3 +2,7 @@ build:
|
|||||||
script:
|
script:
|
||||||
- mvn -Dmaven.repo.local=/tmp/m2/repository -Duser.home=/tmp checkstyle:check
|
- 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 test
|
||||||
|
- mvn -Dmaven.repo.local=/tmp/m2/repository -Duser.home=/tmp cobertura:cobertura
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
cobertura: target/site/cobertura/coverage.xml
|
||||||
|
27
pom.xml
27
pom.xml
@ -154,6 +154,17 @@
|
|||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.22.2</version>
|
<version>2.22.2</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>cobertura-maven-plugin</artifactId>
|
||||||
|
<version>2.7</version>
|
||||||
|
<configuration>
|
||||||
|
<check/>
|
||||||
|
<formats>
|
||||||
|
<format>xml</format>
|
||||||
|
</formats>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
@ -255,4 +266,20 @@
|
|||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
|
<reporting>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>cobertura-maven-plugin</artifactId>
|
||||||
|
<version>2.7</version>
|
||||||
|
<configuration>
|
||||||
|
<check/>
|
||||||
|
<formats>
|
||||||
|
<format>xml</format>
|
||||||
|
</formats>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
</project>
|
</project>
|
@ -6,11 +6,14 @@ public enum ParseError {
|
|||||||
* the lambda term didn't meet the specified syntax
|
* the lambda term didn't meet the specified syntax
|
||||||
*/
|
*/
|
||||||
UNEXPECTED_TOKEN,
|
UNEXPECTED_TOKEN,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* some tokens were remaining after parsing a full lambda term
|
||||||
|
*/
|
||||||
TOO_MANY_TOKENS,
|
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
|
UNEXPECTED_CHARACTER
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package edu.kit.typicalc.model.term;
|
|||||||
|
|
||||||
import edu.kit.typicalc.model.type.NamedType;
|
import edu.kit.typicalc.model.type.NamedType;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Representation of a constant boolean lambda term: either false or true.
|
* Representation of a constant boolean lambda term: either false or true.
|
||||||
*/
|
*/
|
||||||
@ -30,4 +32,21 @@ public class BooleanTerm extends ConstTerm {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return Boolean.toString(value);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.AbsTerm;
|
||||||
import edu.kit.typicalc.model.term.AppTerm;
|
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.ConstTerm;
|
||||||
import edu.kit.typicalc.model.term.IntegerTerm;
|
import edu.kit.typicalc.model.term.IntegerTerm;
|
||||||
import edu.kit.typicalc.model.term.LambdaTerm;
|
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)
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user