-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquareTest.java
More file actions
47 lines (38 loc) · 1.19 KB
/
Copy pathSquareTest.java
File metadata and controls
47 lines (38 loc) · 1.19 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
package amazons;
import org.junit.Test;
import ucb.junit.textui;
import static org.junit.Assert.assertEquals;
/** The suite of all JUnit tests for the amazons package.
* @author Khang and Paul.
*/
public class SquareTest {
/**
* Run the JUnit tests in this package. Add xxxTest.class entries to
* the arguments of runClasses to run other JUnit tests.
*/
public static void main(String[] ignored) {
textui.runClasses(UnitTest.class);
}
/**
* Tests basic correctness of put and get on the initialized board.
*/
@Test
public void testqueenMove() {
assertEquals(Square.sq(2, 4).queenMove(0, 2), Square.sq(2, 6));
}
@Test
public void direction() {
assertEquals(Square.sq(2, 4).direction(Square.sq(2, 6)), 0);
assertEquals(Square.sq(2, 4).direction(Square.sq(1, 4)), 6);
}
@Test
public void queenMove() {
assertEquals(Square.sq(2, 4).queenMove(2, 1), Square.sq(3, 4));
assertEquals(Square.sq(5, 5).queenMove(5, 2), Square.sq(3, 3));
}
@Test
public void sq() {
assertEquals(Square.sq(0, 0), Square.sq("a1"));
assertEquals(Square.sq(3, 4), Square.sq("d5"));
}
}