use of com.googlecode.aviator.runtime.type.AviatorObject in project aviatorscript by killme2008.
the class RandomFunctionUnitTest method testCall.
@Test
public void testCall() {
RandomFunction rand = new RandomFunction();
AviatorObject result = rand.call(null);
assertTrue(result instanceof AviatorDouble);
assertFalse(result.getValue(null).equals(rand.call(null)));
}
use of com.googlecode.aviator.runtime.type.AviatorObject in project aviatorscript by killme2008.
the class SysDateFunctionUnitTest method testCall.
@Test
public void testCall() {
SysDateFunction fun = new SysDateFunction();
AviatorObject result = fun.call(null);
assertNotNull(result);
assertTrue(result.getValue(null) instanceof Date);
}
use of com.googlecode.aviator.runtime.type.AviatorObject in project aviatorscript by killme2008.
the class BinaryFunctionUnitTest method testMultFunction.
@Test
public void testMultFunction() {
BinaryFunction fun = new BinaryFunction(OperatorType.MULT);
AviatorObject result = fun.call(env, AviatorLong.valueOf(10L), AviatorLong.valueOf(11L));
assertEquals(110L, (Long) result.getValue(null), 0L);
}
use of com.googlecode.aviator.runtime.type.AviatorObject in project aviatorscript by killme2008.
the class BinaryFunctionUnitTest method testNegFunction.
@Test
public void testNegFunction() {
BinaryFunction fun = new BinaryFunction(OperatorType.NEG);
AviatorObject result = fun.call(env, AviatorLong.valueOf(10L));
assertEquals(-10L, (Long) result.getValue(null), 0L);
}
use of com.googlecode.aviator.runtime.type.AviatorObject in project aviatorscript by killme2008.
the class SeqReduceFunctionUnitTest method testReduce_NullArray.
@Test(expected = ExpressionRuntimeException.class)
public void testReduce_NullArray() {
Integer[] a = new Integer[10];
for (int i = 0; i < a.length; i++) {
if (i % 2 == 0) {
a[i] = i;
}
}
SeqReduceFunction fun = new SeqReduceFunction();
AviatorObject result = fun.call(this.env, AviatorRuntimeJavaType.valueOf(a), new AviatorJavaType("+"), AviatorRuntimeJavaType.valueOf(0));
}
Aggregations