27 #include <mln/value/int_s16.hh>
29 #define test_operator(T, OP, V1, V2) \
36 mln_assertion(i == (V1 OP V2)); \
37 mln_assertion(j == V2); \
40 mln_assertion(i == (((V1 OP V2) OP (V1 OP V2)))); \
43 #define test_interop(T1, T2, OP, V1, V2) \
50 mln_assertion(i == (V1 OP V2)); \
51 mln_assertion(j == V2); \
54 mln_assertion(i == (((V1 OP V2) OP (V1 OP V2)))); \
70 mln_assertion(i == 51);
73 mln_assertion(i == 51);
77 mln_assertion(i == 51);
80 mln_assertion(j == 51);
83 mln_assertion(3.0f == i);
84 mln_assertion(i != 2.99f);
100 mln_assertion(j > i);
101 mln_assertion(i < 12345);
102 mln_assertion(12345 > i);
104 mln_assertion(i != j);
105 mln_assertion(i == 42);
106 mln_assertion(42 == i);
107 mln_assertion(i != 69);
108 mln_assertion(69 != i);
114 test_operator(int_s16, +, -5, 1);
115 test_interop(int_s16,
int, +, 5, -1);
116 test_interop(int_s16,
char, +, -4, 2);
117 test_interop(int_s16,
unsigned char, +, 4, 2);
122 mln_assertion(i == 235);
125 mln_assertion(i == 236);
128 mln_assertion(i == 236);
134 test_operator(int_s16, -, 100, 5);
135 test_interop(int_s16,
int, -, 100, 5);
136 test_interop(int_s16,
char, -, 100, 5);
137 test_interop(int_s16,
unsigned char, -, 100, 5);
142 mln_assertion(c == 0);
147 mln_assertion(i == 235);
150 mln_assertion(i == 234);
152 mln_assertion(-i == -234);
157 test_operator(int_s16, *, 5, 1);
158 test_interop(int_s16,
int, *, 5, 1);
159 test_interop(int_s16,
char, *, 4, 2);
160 test_interop(int_s16,
unsigned char, *, 4, 2);
165 mln_assertion(c == 0);
172 mln_assertion(i == 0);
183 test_operator(int_s16, /, 5, 1);
184 test_interop(int_s16,
int, /, 5, 1);
185 test_interop(int_s16,
char, /, 4, 2);
186 test_interop(int_s16,
unsigned char, /, 4, 2);
191 mln_assertion(c == 200);
193 mln_assertion(c == 100);
197 mln_assertion(c == 50);
204 test_operator(int_s16, %, 5, 10);
205 test_interop(int_s16,
int, %, 5, 10);
206 test_interop(int_s16,
char, %, 4, 20);
207 test_interop(int_s16,
unsigned char, %, 4, 20);