public static void TestUndefinedVariablePolicies()
{
ExpressionSolver solver = new ExpressionSolver();
try
{
solver.SymbolicateExpression("test");
throw new System.Exception("ExpressionSolverTest failed");
}
catch (AK.ESUnknownExpressionException)
{
// Expected behaviour
}
solver.undefinedVariablePolicy = ExpressionSolver.UndefinedVariablePolicy.DefineGlobalVariable;
var exp2 = solver.SymbolicateExpression("test2");
AssertSameValue(solver.GetGlobalVariable("test2").value,0);
AssertSameValue(exp2.Evaluate(),0);
solver.undefinedVariablePolicy = ExpressionSolver.UndefinedVariablePolicy.DefineExpressionLocalVariable;
var exp3 = solver.SymbolicateExpression("sin(test3)");
var test3 = exp3.GetVariable("test3");
AssertSameValue(test3.value,0);
test3.value = System.Math.PI/2;
AssertSameValue(exp3.Evaluate(),1);
}