forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValidParenthesesTest.java
More file actions
32 lines (26 loc) · 962 Bytes
/
ValidParenthesesTest.java
File metadata and controls
32 lines (26 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.thealgorithms.stacks;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
class ValidParenthesesTest {
@Test
void testValidParentheses() {
assertTrue(ValidParentheses.isValid("()"));
assertTrue(ValidParentheses.isValid("()[]{}"));
assertTrue(ValidParentheses.isValid("{[]}"));
assertTrue(ValidParentheses.isValid(""));
}
@Test
void testInvalidParentheses() {
assertFalse(ValidParentheses.isValid("(]"));
assertFalse(ValidParentheses.isValid("([)]"));
assertFalse(ValidParentheses.isValid("{{{"));
assertFalse(ValidParentheses.isValid("}"));
assertFalse(ValidParentheses.isValid("("));
}
@Test
void testNullAndOddLength() {
assertFalse(ValidParentheses.isValid(null));
assertFalse(ValidParentheses.isValid("(()"));
}
}