|
@@ -11,34 +11,35 @@ public class SolitaireTest {
|
11
|
11
|
Solitaire s = new Solitaire(new Player("Murphy"));
|
12
|
12
|
|
13
|
13
|
@Test
|
14
|
|
- public void testfind(){
|
|
14
|
+ public void testfind() {
|
15
|
15
|
s.resetDeck();
|
16
|
16
|
s.tab1.add(toCard("Ace", "Hearts"));
|
17
|
|
- s.tab2.add(toCard("five","diamonds"));
|
|
17
|
+ s.tab2.add(toCard("five", "diamonds"));
|
18
|
18
|
|
19
|
|
- System.out.println(s.findTab(toCard("Ace","Hearts")).stack.peek());
|
|
19
|
+ System.out.println(s.findTab(toCard("Ace", "Hearts")).stack.peek());
|
20
|
20
|
}
|
|
21
|
+
|
21
|
22
|
@Test
|
22
|
|
- public void testPull(){
|
|
23
|
+ public void testPull() {
|
23
|
24
|
s.resetDeck();
|
24
|
25
|
s.tab1.add(toCard("Ace", "Hearts"));
|
25
|
|
- s.tab2.add(toCard("five","diamonds"));
|
|
26
|
+ s.tab2.add(toCard("five", "diamonds"));
|
26
|
27
|
|
27
|
28
|
Integer preSize = s.tab1.size();
|
28
|
|
- s.pull(toCard("Ace","Hearts")); //main method tested
|
|
29
|
+ s.pull(toCard("Ace", "Hearts")); //main method tested
|
29
|
30
|
Integer postSize = s.tab1.size();
|
30
|
31
|
|
31
|
32
|
Integer actual = preSize - postSize;
|
32
|
33
|
Integer expected = 1;
|
33
|
34
|
|
34
|
|
- Assert.assertEquals(expected,actual);
|
|
35
|
+ Assert.assertEquals(expected, actual);
|
35
|
36
|
}
|
36
|
37
|
|
37
|
38
|
@Test
|
38
|
39
|
public void drawCard() {
|
39
|
40
|
s.drawCard();
|
40
|
41
|
System.out.println(s.wastePile.peek().toString());
|
41
|
|
- Assert.assertEquals(1,s.wastePile.size());
|
|
42
|
+ Assert.assertEquals(1, s.wastePile.size());
|
42
|
43
|
}
|
43
|
44
|
|
44
|
45
|
@Test
|
|
@@ -53,14 +54,15 @@ public class SolitaireTest {
|
53
|
54
|
}
|
54
|
55
|
|
55
|
56
|
@Test
|
56
|
|
- public void testDeal(){
|
|
57
|
+ public void testDeal() {
|
57
|
58
|
s.resetDeck();
|
58
|
59
|
s.deal();
|
59
|
|
- int i=0;
|
60
|
|
- for (Tableau tab : s.arrayTabs){
|
61
|
|
- System.out.println("tab " + i); i++;
|
|
60
|
+ int i = 0;
|
|
61
|
+ for (Tableau tab : s.arrayTabs) {
|
|
62
|
+ System.out.println("tab " + i);
|
|
63
|
+ i++;
|
62
|
64
|
tab.stack.forEach(e -> System.out.println(e));
|
63
|
|
-
|
|
65
|
+ }
|
64
|
66
|
Assert.assertTrue(s.arrayTabs[0].size() == 1);
|
65
|
67
|
Assert.assertTrue(s.arrayTabs[1].size() == 2);
|
66
|
68
|
Assert.assertTrue(s.arrayTabs[2].size() == 3);
|
|
@@ -68,12 +70,25 @@ public class SolitaireTest {
|
68
|
70
|
Assert.assertTrue(s.arrayTabs[4].size() == 5);
|
69
|
71
|
Assert.assertTrue(s.arrayTabs[5].size() == 6);
|
70
|
72
|
Assert.assertTrue(s.arrayTabs[6].size() == 7);
|
71
|
|
- Assert.assertTrue(s.solitaireDeck.deckOfCards.size() == (52-28));
|
72
|
|
- }
|
|
73
|
+ Assert.assertTrue(s.solitaireDeck.deckOfCards.size() == (52 - 28));
|
73
|
74
|
}
|
74
|
75
|
|
75
|
76
|
@Test
|
76
|
|
- public void testCoverage(){
|
77
|
|
-
|
|
77
|
+ public void testCoverage() {
|
|
78
|
+ s.resetDeck();
|
|
79
|
+ s.deal();
|
|
80
|
+ int i = 0;
|
|
81
|
+ for (Tableau tab : s.arrayTabs) {
|
|
82
|
+ System.out.println("tab " + i);
|
|
83
|
+ i++;
|
|
84
|
+ tab.stack.forEach(e -> System.out.println(e + " " + e.isCovered()));
|
|
85
|
+ }
|
|
86
|
+ Assert.assertFalse(s.arrayTabs[0].stack.peek().isCovered());
|
|
87
|
+ Assert.assertFalse(s.arrayTabs[1].stack.peek().isCovered());
|
|
88
|
+ Assert.assertFalse(s.arrayTabs[2].stack.peek().isCovered());
|
|
89
|
+ Assert.assertFalse(s.arrayTabs[3].stack.peek().isCovered());
|
|
90
|
+ Assert.assertFalse(s.arrayTabs[4].stack.peek().isCovered());
|
|
91
|
+ Assert.assertFalse(s.arrayTabs[5].stack.peek().isCovered());
|
|
92
|
+ Assert.assertFalse(s.arrayTabs[6].stack.peek().isCovered());
|
78
|
93
|
}
|
79
|
94
|
}
|