Example #1
0
        public void Log(double a)
        {
            var compiler = new EquationCompiler("log(a)");

            compiler.SetVariable("a", a);

            Assert.AreEqual(Math.Log(a), compiler.Calculate());
        }
Example #2
0
    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);
    }
Example #3
0
 public static void AddVariable(string key, double value)
 {
     _compiler.SetVariable(key, value);
 }