File tree Expand file tree Collapse file tree
main/java/com/thealgorithms/stacks
test/java/com/thealgorithms/stacks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,9 +44,9 @@ public static boolean isValid(final String str) {
4444 return false ;
4545 }
4646 char top = stack .peek ();
47- if ((top == '(' && ch == ')' ) ||
48- (top == '{' && ch == '}' ) ||
49- (top == '[' && ch == ']' )) {
47+ if ((top == '(' && ch == ')' )
48+ || (top == '{' && ch == '}' )
49+ || (top == '[' && ch == ']' )) {
5050 stack .pop ();
5151 } else {
5252 return false ;
Original file line number Diff line number Diff line change 22
33
44import static org .junit .jupiter .api .Assertions .assertEquals ;
5- import static org .junit .jupiter .api .Assertions .assertThrows ;
6-
75import java .util .stream .Stream ;
86import org .junit .jupiter .params .ParameterizedTest ;
97import org .junit .jupiter .params .provider .Arguments ;
@@ -13,7 +11,7 @@ public class ValidParenthesesTest {
1311
1412 @ ParameterizedTest
1513 @ MethodSource ("provideValidTestCases" )
16- void testIsValid_ValidCases (String input , boolean expected ) {
14+ void testIsValidValidCases (String input , boolean expected ) {
1715 assertEquals (expected , ValidParentheses .isValid (input ));
1816 }
1917
@@ -28,7 +26,7 @@ static Stream<Arguments> provideValidTestCases() {
2826
2927 @ ParameterizedTest
3028 @ MethodSource ("provideInvalidTestCases" )
31- void testIsValid_InvalidCases (String input ) {
29+ void testIsValidInvalidCases (String input ) {
3230 assertEquals (false , ValidParentheses .isValid (input ));
3331 }
3432
You can’t perform that action at this time.
0 commit comments