26 #include <mln/value/int_s16.hh>
28 #define test_operator(T, OP, V1, V2) \
35 mln_assertion(i == (V1 OP V2)); \
36 mln_assertion(j == V2); \
39 mln_assertion(i == (((V1 OP V2) OP (V1 OP V2)))); \
42 #define test_interop(T1, T2, OP, V1, V2) \
49 mln_assertion(i == (V1 OP V2)); \
50 mln_assertion(j == V2); \
53 mln_assertion(i == (((V1 OP V2) OP (V1 OP V2)))); \
69 mln_assertion(i == 51);
72 mln_assertion(i == 51);
76 mln_assertion(i == 51);
79 mln_assertion(j == 51);
82 mln_assertion(3.0f == i);
83 mln_assertion(i != 2.99f);
100 mln_assertion(i < 12345);
101 mln_assertion(12345 > i);
103 mln_assertion(i != j);
104 mln_assertion(i == 42);
105 mln_assertion(42 == i);
106 mln_assertion(i != 69);
107 mln_assertion(69 != i);
113 test_operator(int_s16, +, -5, 1);
114 test_interop(int_s16,
int, +, 5, -1);
115 test_interop(int_s16,
char, +, -4, 2);
116 test_interop(int_s16,
unsigned char, +, 4, 2);
121 mln_assertion(i == 235);
124 mln_assertion(i == 236);
127 mln_assertion(i == 236);
133 test_operator(int_s16, -, 100, 5);
134 test_interop(int_s16,
int, -, 100, 5);
135 test_interop(int_s16,
char, -, 100, 5);
136 test_interop(int_s16,
unsigned char, -, 100, 5);
141 mln_assertion(c == 0);
146 mln_assertion(i == 235);
149 mln_assertion(i == 234);
151 mln_assertion(-i == -234);
156 test_operator(int_s16, *, 5, 1);
157 test_interop(int_s16,
int, *, 5, 1);
158 test_interop(int_s16,
char, *, 4, 2);
159 test_interop(int_s16,
unsigned char, *, 4, 2);
164 mln_assertion(c == 0);
171 mln_assertion(i == 0);
182 test_operator(int_s16, /, 5, 1);
183 test_interop(int_s16,
int, /, 5, 1);
184 test_interop(int_s16,
char, /, 4, 2);
185 test_interop(int_s16,
unsigned char, /, 4, 2);
190 mln_assertion(c == 200);
192 mln_assertion(c == 100);
196 mln_assertion(c == 50);
203 test_operator(int_s16, %, 5, 10);
204 test_interop(int_s16,
int, %, 5, 10);
205 test_interop(int_s16,
char, %, 4, 20);
206 test_interop(int_s16,
unsigned char, %, 4, 20);