-
Notifications
You must be signed in to change notification settings - Fork 16
/
tests.cxx
78 lines (71 loc) · 1.48 KB
/
tests.cxx
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "dessert.hpp"
#include "dessert.hpp" // check header can be included twice
void cmp( int x ) {
dessert( x );
dessert( 0 == !x );
dessert( (!x) == 0 );
dessert( !!x );
dessert( !!x );
}
void cmpL( int x, int y ) {
cmp(x);
cmp(y);
dessert( x < y );
dessert( y > x );
dessert( x <= y );
dessert( y >= x );
dessert( x != y );
dessert( y != x );
dessert( !(x > y) );
dessert( !(y < x) );
dessert( !(x >= y) );
dessert( !(y <= x) );
dessert( !(x == y) );
dessert( !(y == x) );
}
void cmpG( int x, int y ) {
cmp(x);
cmp(y);
dessert( x > y );
dessert( y < x );
dessert( x >= y );
dessert( y <= x );
dessert( x != y );
dessert( y != x );
dessert( !(x < y) );
dessert( !(y > x) );
dessert( !(x <= y) );
dessert( !(y >= x) );
dessert( !(x == y) );
dessert( !(y == x) );
}
void cmpE( int x, int y ) {
cmp(x);
cmp(y);
dessert( x == y );
dessert( y == x );
dessert( !(x != y) );
dessert( !(y != x) );
}
int main() {
int a = 1, b = 2;
dessert( a < b );
dessert( b > a );
dessert( a <= b );
dessert( b >= a );
dessert( a != b );
dessert( b != a );
int z = 0, o = 1, t = 2;
dessert(o);
dessert(o+o);
dessert(!z);
dessert( o == o );
dessert( z != o );
dessert( o < t );
dessert( o <= t );
dessert( t > o );
dessert( t >= o );
cmpL(8335,10002);
cmpG(10002,8335);
cmpE(8335,8335);
}