@Test public void testSqrt() { Double x = 81.0; String operation = "sqrt"; Double result = 9.0; Calculation object = new Calculation(); object.calculate(x, operation); assertEquals(result, object.getTotal()); }
@Test public void testAdd() { Double x = 4.0; Double y = 2.0; String operation = "+"; Double result = 6.0; Calculation object = new Calculation(); object.calculate(x, y, operation); assertEquals(result, object.getTotal()); }
@Test public void testCos() { Double x = 90.0; String operation = "cos"; Double result = Math.cos(x); Calculation object = new Calculation(); object.setTotal(x); object.calculate(operation); assertEquals(result, object.getTotal()); }