public void Variables(double x, double y) { Terminal op1 = new Terminal("x0"); Terminal op2 = new Terminal("x1"); Mult m = new Mult(op1, op2); Div d = new Div(op1, op2); Addition a = new Addition(op1, op2); Subtraction s = new Subtraction(op1, op2); Assert.True(m.Compute(x, y) == x * y); Assert.True(d.Compute(x, y) == x / y); Assert.True(a.Compute(x, y) == x + y); Assert.True(s.Compute(x, y) == x - y); }
public void Constants(string x1, string x2, double r1, double r2) { Terminal op1 = new Terminal(x1); Terminal op2 = new Terminal(x2); Mult m = new Mult(op1, op2); Div d = new Div(op1, op2); Addition a = new Addition(op1, op2); Subtraction s = new Subtraction(op1, op2); Assert.True(m.Compute(0) == r1 * r2); Assert.True(a.Compute(0) == r1 + r2); Assert.True(s.Compute(0) == r1 - r2); Assert.True(d.Compute(0) == r1 / r2); }