Test alphabetical (#2987)

This commit is contained in:
Aldo Telese 2022-03-24 07:03:36 +01:00 committed by GitHub
parent 8b71a15cbb
commit 7d5de041eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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));
}
}