From 7e2357f2f242495f3c8452a2b557099ff5ceeb20 Mon Sep 17 00:00:00 2001 From: Johanna Stuber Date: Thu, 11 Feb 2021 10:12:17 +0100 Subject: [PATCH] use LinkedHashMap for typeAssumptions so they appear sorted in the tree --- .../java/edu/kit/typicalc/model/Tree.java | 17 ++++--------- .../edu/kit/typicalc/model/TypeInferer.java | 9 ++----- .../model/parser/TypeAssumptionParser.java | 4 ++-- .../kit/typicalc/model/ConclusionTest.java | 4 ++-- .../edu/kit/typicalc/model/ModelImplTest.java | 8 +++---- .../java/edu/kit/typicalc/model/TreeTest.java | 6 ++--- .../parser/TypeAssumptionParserTest.java | 24 +++++++++---------- .../model/step/AbsStepDefaultTest.java | 9 +++---- .../model/step/AbsStepWithLetTest.java | 7 +++--- .../model/step/AppStepDefaultTest.java | 7 +++--- .../model/step/ConstStepDefaultTest.java | 7 +++--- .../model/step/LetStepDefaultTest.java | 7 +++--- .../model/step/StepFactoryDefaultTest.java | 11 +++++---- .../model/step/StepFactoryWithLetTest.java | 11 +++++---- .../model/step/VarStepDefaultTest.java | 7 +++--- .../model/step/VarStepWithLetTest.java | 7 +++--- 16 files changed, 70 insertions(+), 75 deletions(-) diff --git a/src/main/java/edu/kit/typicalc/model/Tree.java b/src/main/java/edu/kit/typicalc/model/Tree.java index f303391..76cbd4b 100644 --- a/src/main/java/edu/kit/typicalc/model/Tree.java +++ b/src/main/java/edu/kit/typicalc/model/Tree.java @@ -1,19 +1,10 @@ package edu.kit.typicalc.model; import edu.kit.typicalc.model.step.*; -import edu.kit.typicalc.model.term.AbsTerm; -import edu.kit.typicalc.model.term.AppTerm; -import edu.kit.typicalc.model.term.ConstTerm; -import edu.kit.typicalc.model.term.LambdaTerm; -import edu.kit.typicalc.model.term.LetTerm; -import edu.kit.typicalc.model.term.TermVisitorTree; -import edu.kit.typicalc.model.term.VarTerm; +import edu.kit.typicalc.model.term.*; import edu.kit.typicalc.model.type.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Models the proof tree formed when the type of a lambda term is inferred. @@ -126,7 +117,7 @@ public class Tree implements TermVisitorTree { @Override public InferenceStep visit(AbsTerm absTerm, Map typeAssumptions, Type conclusionType) { - Map extendedTypeAssumptions = new HashMap<>(typeAssumptions); + Map extendedTypeAssumptions = new LinkedHashMap<>(typeAssumptions); Type assType = typeVarFactory.nextTypeVariable(); TypeAbstraction assAbs = new TypeAbstraction(assType); extendedTypeAssumptions.put(absTerm.getVariable(), assAbs); @@ -152,7 +143,7 @@ public class Tree implements TermVisitorTree { InferenceStep premise; if (typeInfererLet.getType().isPresent()) { - Map extendedTypeAssumptions = new HashMap<>(typeAssumptions); + Map extendedTypeAssumptions = new LinkedHashMap<>(typeAssumptions); extendedTypeAssumptions.replaceAll((key, value) -> { Type newType = value.getInnerType(); for (Substitution substitution : typeInfererLet.getMGU().orElseThrow(IllegalStateException::new)) { diff --git a/src/main/java/edu/kit/typicalc/model/TypeInferer.java b/src/main/java/edu/kit/typicalc/model/TypeInferer.java index b636fdb..696f07f 100644 --- a/src/main/java/edu/kit/typicalc/model/TypeInferer.java +++ b/src/main/java/edu/kit/typicalc/model/TypeInferer.java @@ -7,12 +7,7 @@ import edu.kit.typicalc.model.type.Type; import edu.kit.typicalc.model.type.TypeAbstraction; import edu.kit.typicalc.model.type.TypeVariableKind; -import java.util.ArrayDeque; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; +import java.util.*; /** * The type inferer is responsible for the whole type inference of a given lambda term, taking @@ -64,7 +59,7 @@ public class TypeInferer implements TypeInfererInterface { TypeVariableFactory typeVarFactory = new TypeVariableFactory(TypeVariableKind.GENERATED_TYPE_ASSUMPTION); Set freeVariables = lambdaTerm.getFreeVariables(); - Map generatedTypeAss = new HashMap<>(); + Map generatedTypeAss = new LinkedHashMap<>(); for (VarTerm varTerm : freeVariables) { generatedTypeAss.put(varTerm, new TypeAbstraction(typeVarFactory.nextTypeVariable())); } diff --git a/src/main/java/edu/kit/typicalc/model/parser/TypeAssumptionParser.java b/src/main/java/edu/kit/typicalc/model/parser/TypeAssumptionParser.java index e3c7929..8f2db94 100644 --- a/src/main/java/edu/kit/typicalc/model/parser/TypeAssumptionParser.java +++ b/src/main/java/edu/kit/typicalc/model/parser/TypeAssumptionParser.java @@ -7,7 +7,7 @@ import edu.kit.typicalc.util.Result; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -20,7 +20,7 @@ public class TypeAssumptionParser { // TODO: document type syntax? or refer to o private static final Pattern TYPE_VARIABLE_PATTERN = Pattern.compile("t(\\d+)"); public Result, ParseError> parse(Map oldAssumptions) { - Map typeAssumptions = new HashMap<>(); + Map typeAssumptions = new LinkedHashMap<>(); for (Map.Entry entry : oldAssumptions.entrySet()) { VarTerm var = new VarTerm(entry.getKey()); Result typeAbs = parseType(entry.getValue()); diff --git a/src/test/java/edu/kit/typicalc/model/ConclusionTest.java b/src/test/java/edu/kit/typicalc/model/ConclusionTest.java index 8eea6b5..2135336 100644 --- a/src/test/java/edu/kit/typicalc/model/ConclusionTest.java +++ b/src/test/java/edu/kit/typicalc/model/ConclusionTest.java @@ -9,14 +9,14 @@ import nl.jqno.equalsverifier.EqualsVerifier; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; class ConclusionTest { - private static final Map TYPE_ASSUMPTIONS = new HashMap<>(); + private static final Map TYPE_ASSUMPTIONS = new LinkedHashMap<>(); private static final LambdaTerm LAMBDA_TERM = new VarTerm("var"); private static final Type TYPE = new NamedType("type"); diff --git a/src/test/java/edu/kit/typicalc/model/ModelImplTest.java b/src/test/java/edu/kit/typicalc/model/ModelImplTest.java index 8b2f65a..9e82a42 100644 --- a/src/test/java/edu/kit/typicalc/model/ModelImplTest.java +++ b/src/test/java/edu/kit/typicalc/model/ModelImplTest.java @@ -2,19 +2,19 @@ package edu.kit.typicalc.model; import org.junit.jupiter.api.Test; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertTrue; class ModelImplTest { @Test void getTypeInferer() { ModelImpl model = new ModelImpl(); - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); map.put("x", "int"); - Map map2 = new HashMap<>(); + Map map2 = new LinkedHashMap<>(); map2.put("a.x", "3.int"); assertTrue(model.getTypeInferer("test.x.x.test", map2).isError()); assertTrue(model.getTypeInferer("x", map2).isError()); diff --git a/src/test/java/edu/kit/typicalc/model/TreeTest.java b/src/test/java/edu/kit/typicalc/model/TreeTest.java index a6d2209..27106fc 100644 --- a/src/test/java/edu/kit/typicalc/model/TreeTest.java +++ b/src/test/java/edu/kit/typicalc/model/TreeTest.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; class TreeTest { - private static final Map TYPE_ASSUMPTIONS = new HashMap<>(); + private static final Map TYPE_ASSUMPTIONS = new LinkedHashMap<>(); private static final ConstTerm CONST = new IntegerTerm(10); private static final VarTerm VAR = new VarTerm("var"); private static final AbsTerm ABS = new AbsTerm(VAR, VAR); @@ -46,7 +46,7 @@ class TreeTest { @Test void missingTypeAssumptionForVar() { - Map ass = new HashMap<>(); + Map ass = new LinkedHashMap<>(); assertThrows(IllegalStateException.class, () -> { new Tree(ass, VAR); }); @@ -87,7 +87,7 @@ class TreeTest { Tree tree = new Tree(TYPE_ASSUMPTIONS, ABS); - Map varTypeAss = new HashMap<>(TYPE_ASSUMPTIONS); + Map varTypeAss = new LinkedHashMap<>(TYPE_ASSUMPTIONS); varTypeAss.put(VAR, new TypeAbstraction(variable2)); Conclusion varConclusion = new Conclusion(varTypeAss, VAR, variable3); Constraint varConstraint = new Constraint(variable2, variable3); diff --git a/src/test/java/edu/kit/typicalc/model/parser/TypeAssumptionParserTest.java b/src/test/java/edu/kit/typicalc/model/parser/TypeAssumptionParserTest.java index ea6b23c..f34b428 100644 --- a/src/test/java/edu/kit/typicalc/model/parser/TypeAssumptionParserTest.java +++ b/src/test/java/edu/kit/typicalc/model/parser/TypeAssumptionParserTest.java @@ -5,7 +5,7 @@ import edu.kit.typicalc.model.type.*; import edu.kit.typicalc.util.Result; import org.junit.jupiter.api.Test; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import static edu.kit.typicalc.model.type.NamedType.BOOLEAN; @@ -17,7 +17,7 @@ class TypeAssumptionParserTest { @Test void simpleType() { TypeAssumptionParser parser = new TypeAssumptionParser(); - HashMap assumptions = new HashMap<>(); + Map assumptions = new LinkedHashMap<>(); assumptions.put("a", "int"); Result, ParseError> type = parser.parse(assumptions); assertTrue(type.isOk()); @@ -31,7 +31,7 @@ class TypeAssumptionParserTest { @Test void typeVariablesOneDigitIndex() { TypeAssumptionParser parser = new TypeAssumptionParser(); - HashMap assumptions = new HashMap<>(); + Map assumptions = new LinkedHashMap<>(); assumptions.put("x", "t1"); Result, ParseError> type = parser.parse(assumptions); assertTrue(type.isOk()); @@ -41,7 +41,7 @@ class TypeAssumptionParserTest { assertEquals(new VarTerm("x"), assumption.getKey()); assertEquals(new TypeAbstraction(new TypeVariable(TypeVariableKind.USER_INPUT, 1)), assumption.getValue()); - HashMap assumptions2 = new HashMap<>(); + Map assumptions2 = new LinkedHashMap<>(); assumptions2.put("x", "t001"); Result, ParseError> type2 = parser.parse(assumptions2); assertTrue(type.isOk()); @@ -55,7 +55,7 @@ class TypeAssumptionParserTest { @Test void typeVariablesMultipleDigitIndex() { TypeAssumptionParser parser = new TypeAssumptionParser(); - HashMap assumptions = new HashMap<>(); + Map assumptions = new LinkedHashMap<>(); assumptions.put("x", "t123456"); Result, ParseError> type = parser.parse(assumptions); assertTrue(type.isOk()); @@ -69,7 +69,7 @@ class TypeAssumptionParserTest { @Test void namedTypeStartingWithT() { TypeAssumptionParser parser = new TypeAssumptionParser(); - HashMap assumptions = new HashMap<>(); + Map assumptions = new LinkedHashMap<>(); assumptions.put("x", "tau1"); Result, ParseError> type = parser.parse(assumptions); assertTrue(type.isOk()); @@ -83,7 +83,7 @@ class TypeAssumptionParserTest { @Test void functionType() { TypeAssumptionParser parser = new TypeAssumptionParser(); - HashMap assumptions = new HashMap<>(); + Map assumptions = new LinkedHashMap<>(); assumptions.put("id", "int -> int"); Result, ParseError> type = parser.parse(assumptions); assertTrue(type.isOk()); @@ -93,7 +93,7 @@ class TypeAssumptionParserTest { assertEquals(new VarTerm("id"), assumption.getKey()); assertEquals(new TypeAbstraction(new FunctionType(INT, INT)), assumption.getValue()); - HashMap assumptions2 = new HashMap<>(); + Map assumptions2 = new LinkedHashMap<>(); assumptions2.put("f", "int -> int -> int"); type = parser.parse(assumptions2); if (type.isError()) { @@ -115,7 +115,7 @@ class TypeAssumptionParserTest { @Test void functionTypeWithVariables() { TypeAssumptionParser parser = new TypeAssumptionParser(); - HashMap assumptions = new HashMap<>(); + Map assumptions = new LinkedHashMap<>(); assumptions.put("fun", "t0 -> t0"); Result, ParseError> type = parser.parse(assumptions); assertTrue(type.isOk()); @@ -130,7 +130,7 @@ class TypeAssumptionParserTest { @Test void complicatedTypes() { TypeAssumptionParser parser = new TypeAssumptionParser(); - HashMap assumptions = new HashMap<>(); + Map assumptions = new LinkedHashMap<>(); assumptions.put("id", "(int -> int) -> (boolean -> boolean)"); Result, ParseError> type = parser.parse(assumptions); if (type.isError()) { @@ -148,7 +148,7 @@ class TypeAssumptionParserTest { new FunctionType(BOOLEAN, BOOLEAN) )), assumption.getValue()); parser = new TypeAssumptionParser(); - HashMap assumptions2 = new HashMap<>(); + Map assumptions2 = new LinkedHashMap<>(); assumptions2.put("id", "((int -> int) -> (boolean -> boolean)) -> ((int2 -> boolean2) -> (boolean2 -> int2))"); type = parser.parse(assumptions2); if (type.isError()) { @@ -178,7 +178,7 @@ class TypeAssumptionParserTest { @Test void longFunction() { TypeAssumptionParser parser = new TypeAssumptionParser(); - HashMap assumptions = new HashMap<>(); + Map assumptions = new LinkedHashMap<>(); assumptions.put("fun", "(a -> b -> c) -> d"); Result, ParseError> type = parser.parse(assumptions); assertTrue(type.isOk()); diff --git a/src/test/java/edu/kit/typicalc/model/step/AbsStepDefaultTest.java b/src/test/java/edu/kit/typicalc/model/step/AbsStepDefaultTest.java index 97d3a95..c71688c 100644 --- a/src/test/java/edu/kit/typicalc/model/step/AbsStepDefaultTest.java +++ b/src/test/java/edu/kit/typicalc/model/step/AbsStepDefaultTest.java @@ -6,13 +6,14 @@ import edu.kit.typicalc.model.term.IntegerTerm; import edu.kit.typicalc.model.term.VarTerm; import edu.kit.typicalc.model.type.NamedType; import edu.kit.typicalc.model.type.TypeAbstraction; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; class AbsStepDefaultTest { static InferenceStep premise = null; @@ -22,7 +23,7 @@ class AbsStepDefaultTest { static TypeAbstraction typeAbstraction = null; @BeforeAll static void setUp() { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); VarTerm term = new VarTerm("test"); namedType = new NamedType("testType"); typeAbstraction = new TypeAbstraction(namedType); diff --git a/src/test/java/edu/kit/typicalc/model/step/AbsStepWithLetTest.java b/src/test/java/edu/kit/typicalc/model/step/AbsStepWithLetTest.java index 9ce9567..a74e0e7 100644 --- a/src/test/java/edu/kit/typicalc/model/step/AbsStepWithLetTest.java +++ b/src/test/java/edu/kit/typicalc/model/step/AbsStepWithLetTest.java @@ -9,10 +9,11 @@ import edu.kit.typicalc.model.type.TypeAbstraction; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; class AbsStepWithLetTest { static InferenceStep premise = null; @@ -22,7 +23,7 @@ class AbsStepWithLetTest { static TypeAbstraction typeAbstraction = null; @BeforeAll static void setUp() { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); VarTerm term = new VarTerm("test"); namedType = new NamedType("testType"); typeAbstraction = new TypeAbstraction(namedType); diff --git a/src/test/java/edu/kit/typicalc/model/step/AppStepDefaultTest.java b/src/test/java/edu/kit/typicalc/model/step/AppStepDefaultTest.java index 8da044f..84b19b8 100644 --- a/src/test/java/edu/kit/typicalc/model/step/AppStepDefaultTest.java +++ b/src/test/java/edu/kit/typicalc/model/step/AppStepDefaultTest.java @@ -9,10 +9,11 @@ import edu.kit.typicalc.model.type.TypeAbstraction; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; class AppStepDefaultTest { static InferenceStep premise1 = null; @@ -23,7 +24,7 @@ class AppStepDefaultTest { static TypeAbstraction typeAbstraction = null; @BeforeAll static void setUp() { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); VarTerm term = new VarTerm("test"); namedType = new NamedType("testType"); typeAbstraction = new TypeAbstraction(namedType); diff --git a/src/test/java/edu/kit/typicalc/model/step/ConstStepDefaultTest.java b/src/test/java/edu/kit/typicalc/model/step/ConstStepDefaultTest.java index 1d4d038..ca18f89 100644 --- a/src/test/java/edu/kit/typicalc/model/step/ConstStepDefaultTest.java +++ b/src/test/java/edu/kit/typicalc/model/step/ConstStepDefaultTest.java @@ -9,10 +9,11 @@ import edu.kit.typicalc.model.type.TypeAbstraction; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; class ConstStepDefaultTest { static Conclusion conclusion = null; @@ -21,7 +22,7 @@ class ConstStepDefaultTest { static TypeAbstraction typeAbstraction = null; @BeforeAll static void setUp() { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); VarTerm term = new VarTerm("test"); namedType = new NamedType("testType"); typeAbstraction = new TypeAbstraction(namedType); diff --git a/src/test/java/edu/kit/typicalc/model/step/LetStepDefaultTest.java b/src/test/java/edu/kit/typicalc/model/step/LetStepDefaultTest.java index 0c3363b..4ecd41b 100644 --- a/src/test/java/edu/kit/typicalc/model/step/LetStepDefaultTest.java +++ b/src/test/java/edu/kit/typicalc/model/step/LetStepDefaultTest.java @@ -9,10 +9,11 @@ import edu.kit.typicalc.model.type.TypeAbstraction; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; class LetStepDefaultTest { static InferenceStep premise = null; @@ -23,7 +24,7 @@ class LetStepDefaultTest { static TestTypeInfererLet typeInferer = null; @BeforeAll static void setUp() { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); VarTerm term = new VarTerm("test"); namedType = new NamedType("testType"); typeAbstraction = new TypeAbstraction(namedType); diff --git a/src/test/java/edu/kit/typicalc/model/step/StepFactoryDefaultTest.java b/src/test/java/edu/kit/typicalc/model/step/StepFactoryDefaultTest.java index 6192989..6b865d0 100644 --- a/src/test/java/edu/kit/typicalc/model/step/StepFactoryDefaultTest.java +++ b/src/test/java/edu/kit/typicalc/model/step/StepFactoryDefaultTest.java @@ -6,14 +6,15 @@ import edu.kit.typicalc.model.term.IntegerTerm; import edu.kit.typicalc.model.term.VarTerm; import edu.kit.typicalc.model.type.NamedType; import edu.kit.typicalc.model.type.TypeAbstraction; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.LinkedHashMap; +import java.util.Map; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import java.util.HashMap; -import java.util.Map; - class StepFactoryDefaultTest { static InferenceStep premise = null; @@ -23,7 +24,7 @@ class StepFactoryDefaultTest { static TypeAbstraction typeAbstraction = null; @BeforeAll static void setUp() { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); VarTerm term = new VarTerm("test"); namedType = new NamedType("testType"); typeAbstraction = new TypeAbstraction(namedType); diff --git a/src/test/java/edu/kit/typicalc/model/step/StepFactoryWithLetTest.java b/src/test/java/edu/kit/typicalc/model/step/StepFactoryWithLetTest.java index 10b1640..6e0dfee 100644 --- a/src/test/java/edu/kit/typicalc/model/step/StepFactoryWithLetTest.java +++ b/src/test/java/edu/kit/typicalc/model/step/StepFactoryWithLetTest.java @@ -6,14 +6,15 @@ import edu.kit.typicalc.model.term.IntegerTerm; import edu.kit.typicalc.model.term.VarTerm; import edu.kit.typicalc.model.type.NamedType; import edu.kit.typicalc.model.type.TypeAbstraction; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.LinkedHashMap; +import java.util.Map; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; -import java.util.HashMap; -import java.util.Map; - class StepFactoryWithLetTest { static InferenceStep premise = null; @@ -24,7 +25,7 @@ class StepFactoryWithLetTest { @BeforeAll static void setUp() { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); VarTerm term = new VarTerm("test"); namedType = new NamedType("testType"); typeAbstraction = new TypeAbstraction(namedType); diff --git a/src/test/java/edu/kit/typicalc/model/step/VarStepDefaultTest.java b/src/test/java/edu/kit/typicalc/model/step/VarStepDefaultTest.java index b06e0f9..0125a9c 100644 --- a/src/test/java/edu/kit/typicalc/model/step/VarStepDefaultTest.java +++ b/src/test/java/edu/kit/typicalc/model/step/VarStepDefaultTest.java @@ -9,10 +9,11 @@ import edu.kit.typicalc.model.type.TypeAbstraction; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; class VarStepDefaultTest { static InferenceStep premise = null; @@ -22,7 +23,7 @@ class VarStepDefaultTest { static TypeAbstraction typeAbstraction = null; @BeforeAll static void setUp() { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); VarTerm term = new VarTerm("test"); namedType = new NamedType("testType"); typeAbstraction = new TypeAbstraction(namedType); diff --git a/src/test/java/edu/kit/typicalc/model/step/VarStepWithLetTest.java b/src/test/java/edu/kit/typicalc/model/step/VarStepWithLetTest.java index bdf1375..7ed8b6d 100644 --- a/src/test/java/edu/kit/typicalc/model/step/VarStepWithLetTest.java +++ b/src/test/java/edu/kit/typicalc/model/step/VarStepWithLetTest.java @@ -9,10 +9,11 @@ import edu.kit.typicalc.model.type.TypeAbstraction; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; class VarStepWithLetTest { static InferenceStep premise = null; @@ -22,7 +23,7 @@ class VarStepWithLetTest { static TypeAbstraction typeAbstraction = null; @BeforeAll static void setUp() { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); VarTerm term = new VarTerm("test"); namedType = new NamedType("testType"); typeAbstraction = new TypeAbstraction(namedType);