| 1 |
|
| 2 |
|
| 3 |
bool test_ltz(float x) { return x < 0; } |
| 4 |
bool test_lez(float x) { return x <= 0; } |
| 5 |
bool test_eqz(float x) { return x == 0; } |
| 6 |
bool test_nez(float x) { return x != 0; } |
| 7 |
bool test_gez(float x) { return x >= 0; } |
| 8 |
bool test_gtz(float x) { return x > 0; } |
| 9 |
|
| 10 |
void test1f() |
| 11 |
{ |
| 12 |
assert(!test_ltz(0.0f)); |
| 13 |
assert(!test_ltz(1.0f)); |
| 14 |
assert( test_ltz(-1.0f)); |
| 15 |
|
| 16 |
assert( test_lez(0.0f)); |
| 17 |
assert(!test_lez(1.0f)); |
| 18 |
assert( test_lez(-1.0f)); |
| 19 |
|
| 20 |
assert( test_eqz(0.0f)); |
| 21 |
assert(!test_eqz(1.0f)); |
| 22 |
assert(!test_eqz(-1.0f)); |
| 23 |
|
| 24 |
assert(!test_nez(0.0f)); |
| 25 |
assert( test_nez(1.0f)); |
| 26 |
assert( test_nez(-1.0f)); |
| 27 |
|
| 28 |
assert( test_gez(0.0f)); |
| 29 |
assert( test_gez(1.0f)); |
| 30 |
assert(!test_gez(-1.0f)); |
| 31 |
|
| 32 |
assert(!test_gtz(0.0f)); |
| 33 |
assert( test_gtz(1.0f)); |
| 34 |
assert(!test_gtz(-1.0f)); |
| 35 |
} |
| 36 |
|
| 37 |
bool test_ltz(double x) { return x < 0; } |
| 38 |
bool test_lez(double x) { return x <= 0; } |
| 39 |
bool test_eqz(double x) { return x == 0; } |
| 40 |
bool test_nez(double x) { return x != 0; } |
| 41 |
bool test_gez(double x) { return x >= 0; } |
| 42 |
bool test_gtz(double x) { return x > 0; } |
| 43 |
|
| 44 |
void test1d() |
| 45 |
{ |
| 46 |
assert(!test_ltz(0.0)); |
| 47 |
assert(!test_ltz(1.0)); |
| 48 |
assert( test_ltz(-1.0)); |
| 49 |
|
| 50 |
assert( test_lez(0.0)); |
| 51 |
assert(!test_lez(1.0)); |
| 52 |
assert( test_lez(-1.0)); |
| 53 |
|
| 54 |
assert( test_eqz(0.0)); |
| 55 |
assert(!test_eqz(1.0)); |
| 56 |
assert(!test_eqz(-1.0)); |
| 57 |
|
| 58 |
assert(!test_nez(0.0)); |
| 59 |
assert( test_nez(1.0)); |
| 60 |
assert( test_nez(-1.0)); |
| 61 |
|
| 62 |
assert( test_gez(0.0)); |
| 63 |
assert( test_gez(1.0)); |
| 64 |
assert(!test_gez(-1.0)); |
| 65 |
|
| 66 |
assert(!test_gtz(0.0)); |
| 67 |
assert( test_gtz(1.0)); |
| 68 |
assert(!test_gtz(-1.0)); |
| 69 |
} |
| 70 |
|
| 71 |
bool test_lt(float x, float y) { return x < y; } |
| 72 |
bool test_le(float x, float y) { return x <= y; } |
| 73 |
bool test_eq(float x, float y) { return x == y; } |
| 74 |
bool test_ne(float x, float y) { return x != y; } |
| 75 |
bool test_ge(float x, float y) { return x >= y; } |
| 76 |
bool test_gt(float x, float y) { return x > y; } |
| 77 |
|
| 78 |
void test2f() |
| 79 |
{ |
| 80 |
assert(!test_lt(1.0f, 1.0f)); |
| 81 |
assert( test_lt(1.0f, 2.0f)); |
| 82 |
assert(!test_lt(2.0f, 1.0f)); |
| 83 |
|
| 84 |
assert( test_le(1.0f, 1.0f)); |
| 85 |
assert( test_le(1.0f, 2.0f)); |
| 86 |
assert(! test_le(2.0f, 1.0f)); |
| 87 |
|
| 88 |
assert( test_eq(1.0f, 1.0f)); |
| 89 |
assert(!test_eq(1.0f, 2.0f)); |
| 90 |
assert(!test_eq(2.0f, 1.0f)); |
| 91 |
|
| 92 |
assert(!test_ne(1.0f, 1.0f)); |
| 93 |
assert( test_ne(1.0f, 2.0f)); |
| 94 |
assert( test_ne(2.0f, 1.0f)); |
| 95 |
|
| 96 |
assert( test_ge(1.0f, 1.0f)); |
| 97 |
assert(!test_ge(1.0f, 2.0f)); |
| 98 |
assert( test_ge(2.0f, 1.0f)); |
| 99 |
|
| 100 |
assert(!test_gt(1.0f, 1.0f)); |
| 101 |
assert(!test_gt(1.0f, 2.0f)); |
| 102 |
assert( test_gt(2.0f, 1.0f)); |
| 103 |
} |
| 104 |
|
| 105 |
bool test_lt(double x, double y) { return x < y; } |
| 106 |
bool test_le(double x, double y) { return x <= y; } |
| 107 |
bool test_eq(double x, double y) { return x == y; } |
| 108 |
bool test_ne(double x, double y) { return x != y; } |
| 109 |
bool test_ge(double x, double y) { return x >= y; } |
| 110 |
bool test_gt(double x, double y) { return x > y; } |
| 111 |
|
| 112 |
void test2d() |
| 113 |
{ |
| 114 |
assert(!test_lt(1.0, 1.0)); |
| 115 |
assert( test_lt(1.0, 2.0)); |
| 116 |
assert(!test_lt(2.0, 1.0)); |
| 117 |
|
| 118 |
assert( test_le(1.0, 1.0)); |
| 119 |
assert( test_le(1.0, 2.0)); |
| 120 |
assert(! test_le(2.0, 1.0)); |
| 121 |
|
| 122 |
assert( test_eq(1.0, 1.0)); |
| 123 |
assert(!test_eq(1.0, 2.0)); |
| 124 |
assert(!test_eq(2.0, 1.0)); |
| 125 |
|
| 126 |
assert(!test_ne(1.0, 1.0)); |
| 127 |
assert( test_ne(1.0, 2.0)); |
| 128 |
assert( test_ne(2.0, 1.0)); |
| 129 |
|
| 130 |
assert( test_ge(1.0, 1.0)); |
| 131 |
assert(!test_ge(1.0, 2.0)); |
| 132 |
assert( test_ge(2.0, 1.0)); |
| 133 |
|
| 134 |
assert(!test_gt(1.0, 1.0)); |
| 135 |
assert(!test_gt(1.0, 2.0)); |
| 136 |
assert( test_gt(2.0, 1.0)); |
| 137 |
} |
| 138 |
|
| 139 |
int main() |
| 140 |
{ |
| 141 |
test1f(); |
| 142 |
test1d(); |
| 143 |
test2f(); |
| 144 |
test2d(); |
| 145 |
return 0; |
| 146 |
} |