use of com.yahoo.bullet.query.expressions.NAryExpression in project bullet-core by yahoo.
the class NAryEvaluatorTest method testConstructor.
@Test
public void testConstructor() {
NAryExpression expression = new NAryExpression(Arrays.asList(new ValueExpression(false), new ValueExpression(1), new ValueExpression(2)), Operation.IF);
expression.setType(Type.INTEGER);
NAryEvaluator evaluator = new NAryEvaluator(expression);
Assert.assertTrue(evaluator.operands.get(0) instanceof ValueEvaluator);
Assert.assertTrue(evaluator.operands.get(1) instanceof ValueEvaluator);
Assert.assertTrue(evaluator.operands.get(2) instanceof ValueEvaluator);
Assert.assertEquals(evaluator.op, N_ARY_OPERATORS.get(Operation.IF));
Assert.assertEquals(evaluator.evaluate(RecordBox.get().getRecord()), new TypedObject(Type.INTEGER, 2));
}
Aggregations