use of org.teiid.language.Expression in project teiid by teiid.
the class TestModFunctionModifier method testOneIntElemOneIntConst5.
/**
* Test {@link ModFunctionModifier#modify(Function)} to validate a call to
* e1 % y using a {@link Integer} element and a {@link Integer} constant for
* parameters returns (e1 % y). {@link ModFunctionModifier} will be
* constructed with a function name of "%" and no supported type list.
*
* @throws Exception
*/
public void testOneIntElemOneIntConst5() throws Exception {
Expression[] args = new Expression[] { // $NON-NLS-1$
LANG_FACTORY.createColumnReference("e1", null, null, Integer.class), LANG_FACTORY.createLiteral(new Integer(6), Integer.class) };
// % / default
// $NON-NLS-1$ //$NON-NLS-2$
helpTestMod("%", args, "(e1 % 6)");
}
use of org.teiid.language.Expression in project teiid by teiid.
the class TestModFunctionModifier method testTwoBigDecConst.
/**
* Test {@link ModFunctionModifier#modify(Function)} to validate a call to
* MOD(x,y) using {@link BigDecimal} constants for both parameters returns
* (x - (TRUNC((x / y), 0) * y)). {@link ModFunctionModifier} will be
* constructed without specifying a function name or a supported type list.
*
* @throws Exception
*/
public void testTwoBigDecConst() throws Exception {
Expression[] args = new Expression[] { // $NON-NLS-1$
LANG_FACTORY.createLiteral(new BigDecimal("10"), BigDecimal.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral(new BigDecimal("6"), BigDecimal.class) };
// $NON-NLS-1$
helpTestMod(args, "(10 - (sign(10) * floor(abs((10 / 6))) * abs(6)))");
}
use of org.teiid.language.Expression in project teiid by teiid.
the class TestModFunctionModifier method testTwoIntConst.
/**
* Test {@link ModFunctionModifier#modify(Function)} to validate a call to
* MOD(x,y) using {@link Integer} constants for both parameters returns
* MOD(x,y). {@link ModFunctionModifier} will be constructed without
* specifying a function name or a supported type list.
*
* @throws Exception
*/
public void testTwoIntConst() throws Exception {
Expression[] args = new Expression[] { LANG_FACTORY.createLiteral(new Integer(10), Integer.class), LANG_FACTORY.createLiteral(new Integer(6), Integer.class) };
// default / default
// $NON-NLS-1$
helpTestMod(args, "MOD(10, 6)");
}
use of org.teiid.language.Expression in project teiid by teiid.
the class TestModFunctionModifier method testOneIntElemOneIntConst.
/**
* Test {@link ModFunctionModifier#modify(Function)} to validate a call to
* MOD(e1,y) using a {@link Integer} element and a {@link Integer} constant
* for parameters returns MOD(e1,y). {@link ModFunctionModifier} will be
* constructed without specifying a function name or a supported type list.
*
* @throws Exception
*/
public void testOneIntElemOneIntConst() throws Exception {
Expression[] args = new Expression[] { // $NON-NLS-1$
LANG_FACTORY.createColumnReference("e1", null, null, Integer.class), LANG_FACTORY.createLiteral(new Integer(6), Integer.class) };
// $NON-NLS-1$
helpTestMod(args, "MOD(e1, 6)");
}
use of org.teiid.language.Expression in project teiid by teiid.
the class TestModFunctionModifier method testTwoIntConst5.
/**
* Test {@link ModFunctionModifier#modify(Function)} to validate a call to
* x % y using {@link Integer} constants for both parameters returns (x % y).
* {@link ModFunctionModifier} will be constructed with a function name of
* "%" and no supported type list.
*
* @throws Exception
*/
public void testTwoIntConst5() throws Exception {
Expression[] args = new Expression[] { LANG_FACTORY.createLiteral(new Integer(10), Integer.class), LANG_FACTORY.createLiteral(new Integer(6), Integer.class) };
// $NON-NLS-1$ //$NON-NLS-2$
helpTestMod("%", args, "(10 % 6)");
}
Aggregations