-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQueenTest.java
52 lines (43 loc) · 1.05 KB
/
QueenTest.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
import static org.junit.Assert.*;
import org.junit.Test;
public class QueenTest{
Queen queen = new Queen(0,0,0); //Assuming that its at (0,0)
@Test
public void testDiagonal1() {
boolean result = queen.isDiagonal(5,5);
assertEquals(result, true);
}
@Test
public void testDiagonal2() {
boolean result = queen.isDiagonal(0,3);
assertEquals(result, false);
}
@Test
public void testVertical()
{
boolean result = queen.isVertical(0,4);
assertEquals(result, true);
}
@Test
public void testHorizontal()
{
boolean result = queen.isHorizontal(5,0);
assertEquals(result, true);
}
@Test
public void testInBound()
{
boolean result = queen.isInBounds(90,90);
assertEquals(result, false);
}
@Test
public void testIsLegal()
{
boolean result = queen.isMoveLegal(3, 0);
assertEquals(result, true);
result = queen.isMoveLegal(0,5);
assertEquals(result, true);
result = queen.isMoveLegal(5,5);
assertEquals(result, true);
}
}