diff --git a/pom.xml b/pom.xml index 14b464f..f8a982c 100644 --- a/pom.xml +++ b/pom.xml @@ -127,6 +127,13 @@ 5.7.0 test + + + nl.jqno.equalsverifier + equalsverifier + 3.5.2 + test + org.junit.platform diff --git a/src/test/java/edu/kit/typicalc/model/ConstraintTest.java b/src/test/java/edu/kit/typicalc/model/ConstraintTest.java new file mode 100644 index 0000000..71deee8 --- /dev/null +++ b/src/test/java/edu/kit/typicalc/model/ConstraintTest.java @@ -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()); + } +} diff --git a/src/test/java/edu/kit/typicalc/model/SubstitutionTest.java b/src/test/java/edu/kit/typicalc/model/SubstitutionTest.java new file mode 100644 index 0000000..98c34c8 --- /dev/null +++ b/src/test/java/edu/kit/typicalc/model/SubstitutionTest.java @@ -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()); + } +} diff --git a/src/test/java/edu/kit/typicalc/model/type/FunctionTypeTest.java b/src/test/java/edu/kit/typicalc/model/type/FunctionTypeTest.java index c76964b..eaa1f88 100644 --- a/src/test/java/edu/kit/typicalc/model/type/FunctionTypeTest.java +++ b/src/test/java/edu/kit/typicalc/model/type/FunctionTypeTest.java @@ -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);