Skip to content

Commit ecaf8cd

Browse files
committed
tests: add StackPostfixNotationTest
1 parent ef4ef42 commit ecaf8cd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.thealgorithms.others;
2+
3+
import static java.util.Map.entry;
4+
import static org.junit.jupiter.api.Assertions.assertEquals;
5+
6+
import java.util.Map;
7+
import org.junit.jupiter.api.Test;
8+
9+
public class StackPostfixNotationTest {
10+
@Test
11+
public void testGetWithNewObject() {
12+
final Map<String, Integer> testCases = Map.ofEntries(entry("1 1 +", 2), entry("2 3 *", 6), entry("6 2 /", 3), entry("5 2 + 3 *", 21));
13+
for (final var tc : testCases.entrySet()) {
14+
assertEquals(tc.getValue(), StackPostfixNotation.postfixEvaluate(tc.getKey()));
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)