forked from ExplorerJun/java-baseball
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRefereeTest.java
More file actions
53 lines (44 loc) · 1.3 KB
/
RefereeTest.java
File metadata and controls
53 lines (44 loc) · 1.3 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
42
43
44
45
46
47
48
49
50
51
52
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.Arrays;
public class RefereeTest {
private Referee referee;
@Before
public void setUp() throws Exception {
referee = new Referee();
}
@Test
public void judge_usualCases() {
int [] ansBallCombi = {1, 2, 3};
int [][] inpBallCombis = {
{1, 2, 3}, // 3s, 0b
{1, 3, 2}, // 1s, 2b
{2, 1, 3}, // 1s, 2b
{2, 3, 1}, // 0s, 3b
{9, 2, 5}, // 1s, 0b
{3, 4, 5}, // 0s, 1b
{4, 5, 6}, // 0s, 0b
{6, 2, 5}, // 1s, 0b
};
int [][] wants = {
{3, 0},
{1, 2},
{1, 2},
{0, 3},
{1, 0},
{0, 1},
{0, 0},
{1, 0},
};
for (int i = 0; i < wants.length; i++) {
int [] inpBallCombi = inpBallCombis[i];
int [] want = wants[i];
int [] got = referee.judge(ansBallCombi, inpBallCombi);
Assert.assertArrayEquals(String.format("[%d] want: %s, got: %s", i, Arrays.toString(want), Arrays.toString(got)),
want,
got
);
}
}
}