Skip to content

Commit 7d5de04

Browse files
authored
Test alphabetical (TheAlgorithms#2987)
1 parent 8b71a15 commit 7d5de04

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.thealgorithms.strings;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import static org.junit.jupiter.api.Assertions.*;
6+
7+
8+
public class AlphabeticalTest {
9+
@Test
10+
public void isAlphabetical() {
11+
// expected to be true
12+
String input1 = "abcdefghijklmno";
13+
String input2 = "abcdxxxyzzzz";
14+
String input3 = "fpw";
15+
16+
// expected to be false
17+
String input4 = "123a";
18+
String input5 = "abcABC";
19+
String input6 = "abcdefghikjlmno";
20+
21+
assertTrue(Alphabetical.isAlphabetical(input1));
22+
assertTrue(Alphabetical.isAlphabetical(input2));
23+
assertTrue(Alphabetical.isAlphabetical(input3));
24+
25+
assertFalse(Alphabetical.isAlphabetical(input4));
26+
assertFalse(Alphabetical.isAlphabetical(input5));
27+
assertFalse(Alphabetical.isAlphabetical(input6));
28+
}
29+
30+
}

0 commit comments

Comments
 (0)