-
Notifications
You must be signed in to change notification settings - Fork 0
/
SolutionTest.java
67 lines (54 loc) · 1.62 KB
/
SolutionTest.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
67
package array.rotatesqr;
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.jupiter.api.Test;
public class SolutionTest {
private final Solution solution = new Solution();
@Test
public void rotate_ThreeByThree_Rotated() {
int[][] square = {//@formatter:off
{ 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 }
};//@formatter:on
solution.rotate(square);
assertThat(square).isDeepEqualTo(new int[][] {//@formatter:off
{ 4, 1, 2 },
{ 7, 5, 3 },
{ 8, 9, 6 }
});//@formatter:on
}
@Test
public void rotate_FourByFour_Rotated() {
int[][] square = {//@formatter:off
{ 100, 101, 102, 103 },
{ 111, 200, 201, 104 },
{ 110, 203, 202, 105 },
{ 109, 108, 107, 106 }
};//@formatter:on
solution.rotate(square);
assertThat(square).isDeepEqualTo(new int[][] {//@formatter:off
{ 111, 100, 101, 102 },
{ 110, 203, 200, 103 },
{ 109, 202, 201, 104 },
{ 108, 107, 106, 105}
});//@formatter:on
}
@Test
public void rotate_FiveByFive_Rotated() {
int[][] square = { //@formatter:off
{ 110, 111, 112, 113, 114 },
{ 125, 220, 221, 222, 115 },
{ 124, 227, 999, 223, 116 },
{ 123, 226, 225, 224, 117 },
{ 122, 121, 120, 119, 118 }
};//@formatter:on
solution.rotate(square);
assertThat(square).isDeepEqualTo(new int[][] {//@formatter:off
{ 125, 110, 111, 112, 113 },
{ 124, 227, 220, 221, 114 },
{ 123, 226, 999, 222, 115 },
{ 122, 225, 224, 223, 116 },
{ 121, 120, 119, 118, 117 }
});//@formatter:on
}
}