Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

2회차 과제 PR (차준혁) #20

Open
wants to merge 4 commits into
base: JunHyeok-Cha
Choose a base branch
from

Conversation

JunHyeok-Cha
Copy link

문자열 사칙 연산 계산기 구현 & 테스트

문자열 사칙 연산 계산기 구현
문자열 사칙 연산 계산기 테스트
@JunHyeok-Cha
Copy link
Author

SetTest와 StringTest 파일을 삭제 한 것은 기존에 경로를 잘못 저장했던 파일을 삭제 한 것입니다.

Comment on lines +23 to +40
public int partCalculate(String operator, int result, String input){

if(input == null || input.equals("")) throw new IllegalArgumentException();

switch (operator){
case "+":
return plus(result, input);
case "-":
return minus(result, input);
case "*":
return multiply(result, input);
case "/":
return division(result, input);
default:
throw new IllegalArgumentException();
}

}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Enum 과 BiFunction을 활용하는 방식을 적용해 볼 수 있습니다.
Operator로직을 별도의 클래스로 분리해보세요.

Copy link
Collaborator

Choose a reason for hiding this comment

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

return minus(result, input); 이 코드는 테스트 코드에서 수행되지 않았습니다.
minus 의 경우도 테스트 되도록 테스트 코드를 보완해주세요.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants