Add tests for WordLadder (#3668)
This commit is contained in:
parent
0a5ee18079
commit
0953236b4c
17
src/test/java/com/thealgorithms/strings/WordLadderTest.java
Normal file
17
src/test/java/com/thealgorithms/strings/WordLadderTest.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package com.thealgorithms.strings;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class WordLadderTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWordLadder() {
|
||||||
|
String words1[] = { "hot", "dot", "dog", "lot", "log", "cog" };
|
||||||
|
assertEquals(5, WordLadder.ladderLength("hit", "cog", Arrays.asList(words1)));
|
||||||
|
String words2[] = { "hot", "dot", "dog", "lot", "log" };
|
||||||
|
assertEquals(0, WordLadder.ladderLength("hit", "cog", Arrays.asList(words2)));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user