File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
src/test/java/com/thealgorithms/stacks Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .thealgorithms .stacks ;
2+
3+ import static org .junit .jupiter .api .Assertions .assertFalse ;
4+ import static org .junit .jupiter .api .Assertions .assertTrue ;
5+
6+ import org .junit .jupiter .api .Test ;
7+
8+ class ValidParenthesesTest {
9+
10+ @ Test
11+ void testValidParentheses () {
12+ assertTrue (ValidParentheses .isValid ("()" ));
13+ assertTrue (ValidParentheses .isValid ("()[]{}" ));
14+ assertTrue (ValidParentheses .isValid ("{[]}" ));
15+ assertTrue (ValidParentheses .isValid ("" ));
16+ }
17+
18+ @ Test
19+ void testInvalidParentheses () {
20+ assertFalse (ValidParentheses .isValid ("(]" ));
21+ assertFalse (ValidParentheses .isValid ("([)]" ));
22+ assertFalse (ValidParentheses .isValid ("{{{" ));
23+ assertFalse (ValidParentheses .isValid ("}" ));
24+ assertFalse (ValidParentheses .isValid ("(" ));
25+ }
26+
27+ @ Test
28+ void testNullAndOddLength () {
29+ assertFalse (ValidParentheses .isValid (null ));
30+ assertFalse (ValidParentheses .isValid ("(()" ));
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments