-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRobotInGridPathTest.java
More file actions
41 lines (34 loc) · 1.02 KB
/
Copy pathRobotInGridPathTest.java
File metadata and controls
41 lines (34 loc) · 1.02 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
40
41
package algorithm.cracking.recursive;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class RobotInGridPathTest {
@Test
void findPath() {
int[][] grid = {
{0, 0, 0},
{0, 1, 0},
{0, 1, 0}
};
RobotInGridPath robotInGridPath = new RobotInGridPath();
var path = robotInGridPath.findPaths(grid);
assertEquals(5, path.size());
}
@Test
void findPathWithOtherBlockers() {
int[][] grid = {
{0, 0, 1, 0},
{1, 0, 0, 0},
{1, 1, 1, 0},
{0, 0, 0, 0}
};
RobotInGridPath robotInGridPath = new RobotInGridPath();
var path = robotInGridPath.findPaths(grid);
assertEquals(7, path.size());
}
@Test
void testWithNullGrid() {
RobotInGridPath robotInGridPath = new RobotInGridPath();
var path = robotInGridPath.findPaths(null);
assertEquals(0, path.size());
}
}