This commit is contained in:
ucrhh 2021-02-11 20:05:52 +01:00
commit e85b39c93e
4 changed files with 30 additions and 1 deletions

View File

@ -3,12 +3,15 @@ package edu.kit.typicalc.model;
import edu.kit.typicalc.model.step.*; import edu.kit.typicalc.model.step.*;
import edu.kit.typicalc.model.term.*; import edu.kit.typicalc.model.term.*;
import edu.kit.typicalc.model.type.*; import edu.kit.typicalc.model.type.*;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.*; import java.util.*;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
class TreeTest { class TreeTest {
@ -164,4 +167,12 @@ class TreeTest {
constraints.add(varRightConstraint); constraints.add(varRightConstraint);
assertEquals(constraints, tree.getConstraints()); assertEquals(constraints, tree.getConstraints());
} }
@Test
void equalsTest() {
EqualsVerifier.forClass(Tree.class).usingGetClass()
.withIgnoredFields("typeVarFactory", "stepFactory")
.suppress(Warning.NONFINAL_FIELDS)
.verify();
}
} }

View File

@ -4,6 +4,7 @@ import edu.kit.typicalc.model.type.FunctionType;
import edu.kit.typicalc.model.type.Type; import edu.kit.typicalc.model.type.Type;
import edu.kit.typicalc.model.type.TypeVariable; import edu.kit.typicalc.model.type.TypeVariable;
import edu.kit.typicalc.model.type.TypeVariableKind; import edu.kit.typicalc.model.type.TypeVariableKind;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.ArrayList; import java.util.ArrayList;
@ -71,4 +72,9 @@ class TypeInferenceResultTest {
Type expectedType = new FunctionType(A_2, new FunctionType(new FunctionType(A_2, A_5), A_5)); Type expectedType = new FunctionType(A_2, new FunctionType(new FunctionType(A_2, A_5), A_5));
assertEquals(expectedType, result.getType()); assertEquals(expectedType, result.getType());
} }
@Test
void equalsTest() {
EqualsVerifier.forClass(TypeInferenceResult.class).usingGetClass().verify();
}
} }

View File

@ -6,6 +6,7 @@ import edu.kit.typicalc.model.term.VarTerm;
import edu.kit.typicalc.model.type.TypeAbstraction; import edu.kit.typicalc.model.type.TypeAbstraction;
import edu.kit.typicalc.model.type.TypeVariable; import edu.kit.typicalc.model.type.TypeVariable;
import edu.kit.typicalc.model.type.TypeVariableKind; import edu.kit.typicalc.model.type.TypeVariableKind;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.*; import java.util.*;
@ -45,4 +46,9 @@ class TypeInfererLetTest {
= new ArrayList<>(Collections.singletonList(new Constraint(variable2, generated1))); = new ArrayList<>(Collections.singletonList(new Constraint(variable2, generated1)));
assertEquals(expectedLetConstraints, typeInfererLet.getLetConstraints()); assertEquals(expectedLetConstraints, typeInfererLet.getLetConstraints());
} }
@Test
void equalsTest() {
EqualsVerifier.forClass(TypeInfererLet.class).usingGetClass().verify();
}
} }

View File

@ -4,6 +4,7 @@ import edu.kit.typicalc.model.type.FunctionType;
import edu.kit.typicalc.model.type.TypeVariable; import edu.kit.typicalc.model.type.TypeVariable;
import edu.kit.typicalc.model.type.TypeVariableKind; import edu.kit.typicalc.model.type.TypeVariableKind;
import edu.kit.typicalc.util.Result; import edu.kit.typicalc.util.Result;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import java.util.ArrayDeque; import java.util.ArrayDeque;
@ -101,4 +102,9 @@ class UnificationTest {
UnificationError.INFINITE_TYPE UnificationError.INFINITE_TYPE
), new ArrayList<>()), steps.get(1)); ), new ArrayList<>()), steps.get(1));
} }
@Test
void equalsTest() {
EqualsVerifier.forClass(Unification.class).usingGetClass().verify();
}
} }