mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-09 02:40:42 +00:00
first 'real' LatexCreatorConstraint test
This commit is contained in:
parent
6cf1de6780
commit
36c4e850e6
@ -250,6 +250,7 @@ public class LatexCreatorConstraints implements StepVisitor {
|
|||||||
latex.append(BRACKET_RIGHT);
|
latex.append(BRACKET_RIGHT);
|
||||||
latex.append(LATEX_NEW_LINE);
|
latex.append(LATEX_NEW_LINE);
|
||||||
}
|
}
|
||||||
|
latex.delete(latex.length() - LATEX_NEW_LINE.length(), latex.length());
|
||||||
latex.append(SPLIT_END);
|
latex.append(SPLIT_END);
|
||||||
if (error.isPresent()) {
|
if (error.isPresent()) {
|
||||||
latex.append(LATEX_NEW_LINE + AMPERSAND);
|
latex.append(LATEX_NEW_LINE + AMPERSAND);
|
||||||
@ -266,7 +267,6 @@ public class LatexCreatorConstraints implements StepVisitor {
|
|||||||
latex.append(constraintSets);
|
latex.append(constraintSets);
|
||||||
latex.append(AMPERSAND + SPLIT_BEGIN);
|
latex.append(AMPERSAND + SPLIT_BEGIN);
|
||||||
latex.append(generateUnificationName());
|
latex.append(generateUnificationName());
|
||||||
latex.append(SPACE);
|
|
||||||
latex.append(BRACKET_LEFT);
|
latex.append(BRACKET_LEFT);
|
||||||
typeInferer.getMGU().ifPresent(mgu -> mgu.forEach(substitution -> {
|
typeInferer.getMGU().ifPresent(mgu -> mgu.forEach(substitution -> {
|
||||||
latex.append(AMPERSAND);
|
latex.append(AMPERSAND);
|
||||||
|
@ -24,10 +24,27 @@ class LatexCreatorConstraintsTest {
|
|||||||
typeInferer = model.getTypeInferer("x", new HashMap<>()).unwrap();
|
typeInferer = model.getTypeInferer("x", new HashMap<>()).unwrap();
|
||||||
List<String> expected = new LatexCreatorConstraints(typeInferer).getEverything();
|
List<String> expected = new LatexCreatorConstraints(typeInferer).getEverything();
|
||||||
|
|
||||||
List<String> actual = List.of(EMPTY_CONSTRAINT_SET,
|
String constraintSet = AMPERSAND + CONSTRAINT_SET + EQUALS + LATEX_CURLY_LEFT + TREE_VARIABLE + "_{1}" + EQUALS
|
||||||
ALIGN_BEGIN + AMPERSAND + CONSTRAINT_SET + EQUALS + LATEX_CURLY_LEFT + TREE_VARIABLE + "_{1}" + EQUALS
|
+ GENERATED_ASSUMPTION_VARIABLE + "_{1}" + LATEX_CURLY_RIGHT;
|
||||||
+ GENERATED_ASSUMPTION_VARIABLE + "_{1}" + LATEX_CURLY_RIGHT + ALIGN_END);
|
|
||||||
|
|
||||||
|
String mguStart = LATEX_NEW_LINE + AMPERSAND + SPLIT_BEGIN + SIGMA + COLON + EQUALS + MGU + PAREN_LEFT
|
||||||
|
+ CONSTRAINT_SET + PAREN_RIGHT;
|
||||||
|
|
||||||
|
String mgu = "" + EQUALS + BRACKET_LEFT + AMPERSAND + TREE_VARIABLE + "_{1}"
|
||||||
|
+ SUBSTITUTION_SIGN + GENERATED_ASSUMPTION_VARIABLE + "_{1}" + BRACKET_RIGHT + SPLIT_END;
|
||||||
|
|
||||||
|
List<String> actual = List.of(EMPTY_CONSTRAINT_SET,
|
||||||
|
ALIGN_BEGIN + constraintSet + ALIGN_END,
|
||||||
|
ALIGN_BEGIN + constraintSet + mguStart + EQUALS + UNIFY + PAREN_LEFT + LATEX_CURLY_LEFT + AMPERSAND
|
||||||
|
+ TREE_VARIABLE + "_{1}" + EQUALS + GENERATED_ASSUMPTION_VARIABLE + "_{1}" + PAREN_RIGHT
|
||||||
|
+ LATEX_CURLY_RIGHT + SPLIT_END + ALIGN_END,
|
||||||
|
ALIGN_BEGIN + constraintSet + mguStart + mgu + ALIGN_END,
|
||||||
|
ALIGN_BEGIN + constraintSet + mguStart + mgu + ALIGN_END,
|
||||||
|
ALIGN_BEGIN + constraintSet + mguStart + mgu + LATEX_NEW_LINE + AMPERSAND + SIGMA + PAREN_LEFT
|
||||||
|
+ TREE_VARIABLE + "_{1}" + PAREN_RIGHT + EQUALS + GENERATED_ASSUMPTION_VARIABLE
|
||||||
|
+ "_{1}" + ALIGN_END);
|
||||||
|
|
||||||
|
assertEquals(actual.size(), expected.size());
|
||||||
for (int i = 0; i < actual.size(); i++) {
|
for (int i = 0; i < actual.size(); i++) {
|
||||||
assertEquals(actual.get(i), expected.get(i));
|
assertEquals(actual.get(i), expected.get(i));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user