Search in sources :

Example 6 with FunctionInterface

use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.

the class TestMathFunctions method testRoundToFraction.

@Test
public void testRoundToFraction() {
    FunctionInterface round = fff.getInstance(cl, "Round");
    round.reset();
    round.insertFloatOperand(10.12345);
    round.insertIntegerOperand(3);
    double actual = (Double) round.evaluateWithTypeChecking();
    assertEquals(10.123, actual, 0.000001);
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Test(org.junit.Test)

Example 7 with FunctionInterface

use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.

the class TestMathFunctions method testMin.

@Test
public void testMin() {
    FunctionInterface min = fff.getInstance(cl, "Min");
    min.reset();
    min.insertIntegerOperand(20);
    min.insertIntegerOperand(10);
    int actual = (Integer) min.evaluateWithTypeChecking();
    assertEquals(10, actual);
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Test(org.junit.Test)

Example 8 with FunctionInterface

use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.

the class TestMathFunctions method testFloor.

@Test
public void testFloor() {
    FunctionInterface floor = fff.getInstance(cl, "Floor");
    floor.reset();
    floor.insertFloatOperand(1.1);
    double actual = (Double) floor.evaluate();
    assertEquals(1.0, actual, 0.000001);
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Test(org.junit.Test)

Example 9 with FunctionInterface

use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.

the class TestMathFunctions method testCeil.

@Test
public void testCeil() {
    FunctionInterface ceil = fff.getInstance(cl, "Ceil");
    ceil.reset();
    ceil.insertFloatOperand(1.1);
    double actual = (Double) ceil.evaluate();
    assertEquals(2.0, actual, 0.000001);
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Test(org.junit.Test)

Example 10 with FunctionInterface

use of com.dexels.navajo.expression.api.FunctionInterface in project navajo by Dexels.

the class TestMathFunctions method testFloorWithBogusParameter.

@Test(expected = TMLExpressionException.class)
public void testFloorWithBogusParameter() {
    FunctionInterface floor = fff.getInstance(cl, "Floor");
    floor.reset();
    floor.insertStringOperand("1.1");
    floor.evaluate();
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Test(org.junit.Test)

Aggregations

FunctionInterface (com.dexels.navajo.expression.api.FunctionInterface)161 Test (org.junit.Test)153 Navajo (com.dexels.navajo.document.Navajo)26 FunctionDefinition (com.dexels.navajo.expression.api.FunctionDefinition)20 ArrayList (java.util.ArrayList)16 Date (java.util.Date)16 Operand (com.dexels.navajo.document.Operand)10 GiveLongTestFunction (com.dexels.navajo.expression.compiled.GiveLongTestFunction)10 TMLExpressionException (com.dexels.navajo.expression.api.TMLExpressionException)7 CapString (com.dexels.navajo.functions.CapString)7 StringReader (java.io.StringReader)5 ContextExpression (com.dexels.navajo.expression.api.ContextExpression)4 AddTestFunction (com.dexels.navajo.expression.compiled.AddTestFunction)4 Binary (com.dexels.navajo.document.types.Binary)3 CheckInteger (com.dexels.navajo.functions.CheckInteger)3 SimpleDateFormat (java.text.SimpleDateFormat)3 List (java.util.List)3 Message (com.dexels.navajo.document.Message)2 Property (com.dexels.navajo.document.Property)2 ClockTime (com.dexels.navajo.document.types.ClockTime)2