Search in sources :

Example 26 with FunctionInterface

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

the class StandardFunctionsTest method testEqualsIgnoreCase.

@Test
public void testEqualsIgnoreCase() {
    FunctionInterface fi = fff.getInstance(cl, "EqualsIgnoreCase");
    fi.reset();
    fi.insertStringOperand("apenoot");
    fi.insertStringOperand("APeNOoT");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals(Boolean.class, o.getClass());
    assertEquals("true", o.toString());
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Test(org.junit.Test)

Example 27 with FunctionInterface

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

the class StandardFunctionsTest method testForAll.

@Test
public void testForAll() {
    FunctionInterface fi = fff.getInstance(cl, "ForAll");
    fi.reset();
    fi.setInMessage(createTestNavajo());
    fi.insertStringOperand("/Aap");
    fi.insertStringOperand("[Noot] != 20");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Test(org.junit.Test)

Example 28 with FunctionInterface

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

the class StandardFunctionsTest method testGetWeekDayDate.

@Test
public void testGetWeekDayDate() {
    FunctionInterface fi = fff.getInstance(cl, "GetWeekDayDate");
    fi.reset();
    fi.insertStringOperand("SUN");
    fi.insertStringOperand("forward");
    fi.insertDateOperand(new Date());
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals(Date.class, o.getClass());
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Date(java.util.Date) Test(org.junit.Test)

Example 29 with FunctionInterface

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

the class StandardFunctionsTest method testToString.

@Test
public void testToString() {
    FunctionInterface fi = fff.getInstance(cl, "ToString");
    fi.reset();
    fi.insertStringOperand("aap");
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals("aap", o.toString());
    fi.reset();
    fi.insertIntegerOperand(Integer.valueOf(10));
    o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals("10", o.toString());
    fi.reset();
    fi.insertFloatOperand(Float.valueOf(10));
    o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals("10.0", o.toString());
}
Also used : FunctionInterface(com.dexels.navajo.expression.api.FunctionInterface) Test(org.junit.Test)

Example 30 with FunctionInterface

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

the class StandardFunctionsTest method testNextMonth.

@Test
public void testNextMonth() {
    FunctionInterface fi = fff.getInstance(cl, "NextMonth");
    fi.reset();
    fi.insertIntegerOperand(0);
    Object o = fi.evaluateWithTypeChecking();
    assertNotNull(o);
    assertEquals(Date.class, o.getClass());
}
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