mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
test LatexCreatorType
This commit is contained in:
parent
0379cf5db6
commit
2fd40aeefa
@ -0,0 +1,44 @@
|
||||
package edu.kit.typicalc.view.content.typeinferencecontent.latexcreator;
|
||||
|
||||
import edu.kit.typicalc.model.Model;
|
||||
import edu.kit.typicalc.model.ModelImpl;
|
||||
import edu.kit.typicalc.model.TypeInfererInterface;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import static edu.kit.typicalc.view.content.typeinferencecontent.latexcreator.LatexCreatorConstants.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
class LatexCreatorTypeTest {
|
||||
|
||||
private Model model = new ModelImpl();
|
||||
private TypeInfererInterface typeInferer;
|
||||
|
||||
@Test
|
||||
void identityTest() {
|
||||
typeInferer = model.getTypeInferer("λx.x", new HashMap<>()).unwrap();
|
||||
assertEquals(TREE_VARIABLE + "_{2} " + RIGHT_ARROW + SPACE + TREE_VARIABLE + "_{2}",
|
||||
new LatexCreatorType(typeInferer.getType().get()).getLatex());
|
||||
}
|
||||
|
||||
@Test
|
||||
void generatedTypeTest() {
|
||||
typeInferer = model.getTypeInferer("x", new HashMap<>()).unwrap();
|
||||
assertEquals(GENERATED_ASSUMPTION_VARIABLE + "_{1}", new LatexCreatorType(typeInferer.getType().get()).getLatex());
|
||||
}
|
||||
|
||||
@Test
|
||||
void namedTypeTest() {
|
||||
typeInferer = model.getTypeInferer("5", new HashMap<>()).unwrap();
|
||||
assertEquals(MONO_TEXT + "{int}", new LatexCreatorType(typeInferer.getType().get()).getLatex());
|
||||
}
|
||||
|
||||
@Test
|
||||
void userVariableTest() {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("x", "t1");
|
||||
typeInferer = model.getTypeInferer("x", map).unwrap();
|
||||
assertEquals(USER_VARIABLE + "_{1}", new LatexCreatorType(typeInferer.getType().get()).getLatex());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user