use of com.dexels.navajo.document.ExpressionEvaluator in project navajo by Dexels.
the class ExpressionTest method testExpressionNewlineOutside.
@Test
public void testExpressionNewlineOutside() throws Exception {
ExpressionEvaluator ee = NavajoFactory.getInstance().getExpressionEvaluator();
Operand o = ee.evaluate("1\n+\n1", null, null, null);
assertEquals(2, o.value);
}
use of com.dexels.navajo.document.ExpressionEvaluator in project navajo by Dexels.
the class ExpressionTest method testExpressionNewline.
@Test
public void testExpressionNewline() throws Exception {
ExpressionEvaluator ee = NavajoFactory.getInstance().getExpressionEvaluator();
Operand o = ee.evaluate("'aap\nnoot'", null, null, null);
assertEquals("aap\nnoot", o.value);
}
use of com.dexels.navajo.document.ExpressionEvaluator in project navajo by Dexels.
the class ExpressionTest method testNonAscii.
@Test
public void testNonAscii() throws Exception {
ExpressionEvaluator ee = NavajoFactory.getInstance().getExpressionEvaluator();
Operand o = ee.evaluate("'àáâãäåāăąæßçćĉċčèéêëēĕėęěĝğġģĥħìíîïĩīĭıįĵķĸĺļľŀłñńņňŋòóôöõøōŏőœŕŗřśŝşšţťŧùúûüũůūŭűųŵýÿŷźżž'+'àáâãäåāăąæßçćĉċčèéêëēĕėęěĝğġģĥħìíîïĩīĭıįĵķĸĺļľŀłñńņňŋòóôöõøōŏőœŕŗřśŝşšţťŧùúûüũůūŭűųŵýÿŷźżž'", null, null, null);
assertEquals("àáâãäåāăąæßçćĉċčèéêëēĕėęěĝğġģĥħìíîïĩīĭıįĵķĸĺļľŀłñńņňŋòóôöõøōŏőœŕŗřśŝşšţťŧùúûüũůūŭűųŵýÿŷźżžàáâãäåāăąæßçćĉċčèéêëēĕėęěĝğġģĥħìíîïĩīĭıįĵķĸĺļľŀłñńņňŋòóôöõøōŏőœŕŗřśŝşšţťŧùúûüũůūŭűųŵýÿŷźżž", o.value);
}
use of com.dexels.navajo.document.ExpressionEvaluator in project navajo by Dexels.
the class ExpressionTest method testExpression.
@Test
public void testExpression() throws Exception {
ExpressionEvaluator ee = NavajoFactory.getInstance().getExpressionEvaluator();
Operand o = ee.evaluate("1+1", null, null, null);
assertEquals(2, o.value);
o = ee.evaluate("TODAY + 0#0#2#0#0#0", null, null, null);
System.err.println(o.value);
Navajo testDoc = NavajoFactory.getInstance().createNavajo();
Message m = NavajoFactory.getInstance().createMessage(testDoc, "MyTop");
testDoc.addMessage(m);
Message a = NavajoFactory.getInstance().createMessage(testDoc, "MyArrayMessage", "array");
m.addMessage(a);
for (int i = 0; i < 5; i++) {
Message a1 = NavajoFactory.getInstance().createMessage(testDoc, "MyArrayMessage");
a.addMessage(a1);
Property p = NavajoFactory.getInstance().createProperty(testDoc, "MyProp", "string", "noot" + i, 0, "", "in");
a1.addProperty(p);
Property p2 = NavajoFactory.getInstance().createProperty(testDoc, "MyProp2", "string", "aap" + i, 0, "", "in");
a1.addProperty(p2);
}
o = ee.evaluate("'hallo:' + [/MyTop/MyArrayMessage@MyProp=noot1/MyProp2]", testDoc, null, null);
assertEquals("hallo:aap1", o.value);
o = ee.evaluate("'hallo:' + [/MyTop/MyArrayMessage@2/MyProp2]", testDoc, null, null);
assertEquals("hallo:aap2", o.value);
}
use of com.dexels.navajo.document.ExpressionEvaluator in project navajo by Dexels.
the class ExpressionTest method testUnicode.
@Test
public void testUnicode() throws Exception {
ExpressionEvaluator ee = NavajoFactory.getInstance().getExpressionEvaluator();
Operand o = ee.evaluate("'ø'+'æ'", null, null, null);
assertEquals("øæ", o.value);
}
Aggregations