Skip to content

Commit 7c1940e

Browse files
Add test cases for strings ending with non-letter to fix coverage
1 parent 1ea9f49 commit 7c1940e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/test/java/com/thealgorithms/strings/AlphabeticalTest.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,23 @@
88
public class AlphabeticalTest {
99

1010
@ParameterizedTest(name = "\"{0}\" → Expected: {1}")
11-
@CsvSource({"'abcdefghijklmno', true", "'abcdxxxyzzzz', true", "'123a', false", "'abcABC', false", "'abcdefghikjlmno', false", "'aBC', true", "'abc', true", "'xyzabc', false", "'abcxyz', true", "'', false", "'1', false"})
11+
@CsvSource({
12+
"'abcdefghijklmno', true",
13+
"'abcdxxxyzzzz', true",
14+
"'123a', false",
15+
"'abcABC', false",
16+
"'abcdefghikjlmno', false",
17+
"'aBC', true",
18+
"'abc', true",
19+
"'xyzabc', false",
20+
"'abcxyz', true",
21+
"'', false",
22+
"'1', false",
23+
"'abc!', false", // <--- string ending with non-letter
24+
"'ABc1', false" // <--- another example
25+
})
1226
void testIsAlphabetical(String input, boolean expected) {
1327
assertEquals(expected, Alphabetical.isAlphabetical(input));
1428
}
29+
1530
}

0 commit comments

Comments
 (0)