Skip to content

Commit 04b7ad9

Browse files
committed
test: 후위 표기법으로 작성된 수식을 계산하는 테스트 추가
1 parent c5d88d0 commit 04b7ad9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package stack;
2+
3+
import org.junit.jupiter.api.BeforeEach;
4+
import org.junit.jupiter.api.DisplayName;
5+
import org.junit.jupiter.api.Test;
6+
7+
class PostCalculatorTest {
8+
9+
PostCalculator postCalculator;
10+
11+
@BeforeEach
12+
void setUp() {
13+
postCalculator = new PostCalculator();
14+
}
15+
16+
@Test
17+
@DisplayName("후위_표기법으로_작성된_수식_계산_테스트1")
18+
void 후위_표기법으로_작성된_수식_계산_테스트1() {
19+
char[] input = {'4', '2', '*', '8', '+'};
20+
21+
assertThat(postCalculator.calculate(input)).isEqualTo(16);
22+
}
23+
24+
@Test
25+
@DisplayName("후위_표기법으로_작성된_수식_계산_테스트2")
26+
void 후위_표기법으로_작성된_수식_계산_테스트2() {
27+
char[] input = {'1', '2', '3', '+', '*', '4', '/'};
28+
29+
assertThat(postCalculator.calculate(input)).isEqualTo(1);
30+
}
31+
}

0 commit comments

Comments
 (0)