-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquareTextViewExamples.java
More file actions
54 lines (43 loc) · 1.34 KB
/
SquareTextViewExamples.java
File metadata and controls
54 lines (43 loc) · 1.34 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
53
54
package cs3500.reversi;
import org.junit.Before;
import org.junit.Test;
import cs3500.reversi.model.CubicPosn;
import cs3500.reversi.model.SquareReversi;
import cs3500.reversi.view.SquareReversiTextualView;
import static org.junit.Assert.assertEquals;
/**
* Testing for the text views of Square Reversi.
*/
public class SquareTextViewExamples {
private SquareReversi game;
private SquareReversiTextualView view;
@Before
public void setup() {
game = new SquareReversi(6);
game.startGame();
view = new SquareReversiTextualView(game);
}
@Test
public void testInitialBoardState() {
String expected =
"_ _ _ _ _ _ \b\n" +
"_ _ _ _ _ _ \b\n" +
"_ _ B W _ _ \b\n" +
"_ _ W B _ _ \b\n" +
"_ _ _ _ _ _ \b\n" +
"_ _ _ _ _ _ \b\n";
assertEquals(expected, view.toString());
}
@Test
public void testAfterOneMove() {
game.placeTile(new CubicPosn(4, 2));
String expected =
"_ _ _ _ _ _ \b\n" +
"_ _ _ _ _ _ \b\n" +
"_ _ B W _ _ \b\n" +
"_ _ W W _ _ \b\n" +
"_ _ _ W _ _ \b\n" +
"_ _ _ _ _ _ \b\n";
assertEquals(expected, view.toString());
}
}