Skip to content

jv-lambda-calc task completed#288

Open
Gleb-Kreshchuk wants to merge 6 commits into
mate-academy:masterfrom
Gleb-Kreshchuk:master
Open

jv-lambda-calc task completed#288
Gleb-Kreshchuk wants to merge 6 commits into
mate-academy:masterfrom
Gleb-Kreshchuk:master

Conversation

@Gleb-Kreshchuk
Copy link
Copy Markdown

No description provided.

return Math.pow(firstParameter, secondParameter);
case '/':
if (secondParameter == 0) {
throw new IllegalArgumentException("Division by zero");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw new ArithmeticException("Division by zero is not possible!");

Comment on lines +8 to +15
class CalculatorTest {
private static final double DELTA = 0.0001;
private Calculate calculator = new Calculator();

@Test
void additionWithTwoPositiveOperands_Ok() {
double expected = 100.0;
double actual = calculator.calculate(90.0, 10.0, '+');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

создай 1 раз expected and actual и используй их в каждом методе

}

@Test
void additionWithFirstOperandIsZero_Ok() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

измени все названия методов по примеру calculate_additionPositiveAndNegativeOperand_ok

Comment on lines +14 to +15
case '^':
return Math.pow(firstParameter, secondParameter);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а что если первый операнд 0, а второй -2?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

добавлена проверка Double.POSITIVE_INFINITY

# Conflicts:
#	src/main/java/core/basesyntax/Calculator.java
#	src/test/java/core/basesyntax/CalculatorTest.java
# Conflicts:
#	src/main/java/core/basesyntax/Calculator.java
#	src/test/java/core/basesyntax/CalculatorTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants