forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWordSearchTest.java
More file actions
32 lines (27 loc) · 954 Bytes
/
WordSearchTest.java
File metadata and controls
32 lines (27 loc) · 954 Bytes
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
package com.thealgorithms.backtracking;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class WordSearchTest {
@Test
void test1() {
WordSearch ws = new WordSearch();
char[][] board = {{'A', 'B', 'C', 'E'}, {'S', 'F', 'C', 'S'}, {'A', 'D', 'E', 'E'}};
String word = "ABCCED";
assertTrue(ws.exist(board, word));
}
@Test
void test2() {
WordSearch ws = new WordSearch();
char[][] board = {{'A', 'B', 'C', 'E'}, {'S', 'F', 'C', 'S'}, {'A', 'D', 'E', 'E'}};
String word = "SEE";
assertTrue(ws.exist(board, word));
}
@Test
void test3() {
WordSearch ws = new WordSearch();
char[][] board = {{'A', 'B', 'C', 'E'}, {'S', 'F', 'C', 'S'}, {'A', 'D', 'E', 'E'}};
String word = "ABCB";
Assertions.assertFalse(ws.exist(board, word));
}
}