public void Double_Exposant_SepIsDot_true() { ExpressionEval evaluator = new ExpressionEval(); // definir langue: fr ou en, sert pour les opérateurs: ET/AND, OU/OR, NON/NOT. evaluator.SetLang(Language.En); //evaluator.SetDoubleDecimalSeparator(ExpressionEvalDef.DoubleDecimalSeparator.Dot); string expr = "(a = 12.45E3)"; ParseResult parseResult = evaluator.Parse(expr); Assert.IsFalse(parseResult.HasError, "the parse should finish successfully"); //====2/prepare the execution, provide all used variables: type and value //ExprExecResult execResult = evaluator.InitExec(); evaluator.DefineVarDouble("a", 12.45E3); //====3/execute l'expression booléenne ExecResult execResult = evaluator.Exec(); Assert.AreEqual(false, execResult.HasError, "The exec of the expression should finish with success"); // check the final result value Assert.IsTrue(execResult.ResultBool, "The result value should be true"); }
public static void a_Eq_123E5_true() { string expr = "a=123E5"; Console.WriteLine("\n====The expression is: " + expr); ExpressionEval evaluator = new ExpressionEval(); //====1/decode the expression evaluator.Parse(expr); //====2/prepare the execution, provide all used variables: type and value, remove the previous result Console.WriteLine("Define variables: a:=123E5"); evaluator.DefineVarDouble("a", 123E5); //====3/Execute the expression ExecResult execResult = evaluator.Exec(); //====4/get the result, its a bool value Console.WriteLine("Execution Result: " + execResult.ResultBool); }