Add tests for WordLadder (#3668)

This commit is contained in:
Harshal 2022-10-26 12:48:33 +05:30 committed by GitHub
parent 0a5ee18079
commit 0953236b4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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