forked from ucsb-cs24-w22/STARTER-lab02
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tddFuncs.cpp
executable file
·63 lines (55 loc) · 1.49 KB
/
tddFuncs.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
#include "tddFuncs.h"
#include <iostream>
using std::cout;
using std::endl;
void assertEquals(std::string expected,
std::string actual,
std::string message) {
if (expected==actual) {
cout << "PASSED: " << message << endl;;
} else {
cout << " FAILED: " << message << endl
<< " Expected: " << expected << " Actual: " << actual << endl;
}
}
void assertEquals(Node* expected,
Node* actual,
std::string message) {
if (expected==actual) {
cout << "PASSED: " << message << endl;;
} else {
cout << " FAILED: " << message << endl
<< " Expected: " << expected << " Actual: " << actual << endl;
}
}
void assertNotNull(Node* actual,
std::string message) {
if (actual == 0) {
cout << " FAILED: " << message << endl
<< " Pointer should not be NULL" << endl;
} else {
cout << "PASSED: " << message << endl;
}
}
void assertEquals(int expected,
int actual,
std::string message) {
if (expected==actual) {
cout << "PASSED: " << message << endl;;
} else {
cout << " FAILED: " << message << endl
<< " Expected: " << expected << " Actual: " << actual << endl;
}
}
void assertTrue(bool expression,
std::string message) {
if (expression) {
cout << "PASSED: " << message << endl;;
} else {
cout << " FAILED: " << message << endl
<< " Expected true, but was false " << endl;
}
}
void startTestGroup(std::string name){
cout << "--------------" << name << "--------------" << endl;
}