-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestMinefield.java
42 lines (35 loc) · 946 Bytes
/
TestMinefield.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
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
public class TestMinefield {
private Minefield minefield;
@Before
public void setUp() throws Exception {
minefield = new Minefield(2, 2, 2, 0, 0);
}
@After
public void tearDown() throws Exception {
minefield = null;
}
// getMineVal
@Test
public void Test_getMineVal() {
assertEquals(minefield.getMineVal(), -1);
}
// getCellVal
@Test
public void Test_getCellVal_2NearbyMines() {
assertEquals(minefield.getCellVal(0), 2);
}
@Test
public void Test_getCellVal_Empty() {
minefield = new Minefield(2, 2, 0, 0, 0);
assertEquals(minefield.getCellVal(0), 0);
}
@Test
public void Test_getCellVal_Mine() {
minefield = new Minefield(2, 2, 3, 0, 0);
assertEquals(minefield.getCellVal(1), -1);
}
}