public void Log(double a) { var compiler = new EquationCompiler("log(a)"); compiler.SetVariable("a", a); Assert.AreEqual(Math.Log(a), compiler.Calculate()); }
public static bool BoolValue(string aExpression, Dictionary <string, float> eParams) { aExpression = aExpression.Replace("?", ((int)Random.Range(0, 100)).ToString()); EquationCompiler oCompiler = new EquationCompiler(aExpression); oCompiler.Compile(); if (aExpression.Length > 8) { foreach (KeyValuePair <string, float> pair in eParams) { oCompiler.SetVariable(pair.Key, pair.Value); } } foreach (KeyValuePair <string, float> pair in eParams) { oCompiler.SetVariable(pair.Key, pair.Value); } return(oCompiler.Calculate() == 1); }
public static void AddVariable(string key, double value) { _compiler.SetVariable(key, value); }