-
Notifications
You must be signed in to change notification settings - Fork 4
/
testsuite.h
40 lines (34 loc) · 860 Bytes
/
testsuite.h
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
#ifndef TESTSUITE_H
#define TESTSUITE_H
#include<iostream>
#include<ctime>
static clock_t start_time;
static clock_t end_time;
#define TIME_STARTS() \
start_time = clock();
#define TIME_UP() \
end_time = clock();\
std::cout << "TIME USED: ";\
std::cout << (double)(end_time-start_time)/CLOCKS_PER_SEC*1000;\
std::cout << " ms" << std::endl;
#define ASSERT(x) \
std::cout << "ASSERTION: " << "["#x << "]" ; \
if(x)\
{\
std::cout << " SUCCESS!" << std::endl;\
}\
else\
{\
std::cout << " FAIL![*****]" << std::endl;\
}
#define ASSERT_EQUAL(a,b) \
std::cout << "ASSERTION: " << "["#a<<" =="<<" "#b<<"]";\
if((a)==(b))\
{\
std::cout << " SUCCESS!" << std::endl;\
}\
else\
{\
std::cout << " FAIL![*****]" << std::endl;\
}
#endif // TESTSUITE_H