-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.java
66 lines (61 loc) · 1.46 KB
/
test.java
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.runners.JUnit4;
// TODO: Replace examples and use TDD development by writing your own tests
public class SolutionTest {
@Test
public void testSolvePuzzle () {
int[][] clues = {
{3, 2, 2, 3, 2, 1,
1, 2, 3, 3, 2, 2,
5, 1, 2, 2, 4, 3,
3, 2, 1, 2, 2, 4},
{0, 0, 0, 2, 2, 0,
0, 0, 0, 6, 3, 0,
0, 4, 0, 0, 0, 0,
4, 4, 0, 3, 0, 0},
{0, 3, 0, 5, 3, 4,
0, 0, 0, 0, 0, 1,
0, 3, 0, 3, 2, 3,
3, 2, 0, 3, 1, 0};,
{0, 3, 0, 3, 2, 3,
3, 2, 0, 3, 1, 0,
0, 3, 0, 5, 3, 4,
0, 0, 0, 0, 0, 1}};
int[][][] outcomes = {
{2, 1, 4, 3, 5, 6},
{1, 6, 3, 2, 4, 5},
{4, 3, 6, 5, 1, 2},
{6, 5, 2, 1, 3, 4},
{5, 4, 1, 6, 2, 3},
{3, 2, 5, 4, 6, 1}
},
{
{5, 6, 1, 4, 3, 2},
{4, 1, 3, 2, 6, 5},
{2, 3, 6, 1, 5, 4},
{6, 5, 4, 3, 2, 1},
{1, 2, 5, 6, 4, 3},
{3, 4, 2, 5, 1, 6}
},
{
{5, 2, 6, 1, 4, 3},
{6, 4, 3, 2, 5, 1},
{3, 1, 5, 4, 6, 2},
{2, 6, 1, 5, 3, 4},
{4, 3, 2, 6, 1, 5},
{1, 5, 4, 3, 2, 6}
},
{
{6, 2, 3, 4, 5, 1},
{5, 1, 6, 2, 3, 4},
{4, 3, 5, 1, 6, 2},
{2, 6, 4, 5, 1, 3},
{1, 5, 2, 3, 4, 6},
{3, 4, 1, 6, 2, 5}
};
for (int i = 0; i < clues.length; i++) {
assertEquals(outcomes[i], SkyScrapers.solvePuzzle(clues[i]));
}
}
}