-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSkipBoTest.cpp
124 lines (71 loc) · 1.89 KB
/
SkipBoTest.cpp
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#include "Game.h"
#include "Card.h"
#include <string>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <list>
#include <vector>
using std::cout;
using std::endl;
using namespace std;
class SkipBoTest {
public:
static void CardTest() {
// build a few cards with constructor
// and test for contents
Card c1(1);
assert(c1.getData() == 1);
Card c2(2);
assert(c2.getData() == 2);
Card c3(0);
assert(c3.getSkipBo());
// test mutators
assert(!(c2.transform(c1)));
assert(c3.transform(c2));
assert(!(c1.revert()));
assert(c3.revert());
}
static void PileTest() {
// build a few piles with constructor
// and test for type and contents
Pile p1(true);
assert(p1.getSize()==162);
Card c4 = p1.cardAt(36);
Card c5 = p1.cardAt(37);
Card c6 = p1.cardAt(80);
assert(c4==c5);
assert(c4!=c6);
for (int i=0; i<144; i++)
assert(p1.cardAt(i).getData() == i/12 + 1);
for (int i=144; i<162; i++)
assert(p1.cardAt(i).getSkipBo());
p1.deckShuffle();
//Makes sure that deck is shuffled
while (p1.cardAt(36)==c4 || p1.cardAt(37)==c5 || p1.cardAt(80)==c6) {
p1.deckShuffle();
}
assert(p1.cardAt(36)!=c4);
p1 + c4;
cout << p1.getSize();
assert(p1.cardAt(162).getData() == 4);
p1 + c5;
assert(p1.cardAt(163).getData() == 4);
p1.empty();
assert(p1.getSize() == 0);
}
static void PlayerTest() {
//Player pl1("Kunal");
//assert(pl1.getName() == "Kunal");
}
static void GameTest() {
}
};
int main(void) {
cout << "Testing SkipBo. *Fingers crossed*" << endl;
SkipBoTest::CardTest();
SkipBoTest::PileTest();
//SkipBoTest::PlayerTest();
//SkipBoTest::GameTest();
cout << "All Skipbo tests passed! I know.. we're surprised too!" << endl;
}