Skip to content

Commit 0953236

Browse files
authored
Add tests for WordLadder (TheAlgorithms#3668)
1 parent 0a5ee18 commit 0953236

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.thealgorithms.strings;
2+
3+
import static org.junit.jupiter.api.Assertions.*;
4+
5+
import org.junit.jupiter.api.Test;
6+
import java.util.*;
7+
8+
public class WordLadderTest {
9+
10+
@Test
11+
public void testWordLadder() {
12+
String words1[] = { "hot", "dot", "dog", "lot", "log", "cog" };
13+
assertEquals(5, WordLadder.ladderLength("hit", "cog", Arrays.asList(words1)));
14+
String words2[] = { "hot", "dot", "dog", "lot", "log" };
15+
assertEquals(0, WordLadder.ladderLength("hit", "cog", Arrays.asList(words2)));
16+
}
17+
}

0 commit comments

Comments
 (0)