use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class StandardFunctionsTest method testFormatDecimal.
@Test
public void testFormatDecimal() {
FunctionInterface fi = fff.getInstance(cl, "FormatDecimal");
fi.reset();
fi.insertFloatOperand(10.5);
fi.insertStringOperand("##");
Object o = fi.evaluateWithTypeChecking();
assertNotNull(o);
assertEquals("10", o.toString());
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class Switch method testIntegerMultipleMiss.
@Test
public void testIntegerMultipleMiss() throws Exception {
FunctionInterface fi = fff.getInstance(cl, "Switch");
fi.reset();
Navajo n = createTestNavajo();
fi.setInMessage(n);
// Switch('/Single/Vuur', 10, -10, 0). If property /Single/Vuur has value 10 it becomes -10 else it becomes 0.
fi.insertIntegerOperand((Integer) Expression.evaluate("[/Single/Vuur]", n).value);
fi.insertIntegerOperand(20);
fi.insertIntegerOperand(-20);
fi.insertIntegerOperand(15);
fi.insertIntegerOperand(-10);
fi.insertIntegerOperand(0);
Object result = fi.evaluate();
assertNotNull(result);
assertEquals(result.getClass(), Integer.class);
assertEquals(Integer.valueOf(0), result);
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class StandardFunctionsTest method testCheckRange.
@Test
public void testCheckRange() {
FunctionInterface fi = fff.getInstance(cl, "CheckRange");
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(Integer.valueOf(10));
list.add(Integer.valueOf(10));
fi.reset();
fi.setInMessage(createTestNavajo());
fi.insertListOperand(list);
fi.insertIntegerOperand(30);
Object o = fi.evaluateWithTypeChecking();
assertNotNull(o);
assertEquals(Boolean.class, o.getClass());
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class StandardFunctionsTest method testStringPadding.
@Test
public void testStringPadding() {
FunctionInterface fi = fff.getInstance(cl, "StringPadding");
fi.reset();
fi.insertStringOperand("aap");
fi.insertIntegerOperand(Integer.valueOf(10));
fi.insertStringOperand("*");
Object o = fi.evaluateWithTypeChecking();
assertNotNull(o);
assertEquals(String.class, o.getClass());
assertEquals("aap*******", o.toString());
}
use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.
the class StandardFunctionsTest method testEuro.
@Test
public void testEuro() {
DispatcherFactory.createDispatcher(new TestDispatcher(new TestNavajoConfig()));
FunctionInterface fi = fff.getInstance(cl, "Euro");
fi.reset();
Object o = fi.evaluateWithTypeChecking();
assertNotNull(o);
}
Aggregations