Text highlighter optimizations

This commit is contained in:
serso
2016-01-07 12:11:07 +01:00
parent 25c83bac94
commit 2215b11e6f
11 changed files with 191 additions and 261 deletions

View File

@@ -45,29 +45,29 @@ public class MathTypeTest extends AbstractCalculatorTest {
@Test
public void testGetType() throws Exception {
assertEquals(MathType.function, MathType.getType("sin", 0, false).getMathType());
assertEquals(MathType.text, MathType.getType("sn", 0, false).getMathType());
assertEquals(MathType.text, MathType.getType("s", 0, false).getMathType());
assertEquals(MathType.text, MathType.getType("", 0, false).getMathType());
assertEquals(MathType.function, MathType.getType("sin", 0, false).type);
assertEquals(MathType.text, MathType.getType("sn", 0, false).type);
assertEquals(MathType.text, MathType.getType("s", 0, false).type);
assertEquals(MathType.text, MathType.getType("", 0, false).type);
try {
assertEquals(MathType.text, MathType.getType("22", -1, false).getMathType());
assertEquals(MathType.text, MathType.getType("22", -1, false).type);
Assert.fail();
} catch (IllegalArgumentException e) {
}
try {
assertEquals(MathType.text, MathType.getType("22", 2, false).getMathType());
assertEquals(MathType.text, MathType.getType("22", 2, false).type);
Assert.fail();
} catch (IllegalArgumentException e) {
}
assertEquals("atanh", MathType.getType("atanh", 0, false).getMatch());
assertEquals("atanh", MathType.getType("atanh", 0, false).match);
}
@Test
public void testPostfixFunctionsProcessing() throws Exception {
assertEquals(postfix_function, MathType.getType("5!", 1, false).getMathType());
assertEquals(postfix_function, MathType.getType("!", 0, false).getMathType());
assertEquals(postfix_function, MathType.getType("5!", 1, false).type);
assertEquals(postfix_function, MathType.getType("!", 0, false).type);
}
}