Test alphabetical (#2987)
This commit is contained in:
parent
8b71a15cbb
commit
7d5de041eb
@ -0,0 +1,30 @@
|
|||||||
|
package com.thealgorithms.strings;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
|
||||||
|
public class AlphabeticalTest {
|
||||||
|
@Test
|
||||||
|
public void isAlphabetical() {
|
||||||
|
// expected to be true
|
||||||
|
String input1 = "abcdefghijklmno";
|
||||||
|
String input2 = "abcdxxxyzzzz";
|
||||||
|
String input3 = "fpw";
|
||||||
|
|
||||||
|
// expected to be false
|
||||||
|
String input4 = "123a";
|
||||||
|
String input5 = "abcABC";
|
||||||
|
String input6 = "abcdefghikjlmno";
|
||||||
|
|
||||||
|
assertTrue(Alphabetical.isAlphabetical(input1));
|
||||||
|
assertTrue(Alphabetical.isAlphabetical(input2));
|
||||||
|
assertTrue(Alphabetical.isAlphabetical(input3));
|
||||||
|
|
||||||
|
assertFalse(Alphabetical.isAlphabetical(input4));
|
||||||
|
assertFalse(Alphabetical.isAlphabetical(input5));
|
||||||
|
assertFalse(Alphabetical.isAlphabetical(input6));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user