Skip to content
Snippets Groups Projects
Commit 691a92cc authored by Isak.Graarud's avatar Isak.Graarud
Browse files

compleated all tests

parent b93f4a81
Branches master
No related tags found
No related merge requests found
......@@ -8,7 +8,17 @@ import java.util.Map;
import no.uib.inf101.calculator.expression.BinaryExpression;
import no.uib.inf101.calculator.expression.Expression;
import no.uib.inf101.calculator.expression.UnaryExpression;
import no.uib.inf101.calculator.operations.*;
import no.uib.inf101.calculator.operations.Addition;
import no.uib.inf101.calculator.operations.BinaryOperator;
import no.uib.inf101.calculator.operations.Exponent;
import no.uib.inf101.calculator.operations.Factorial;
import no.uib.inf101.calculator.operations.Ln;
import no.uib.inf101.calculator.operations.Log;
import no.uib.inf101.calculator.operations.Multiplication;
import no.uib.inf101.calculator.operations.Operator;
import no.uib.inf101.calculator.operations.Root;
import no.uib.inf101.calculator.operations.Subtraction;
import no.uib.inf101.calculator.operations.UnaryOperator;
/**
* Represents a calculator that can evaluate mathematical expressions.
......@@ -35,8 +45,8 @@ public class Calculator {
addOperator(new Root());
}
private void addOperator(String operator) {
operators.put(operator.getSymbol(), string);
private void addOperator(Operator operator) {
operators.put(operator.getSymbol(), operator);
}
/**
......
......@@ -40,6 +40,6 @@ public class CalculatorTest {
assertEquals("Factorial: \"The product of an integer and all the integers below it\"", calc.getOperatorDescription("!"));
assertEquals("Logarithm: \"The power to which a given number must be raised to produce 10\"", calc.getOperatorDescription("log"));
assertEquals("Logarithm: \"The power to which e must be raised to produce a given number\"", calc.getOperatorDescription("ln"));
assertEquals("", calc.getOperatorDescription("√"));
assertEquals("Square root: \"A number which produces a specified quantity when multiplied by itself.\"", calc.getOperatorDescription("√"));
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment