mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
Erster Unittest für Parser
This commit is contained in:
parent
8b61d32838
commit
3d5c84be03
25
pom.xml
25
pom.xml
@ -62,6 +62,13 @@
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit</groupId>
|
||||
<artifactId>junit-bom</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
@ -97,6 +104,19 @@
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@ -130,6 +150,11 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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"));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user