Assert.assertEquals(new E_Multiply(new NodeValueInteger(3), new NodeValueInteger(4)), actual);
}
@Test
public void test_function_expansion_04() {
Expr square = new E_Multiply(new ExprVar("x"), new ExprVar("x"));
UserDefinedFunctionFactory.getFactory().add("http://example/square", square, new ArrayList<>(square.getVarsMentioned()));
//Test that with preserveDependencies set to false (the default) that the definition of cube is actually
//expanded to include the definition of square
Expr cube = new E_Multiply(new E_Function("http://example/square", new ExprList(new ExprVar("x"))), new ExprVar("x"));
UserDefinedFunctionFactory.getFactory().add("http://example/cube", cube, new ArrayList<>(cube.getVarsMentioned()));
UserDefinedFunctionDefinition def = UserDefinedFunctionFactory.getFactory().get("http://example/cube");
Expr base = def.getBaseExpr();
Assert.assertTrue(base instanceof E_Multiply);
E_Multiply m = (E_Multiply)base;
Assert.assertTrue(m.getArg1() instanceof E_Multiply);
Assert.assertTrue(m.getArg2() instanceof ExprVar);
Assert.assertEquals(1, base.getVarsMentioned().size());
}