mirror of
https://github.com/TheAlgorithms/Java.git
synced 2026-03-13 08:40:43 +08:00
16 lines
588 B
Java
16 lines
588 B
Java
package com.thealgorithms.strings;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
import org.junit.jupiter.params.ParameterizedTest;
|
|
import org.junit.jupiter.params.provider.CsvSource;
|
|
|
|
public class ValidParenthesesTest {
|
|
|
|
@ParameterizedTest(name = "Input: \"{0}\" → Expected: {1}")
|
|
@CsvSource({"'()', true", "'()[]{}', true", "'(]', false", "'{[]}', true", "'([{}])', true", "'([)]', false", "'', true", "'(', false", "')', false"})
|
|
void testIsValid(String input, boolean expected) {
|
|
assertEquals(expected, ValidParentheses.isValid(input));
|
|
}
|
|
}
|