-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsimple_test.cpp
More file actions
42 lines (35 loc) · 1.31 KB
/
simple_test.cpp
File metadata and controls
42 lines (35 loc) · 1.31 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
// Implementations of test related functions.
// TA: Yin Qu (me.yin.qu@gmail.com)
#include "simple_test.h"
using namespace std;
void assert_true_helper(bool cond,
const char* cond_text,
const char* file,
const int line) {
if (!cond) {
cout << endl << "Failed: " << cond_text
<< ", in " << file << ", line " << line << endl;
cout << " Expected to be true." << endl;
}
}
void assert_false_helper(bool cond,
const char* cond_text,
const char* file,
const int line) {
if (cond) {
cout << endl << "Failed: " << cond_text
<< ", in " << file << ", line " << line << endl;
cout << " Expected to be false." << endl;
}
}
void assert_bitwise_eq_helper(bool* v1, bool* v2, int len,
const char* v1_text, const char* v2_text,
const char* file, const int line) {
if (!bitwise_eq(v1, v2, len)) {
cout << endl << "Failed: " << v1_text << " == " << v2_text
<< ", in " << file << ", line " << line << endl;
cout << " Expected: " << to_str(v1, len) << endl;
cout << " Actual: " << to_str(v2, len) << endl;
}
}
vector<TestCase> TestCaseRegisterer::test_cases;