use of com.googlecode.aviator.runtime.type.AviatorObject in project aviatorscript by killme2008.
the class SeqPredicateFunctionUnitTest method testPredicate_neq.
@Test
public void testPredicate_neq() {
SeqPredicateFunction fun = new SeqPredicateFunction("neq", OperatorType.NEQ, AviatorRuntimeJavaType.valueOf("hello"));
AviatorObject result = fun.call(null, AviatorRuntimeJavaType.valueOf("hello"));
assertFalse(result.booleanValue(null));
result = fun.call(null, AviatorRuntimeJavaType.valueOf("he1lo"));
assertTrue(result.booleanValue(null));
}
use of com.googlecode.aviator.runtime.type.AviatorObject in project aviatorscript by killme2008.
the class SeqCountFunctionUnitTest method testCount_Collection.
@Test
public void testCount_Collection() {
final HashSet<Integer> set = new HashSet<Integer>();
set.add(1);
set.add(2);
SeqCountFunction fun = new SeqCountFunction();
AviatorObject result = fun.call(null, AviatorRuntimeJavaType.valueOf(set));
assertEquals(2, result.getValue(null));
}
use of com.googlecode.aviator.runtime.type.AviatorObject in project aviatorscript by killme2008.
the class SeqCountFunctionUnitTest method testCount_EmptyArray.
@Test
public void testCount_EmptyArray() {
SeqCountFunction fun = new SeqCountFunction();
AviatorObject result = fun.call(null, AviatorRuntimeJavaType.valueOf(new String[0]));
assertEquals(0, result.getValue(null));
}
use of com.googlecode.aviator.runtime.type.AviatorObject in project aviatorscript by killme2008.
the class SeqCountFunctionUnitTest method testCount_Array.
@Test
public void testCount_Array() {
AviatorObject[] args = new AviatorObject[1];
args[0] = AviatorRuntimeJavaType.valueOf(new String[10]);
SeqCountFunction fun = new SeqCountFunction();
AviatorObject result = fun.call(null, AviatorRuntimeJavaType.valueOf(new String[10]));
assertEquals(10, result.getValue(null));
}
use of com.googlecode.aviator.runtime.type.AviatorObject in project aviatorscript by killme2008.
the class SeqCountFunctionUnitTest method testCount_String.
@Test
public void testCount_String() {
SeqCountFunction fun = new SeqCountFunction();
AviatorObject result = fun.call(null, AviatorRuntimeJavaType.valueOf("hello"));
assertEquals(5, result.getValue(null));
}
Aggregations