mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 10:20:41 +00:00
Tests for Substitution, Constraint
This commit is contained in:
parent
1b2f1a1cd6
commit
9affbb4807
7
pom.xml
7
pom.xml
@ -127,6 +127,13 @@
|
||||
<version>5.7.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>nl.jqno.equalsverifier</groupId>
|
||||
<artifactId>equalsverifier</artifactId>
|
||||
<version>3.5.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- need these for IntelliJ -->
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
|
32
src/test/java/edu/kit/typicalc/model/ConstraintTest.java
Normal file
32
src/test/java/edu/kit/typicalc/model/ConstraintTest.java
Normal file
@ -0,0 +1,32 @@
|
||||
package edu.kit.typicalc.model;
|
||||
|
||||
import edu.kit.typicalc.model.type.Type;
|
||||
import edu.kit.typicalc.model.type.TypeVariable;
|
||||
import edu.kit.typicalc.model.type.TypeVaribaleKind;
|
||||
import nl.jqno.equalsverifier.EqualsVerifier;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class ConstraintTest {
|
||||
|
||||
private static final Type type1 = new TypeVariable(TypeVaribaleKind.USER_INPUT, 1);
|
||||
private static final Type type2 = new TypeVariable(TypeVaribaleKind.TREE, 2);
|
||||
|
||||
@Test
|
||||
void equalsTest() {
|
||||
EqualsVerifier.forClass(Constraint.class).usingGetClass().verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
void getFirstTest() {
|
||||
Constraint con = new Constraint(type1,type2);
|
||||
assertEquals(type1, con.getFirstType());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getSecondTest() {
|
||||
Constraint con = new Constraint(type1,type2);
|
||||
assertEquals(type2, con.getSecondType());
|
||||
}
|
||||
}
|
32
src/test/java/edu/kit/typicalc/model/SubstitutionTest.java
Normal file
32
src/test/java/edu/kit/typicalc/model/SubstitutionTest.java
Normal file
@ -0,0 +1,32 @@
|
||||
package edu.kit.typicalc.model;
|
||||
|
||||
import edu.kit.typicalc.model.type.Type;
|
||||
import edu.kit.typicalc.model.type.TypeVariable;
|
||||
import edu.kit.typicalc.model.type.TypeVaribaleKind;
|
||||
import nl.jqno.equalsverifier.EqualsVerifier;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class SubstitutionTest {
|
||||
|
||||
private static final TypeVariable var = new TypeVariable(TypeVaribaleKind.USER_INPUT, 1);
|
||||
private static final Type type = new TypeVariable(TypeVaribaleKind.TREE, 2);
|
||||
|
||||
@Test
|
||||
void equalsTest() {
|
||||
EqualsVerifier.forClass(Substitution.class).usingGetClass().verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
void getVariableTest() {
|
||||
Substitution sub = new Substitution(var,type);
|
||||
assertEquals(var, sub.getVariable());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getTypeTest() {
|
||||
Substitution sub = new Substitution(var,type);
|
||||
assertEquals(type, sub.getType());
|
||||
}
|
||||
}
|
@ -1,11 +1,17 @@
|
||||
package edu.kit.typicalc.model.type;
|
||||
|
||||
import nl.jqno.equalsverifier.EqualsVerifier;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class FunctionTypeTest {
|
||||
|
||||
@Test
|
||||
void equalsTest() {
|
||||
EqualsVerifier.forClass(FunctionType.class).usingGetClass().verify();
|
||||
}
|
||||
|
||||
@Test
|
||||
void substitute() {
|
||||
TypeVariable typeVariable1 = new TypeVariable(TypeVaribaleKind.USER_INPUT, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user