26 #include <mln/core/image/image1d.hh>
27 #include <mln/core/image/image2d.hh>
28 #include <mln/core/image/image3d.hh>
29 #include <mln/core/image/dmorph/sub_image.hh>
31 #include <mln/core/image/dmorph/image_if.hh>
32 #include <mln/fun/p2b/chess.hh>
34 #include <mln/literal/origin.hh>
36 #include <mln/value/int_s8.hh>
37 #include <mln/value/int_s16.hh>
40 #include <mln/debug/iota.hh>
42 #include <mln/arith/times.hh>
43 #include <mln/data/abs.hh>
93 chck(
const Image<I>& ref_)
95 const I& ref = exact(ref_);
96 I out (ref.domain ());
99 mln_piter(I) p (ref.domain ());
102 mln_assertion (ref(p) == out(p));
104 mln_assertion (ref(p) == -out(p));
107 template <typename V>
109 chk(
unsigned sli,
unsigned row,
unsigned col)
118 (std::cerr <<
"in 1d ... ").flush ();
120 typedef image1d<V> I;
122 for (
unsigned i = 1; i < col; ++i)
129 std::cerr <<
"OK" << std::endl;
131 (std::cerr <<
"in 2d ... ").flush ();
133 typedef image2d<V> I;
135 for (
unsigned i = 1; i < col; ++i)
136 for (
unsigned j = 1; j < row; ++j)
143 std::cerr <<
"OK" << std::endl;
145 (std::cerr <<
"in 3d ... ").flush ();
147 typedef image3d<V> I;
149 for (
unsigned i = 1; i < col; ++i)
150 for (
unsigned j = 1; j < row; ++j)
151 for (
unsigned k = 1; k < sli; ++k)
158 std::cerr <<
"OK" << std::endl;
170 std::cerr <<
"Tests data::abs:" << std::endl;
171 std::cerr <<
"on int:" << std::endl;
173 std::cerr <<
"on int_s8:" << std::endl;
174 chk<value::int_s8>(2, 2, 2);
175 std::cerr <<
"on int_s16:" << std::endl;
176 chk<value::int_s16>(4, 16, 64);