mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 22:43:30 +08:00
Add test for Pangram.java (#2986)
This commit is contained in:
24
src/test/java/com/thealgorithms/strings/PangramTest.java
Normal file
24
src/test/java/com/thealgorithms/strings/PangramTest.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package com.thealgorithms.strings;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
|
||||||
|
public class PangramTest {
|
||||||
|
@Test
|
||||||
|
public void isPangram() {
|
||||||
|
String fullAlphabet = "abcdefghijklmnopqrstuvwxyz";
|
||||||
|
String notFullAlphabet = "abcdefghiklmnopqrstuvwxyz";
|
||||||
|
String fullMixedCaseAlphabet = "a BCDE fghIjkLMnop qrSTuv WXYz";
|
||||||
|
String sentence1 = "The quick brown fox jumps over the lazy dog";
|
||||||
|
String sentence2 = "The quick brown fox jumps over the lazy gentleman"; // missing letter d
|
||||||
|
|
||||||
|
assertTrue(Pangram.isPangram(fullAlphabet));
|
||||||
|
assertFalse(Pangram.isPangram(notFullAlphabet));
|
||||||
|
assertTrue(Pangram.isPangram(fullMixedCaseAlphabet));
|
||||||
|
assertTrue(Pangram.isPangram(sentence1));
|
||||||
|
assertFalse(Pangram.isPangram(sentence2));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user