-
Notifications
You must be signed in to change notification settings - Fork 0
/
t-check.cc
57 lines (44 loc) · 1.26 KB
/
t-check.cc
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
#include <lvv/lvv.h>
#include <lvv/check.h>
#include <limits>
using namespace std;
using namespace lvv;
template <typename T> bool equal (T arg1, T arg2) { /*PR(arg1); PR(arg2);*/ return arg1 == arg2; };
template <> bool equal<int> (int arg1, int arg2) { /*PR(arg1); PR(arg2);*/ return arg1 == arg2; };
int
main() {
int i0=0;
int i1=1;
int i2=2;
float f0=0.0;
float f1=1.0;
float f2=2.0;
cout << std::boolalpha;
CHECK(1 == 1);
CHECK(!equal(f1,f2));
CHECK( equal(f1,f1));
CHECK(!equal(f0,f1));
CHECK(!equal(f1,f0));
CHECK( equal(f0,f0));
CHECK(!equal(i1,i2));
CHECK( equal(i1,i1));
CHECK(!equal(i0,i1));
CHECK(!equal(i1,i0));
CHECK( equal(i0,i0));
CHECK(false);
CHECK_ARE_EQUAL(1,2);
CHECK_NOT_EQUAL(1,2);
CHECK_ARE_EQUAL(1,1);
CHECK_NOT_EQUAL(f1,f2);
CHECK_ARE_EQUAL(f1,f1);
CHECK_NOT_EQUAL(f0,f1);
CHECK_NOT_EQUAL(f1,f0);
CHECK_ARE_EQUAL(f0,f0);
CHECK_NOT_EQUAL(i1,i2);
CHECK_ARE_EQUAL(i1,i1);
CHECK_NOT_EQUAL(i0,i1);
CHECK_NOT_EQUAL(i1,i0);
CHECK_ARE_EQUAL(i0,i0);
cout << (all_pass ? "\n------------ all pass ------------\n" : "\n!!!!!!!!! SOME FAILED !!!!!!!!\n");
exit(all_pass ? 0 : 1);
}