-
-
Notifications
You must be signed in to change notification settings - Fork 312
Expand file tree
/
Copy pathShortestWordDistanceIIITest.java
More file actions
39 lines (29 loc) · 1.25 KB
/
ShortestWordDistanceIIITest.java
File metadata and controls
39 lines (29 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class ShortestWordDistanceIIITest {
@Test
void testDifferentWordsAdjacent() {
String[] words = {"practice", "makes", "perfect", "coding", "makes"};
assertEquals(1, ShortestWordDistanceIII.findShortestDistance(words, "makes", "coding"));
}
@Test
void testDifferentWordsNotAdjacent() {
String[] words = {"practice", "makes", "perfect", "coding", "makes"};
assertEquals(3, ShortestWordDistanceIII.findShortestDistance(words, "practice", "coding"));
}
@Test
void testSameWords() {
String[] words = {"practice", "makes", "perfect", "coding", "makes"};
assertEquals(3, ShortestWordDistanceIII.findShortestDistance(words, "makes", "makes"));
}
@Test
void testWord1BeforeWord2() {
String[] words = {"practice", "makes", "perfect", "coding", "makes"};
assertEquals(1, ShortestWordDistanceIII.findShortestDistance(words, "makes", "perfect"));
}
@Test
void testWord2BeforeWord1() {
String[] words = {"practice", "makes", "perfect", "coding", "makes"};
assertEquals(1, ShortestWordDistanceIII.findShortestDistance(words, "perfect", "makes"));
}
}