use of com.dexels.navajo.document.Operand in project navajo by Dexels.
the class TestCompiledExpression method testUnicodeExpressionEscaped.
@Test
public void testUnicodeExpressionEscaped() throws Exception {
Operand result = Expression.evaluate("'\u20AC2,29'", null, null, null);
Assert.assertEquals("€2,29", result.value);
}
use of com.dexels.navajo.document.Operand in project navajo by Dexels.
the class TestCompiledExpression method testDoubleIntegerComparison.
@Test
public void testDoubleIntegerComparison() {
Operand result;
result = Expression.evaluate(" 0.9 < 1 ", null, null, null);
Assert.assertTrue((boolean) result.value);
result = Expression.evaluate(" 1.0 < 1 ", null, null, null);
Assert.assertFalse((boolean) result.value);
result = Expression.evaluate(" 0.9 <= 1 ", null, null, null);
Assert.assertTrue((boolean) result.value);
result = Expression.evaluate(" 1.0 <= 1 ", null, null, null);
Assert.assertTrue((boolean) result.value);
result = Expression.evaluate(" 0.9 > 1 ", null, null, null);
Assert.assertFalse((boolean) result.value);
result = Expression.evaluate(" 1.0 > 1 ", null, null, null);
Assert.assertFalse((boolean) result.value);
result = Expression.evaluate(" 0.9 >= 1 ", null, null, null);
Assert.assertFalse((boolean) result.value);
result = Expression.evaluate(" 1.0 >= 1 ", null, null, null);
Assert.assertTrue((boolean) result.value);
}
use of com.dexels.navajo.document.Operand in project navajo by Dexels.
the class TestCompiledExpression method testIntegerComparison.
@Test
public void testIntegerComparison() {
Operand result;
result = Expression.evaluate(" 1 < 2 ", null, null, null);
Assert.assertTrue((boolean) result.value);
result = Expression.evaluate(" 1 < 1 ", null, null, null);
Assert.assertFalse((boolean) result.value);
result = Expression.evaluate(" 1 <= 2 ", null, null, null);
Assert.assertTrue((boolean) result.value);
result = Expression.evaluate(" 1 <= 1 ", null, null, null);
Assert.assertTrue((boolean) result.value);
result = Expression.evaluate(" 1 > 2 ", null, null, null);
Assert.assertFalse((boolean) result.value);
result = Expression.evaluate(" 1 > 1 ", null, null, null);
Assert.assertFalse((boolean) result.value);
result = Expression.evaluate(" 1 >= 2 ", null, null, null);
Assert.assertFalse((boolean) result.value);
result = Expression.evaluate(" 1 >= 1 ", null, null, null);
Assert.assertTrue((boolean) result.value);
}
use of com.dexels.navajo.document.Operand in project navajo by Dexels.
the class TestExpressionPropertiesCompiled method testCompiled.
@Test
public void testCompiled() throws TMLExpressionException, SystemException {
Operand result = Expression.evaluate("[Two]", testDoc, null, topMessage);
Assert.assertEquals(2, result.value);
Integer twoValue = (Integer) two.getTypedValue();
Assert.assertEquals(2, twoValue.intValue());
one.setAnyValue(2);
Integer fiveValue = (Integer) five.getTypedValue();
Assert.assertEquals(5, fiveValue.intValue());
List<Property> change = testDoc.refreshExpression();
twoValue = (Integer) two.getTypedValue();
Assert.assertEquals(3, twoValue.intValue());
System.err.println("Change: " + change.size());
result = Expression.evaluate("[Two]", testDoc, null, topMessage);
Assert.assertEquals(3, result.value);
fiveValue = (Integer) five.getTypedValue();
Assert.assertEquals(6, fiveValue.intValue());
}
use of com.dexels.navajo.document.Operand in project navajo by Dexels.
the class ExpressionTest method testEmptySlashTMLParam.
@Test
public void testEmptySlashTMLParam() throws Exception {
Expression.compileExpressions = true;
ImmutableMessage outer = ImmutableFactory.empty().with("outerint", 1, "integer");
Operand o = Expression.evaluateImmutable("[/@]", null, Optional.empty(), Optional.of(outer));
ImmutableMessage s = o.immutableMessageValue();
assertEquals(outer, s);
}
Aggregations