public void ErrorCalculatriceAst(string s) { StringOperations myOper = new StringOperations(s); myOper.DisplayList(); double?result = myOper.EvalTree(); Assert.IsNull(result); }
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(); } }
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); }