public void CalculateTest(double firstValue, double secondValue, double expected) { var calculator = new Pow(); var actualResult = calculator.Calculate(firstValue, secondValue); Assert.AreEqual(expected, actualResult); }
public void Calculate(double firstArgument, double secondArgument, double result) { var calculator = new Pow(); var testresult = calculator.Calculate(firstArgument, secondArgument); Assert.AreEqual(result, testresult); }
public void CalculateTest(double argument, double secondArgument, double result) { var calculator = new Pow(); var testResult = calculator.Calculate(argument, secondArgument); Assert.AreEqual(testResult, result); }
public void CalculateTest(double firstArgument, double secondArgument, double result, double accracy) { var testingFunction = new Pow(); var testResult = testingFunction.Calculate(firstArgument, secondArgument); Assert.AreEqual(result, testResult, accracy); }
public void CalculateAdditionTestStrong(double firstValue, double secondValue, double expected) { ITwoArgumentsCalculator calculator = new Pow(); double result = calculator.Calculate(5, 2); Assert.AreEqual(25, result); }
public void TestCalulate() { Pow operation = new Pow(); var answer = operation.Calculate(3.0, 2.0); Assert.AreEqual(9.0, answer, 1e-9); }
public static double Calculate(List <string> input) { Stack <double> numbers = new Stack <double>(); double value = 0.0; for (int i = 0; i < input.Count; i++) { if (input[i][0] >= '0' && input[i][0] <= '9') { numbers.Push(double.Parse(input[i])); } else if (OperationsCollection.Arithmetics.Contains(input[i])) { IArithmeticOperator arithmeticOperator = null; value = numbers.Pop(); double secValue = numbers.Pop(); double result = 0.0; switch (input[i]) { case "+": arithmeticOperator = new Plus(); result = arithmeticOperator.Calculate(secValue, value); break; case "-": arithmeticOperator = new Minus(); result = (arithmeticOperator.Calculate(secValue, value)); break; case "*": arithmeticOperator = new Multiplication(); result = arithmeticOperator.Calculate(secValue, value); break; case "/": arithmeticOperator = new Division(); result = arithmeticOperator.Calculate(secValue, value); break; case "%": arithmeticOperator = new Remainder(); result = arithmeticOperator.Calculate(secValue, value); break; case "^": arithmeticOperator = new Pow(); result = arithmeticOperator.Calculate(secValue, value); break;; } numbers.Push(result); } else if (OperationsCollection.Functions.Contains(input[i])) { IFunctionOperator functionOperator = null; value = numbers.Pop(); switch (input[i]) { case "sin": functionOperator = new Sin(); break; case "cos": functionOperator = new Cos(); break; case "tang": functionOperator = new Tang(); break; case "cotang": functionOperator = new CoTang(); break; case "sqrt": functionOperator = new Sqrt(); break; case "ln": numbers.Push(Math.Log(value)); break; case "log": numbers.Push(Math.Log10(value)); break; } if (functionOperator != null) { double result = functionOperator.Calculate(value); numbers.Push(result); } } } return(numbers.Pop()); }