Skip to content

Commit 8b71a15

Browse files
authored
Add test for Pangram.java (TheAlgorithms#2986)
1 parent 1d5d672 commit 8b71a15

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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 PangramTest {
9+
@Test
10+
public void isPangram() {
11+
String fullAlphabet = "abcdefghijklmnopqrstuvwxyz";
12+
String notFullAlphabet = "abcdefghiklmnopqrstuvwxyz";
13+
String fullMixedCaseAlphabet = "a BCDE fghIjkLMnop qrSTuv WXYz";
14+
String sentence1 = "The quick brown fox jumps over the lazy dog";
15+
String sentence2 = "The quick brown fox jumps over the lazy gentleman"; // missing letter d
16+
17+
assertTrue(Pangram.isPangram(fullAlphabet));
18+
assertFalse(Pangram.isPangram(notFullAlphabet));
19+
assertTrue(Pangram.isPangram(fullMixedCaseAlphabet));
20+
assertTrue(Pangram.isPangram(sentence1));
21+
assertFalse(Pangram.isPangram(sentence2));
22+
23+
}
24+
}

0 commit comments

Comments
 (0)