示例#1
0
        public void ErrorCalculatriceAst(string s)
        {
            StringOperations myOper = new StringOperations(s);

            myOper.DisplayList();

            double?result = myOper.EvalTree();

            Assert.IsNull(result);
        }
示例#2
0
        private void BtnComputeClick(object sender, EventArgs e)
        {
            StringOperations myOper = new StringOperations(textBoxOperation.Text);
            double?          result = myOper.EvalTree();

            if (result == null)
            {
                textBoxResult.Text = "Error !";
            }
            else
            {
                textBoxResult.Text = result.ToString();
            }
        }
示例#3
0
        public void TestCalculatriceAst(string s, double r)
        {
            StringOperations myOper = new StringOperations(s);

            myOper.DisplayList();

            double?resultNullable = myOper.EvalTree();

            Assert.NotNull(resultNullable);

            double result = resultNullable.Value;

            Console.WriteLine("resultat : " + result);
            Assert.IsTrue(Math.Abs(r - result) < 1e-8);
        }