This repository was archived by the owner on Nov 4, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.cpp
More file actions
61 lines (51 loc) · 1.3 KB
/
tests.cpp
File metadata and controls
61 lines (51 loc) · 1.3 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
55
56
57
58
59
60
61
//
// Created by coope on 3/16/2021.
//
#include "tests.h"
bool tests () {
bool test1 = testCreateBoard();
bool test2 = testMove();
bool ok = test1 && test2;
if(ok) {
printf("All tests passed!\n");
}
else {
printf("One or more tests have failed.\n");
}
return ok;
}
bool testCreateBoard() {
puts("Starting testCreateBoard...\n");
Board board;
board.printBoard();
puts("Does this look like a checker board? (y/n)");
char ok = getchar();
if(ok == 'y') {
puts("testCreateBoard passed!\n");
return true;
}
else {
puts("testCreateBoard failed.\n");
return false;
}
}
bool testMove() {
puts("Starting testMove...\n");
Board board;
//Standard movement
bool ok = board.move("50 41", 1);
//trying to move a piece that is not there
bool ok1 = !board.move("50 41", 1);
//trying to move a piece off of the diagonal
bool ok2 = !board.move("41 31", 1);
//trying to move another player's piece
bool ok3 = !board.move("41 30", 2);
if(ok && ok1 && ok2 && ok3) {
puts("testCreateBoard passed!\n");
return true;
}
else {
puts("testCreateBoard failed.\n");
return false;
}
}