26 #include <mln/value/rgb.hh>
27 #include <mln/value/rgb8.hh>
28 #include <mln/value/int_u8.hh>
29 #include <mln/literal/all.hh>
32 #define sym_compare_assert(V1, OP, V2) \
34 mln_assertion(V1 OP V2);
36 #define compute_rgb(T, V1, OP, V2) \
39 V1.red() OP V2.red() , \
40 V1.green() OP V2.green() , \
41 V1.blue() OP V2.blue() \
44 #define compute_rgb_sc(T, V1, OP, V2) \
53 #define test_interop(T1, T2, OP, V1, V2) \
59 sym_compare_assert(i, ==, compute_rgb(T1, V1, OP, V2)); \
60 sym_compare_assert(j, ==, V2); \
66 sym_compare_assert(j, ==, compute_rgb(T1,V1, OP, V2)); \
67 sym_compare_assert(i, ==, V1); \
71 sym_compare_assert(i, ==, compute_rgb(T1,V1, OP, V1)); \
76 sym_compare_assert(i, ==, compute_rgb(T1,V1, OP, V2)); \
79 sym_compare_assert(j, ==, compute_rgb(T1,V2, OP, V2)); \
84 sym_compare_assert(j, ==, compute_rgb(T1,V2, OP, V1)); \
88 sym_compare_assert(i, ==, compute_rgb(T1,V1, OP, V1)); \
93 #define test_interop_sc(T1, T2, OP, V1, V2) \
99 sym_compare_assert(i, ==, compute_rgb_sc(T1,V1, OP, V2)); \
100 sym_compare_assert(j, ==, V2); \
105 sym_compare_assert(i, ==, compute_rgb_sc(T1, V1, OP, V2)); \
120 test_interop(rgb8, rgb8, +, rgb8(4,5,6), rgb8(1,2,3));
121 test_interop(rgb8, rgb8, -, rgb8(4,5,6), rgb8(1,2,3));
123 test_interop(rgb<10>, rgb<10>, +, rgb<10>(4,5,6), rgb<10>(1,2,3));
124 test_interop(rgb<10>, rgb<10>, -, rgb<10>(4,5,6), rgb<10>(1,2,3));
126 test_interop(rgb<16>, rgb<16>, +, rgb<16>(4,5,6), rgb<16>(1,2,3));
127 test_interop(rgb<16>, rgb<16>, -, rgb<16>(4,5,6), rgb<16>(1,2,3));
129 test_interop_sc(rgb8,
int, *, rgb8(4,5,6), 4);
130 test_interop_sc(rgb8,
int, /, rgb8(40,50,60), 10);
132 test_interop_sc(rgb8,
unsigned, *, rgb8(4,5,6), 4);
133 test_interop_sc(rgb8,
unsigned, /, rgb8(40,50,60), 10);
139 test_interop_sc(rgb8,
char, *, rgb8(4,5,6), 4);
140 test_interop_sc(rgb8,
char, /, rgb8(40,50,60), 10);
142 test_interop_sc(rgb8, int_u8, *, rgb8(4,5,6), 4);
143 test_interop_sc(rgb8, int_u8, /, rgb8(40,50,60), 10);
145 test_interop_sc(rgb8, int_u<7>, *, rgb8(4,5,6), 4);
146 test_interop_sc(rgb8, int_u<7>, /, rgb8(40,50,60), 10);