forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDuplicateBracketsTest.java
More file actions
29 lines (23 loc) · 939 Bytes
/
Copy pathDuplicateBracketsTest.java
File metadata and controls
29 lines (23 loc) · 939 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
package com.thealgorithms.stacks;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
class DuplicateBracketsTest {
@ParameterizedTest
@CsvSource({"'((a + b) + (c + d))'", "'(a + b)'", "'a + b'", "'('", "''"})
void testInputReturnsFalse(String input) {
assertFalse(DuplicateBrackets.check(input));
}
@ParameterizedTest
@CsvSource({"'(a + b) + ((c + d))'", "'((a + b))'", "'((((a + b)))))'"})
void testInputReturnsTrue(String input) {
assertTrue(DuplicateBrackets.check(input));
}
@Test
void testInvalidInput() {
assertThrows(IllegalArgumentException.class, () -> DuplicateBrackets.check(null));
}
}