-
Notifications
You must be signed in to change notification settings - Fork 0
/
MoveTest.java
63 lines (51 loc) · 1.84 KB
/
MoveTest.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
/* Skeleton code copyright (C) 2008, 2022 Paul N. Hilfinger and the
* Regents of the University of California. Do not distribute this or any
* derivative work without permission. */
package ataxx;
import org.junit.Test;
import static org.junit.Assert.*;
import static ataxx.Move.*;
/** Test Move creation.
* @author P. N. Hilfinger
*/
public class MoveTest {
@Test
public void testPass() {
assertTrue("bad pass", pass() != null && pass().isPass());
assertEquals("bad pass string", "-", pass().toString());
}
@Test
public void testMove() {
Move m = move('a', '3', 'b', '2');
assertNotNull(m);
assertFalse("move is pass", m.isPass());
assertTrue("move not extend", m.isExtend());
assertFalse("move is jump", m.isJump());
Move m1 = move('g', '1', 'g', '2');
assertNotNull(m1);
assertFalse("move is pass", m1.isPass());
assertTrue("move not extend", m1.isExtend());
assertFalse("move is jump", m1.isJump());
}
@Test
public void testJump() {
Move m = move('a', '3', 'a', '5');
assertNotNull(m);
assertFalse("move is pass", m.isPass());
assertFalse("move is extend", m.isExtend());
assertTrue("move not jump", m.isJump());
Move m1 = move('g', '1', 'e', '3');
assertNotNull(m1);
assertFalse("move is pass", m1.isPass());
assertFalse("move is extend", m1.isExtend());
assertTrue("move not jump", m1.isJump());
}
@Test
public void testToString() {
Move m = move('a', '3', 'a', '5');
assertEquals("wrong string for a3-a5", "a3-a5", m.toString());
Move m1 = move('g', '1', 'e', '3');
assertEquals("wrong string for g1-e3", "g1-e3", m1.toString());
assertEquals("wrong string for pass", "-", pass().toString());
}
}