milena r1299: Fix, doc in hexa images. Augment tests

URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2007-10-10 Matthieu Garrigues <garrigues@lrde.epita.fr> Fix, doc in hexa images. Augment tests. * mln/core/hexa.hh: Set support trait to regular. * mln/core/image2d_h.hh: Add doc. * tests/value_int_u8.cc: Augment. --- mln/core/hexa.hh | 3 ++ mln/core/image2d_h.hh | 14 +++++++++++ tests/value_int_u8.cc | 60 +++++++++++++------------------------------------- 3 files changed, 33 insertions(+), 44 deletions(-) Index: trunk/milena/tests/value_int_u8.cc =================================================================== --- trunk/milena/tests/value_int_u8.cc (revision 1298) +++ trunk/milena/tests/value_int_u8.cc (revision 1299) @@ -85,6 +85,10 @@ j = i; mln_assertion(j == 51); + i = 3; + mln_assertion(3.0f == i); + mln_assertion(i != 2.99f); + // Error at run-time as expected :-) // i = 256; // i = -1; @@ -124,6 +128,18 @@ c *= 0; mln_assertion(c == 0); + + i *= 2; + int k; k *= i; + + unsigned char c = 0; + i *= c; + mln_assertion(i == 0); + + // Error at run-time as expected :-) + // i = 128; + // i *= 2; + } // Division @@ -147,47 +163,3 @@ } } - -// // Multiplication. -// { -// i *= 2; -// int k; k *= i; - -// unsigned char c = 0; -// i *= c; -// mln_assertion(i == 0); - -// // Error at run-time as expected :-) -// // i = 128; -// // i *= 2; -// } - - -// { -// i = 3; -// mln_assertion(3.0f == i); -// mln_assertion(i != 2.99f); -// } - -// { -// int j; -// j = -i; -// j = +i; -// } - -// { -// i = 0; -// i += 1; -// } - - // mln_assertion(i == 2); - // mln_assertion(i != 3); - - // mln_assertion(-i == -2); - // mln_assertion(-3 * i == -6); - - // mln_assertion(j != i); - // mln_assertion(j != 0); - // mln_assertion(0 != j); - -//} Index: trunk/milena/mln/core/hexa.hh =================================================================== --- trunk/milena/mln/core/hexa.hh (revision 1298) +++ trunk/milena/mln/core/hexa.hh (revision 1299) @@ -76,11 +76,14 @@ typedef trait::image::category::domain_morpher category; + typedef mln_trait_image_border(I) border; // have a border only if I does. typedef mln_trait_image_io_from_(I) io; // un-write when I const typedef mln_trait_image_data_from_(I) data; + + typedef trait::image::support::regular support; // typedef mlc_if( I_data_are_linear_, // trait::data::stored, // if linear then just stored // I_data_ ) data; // otherwise like I Index: trunk/milena/mln/core/image2d_h.hh =================================================================== --- trunk/milena/mln/core/image2d_h.hh (revision 1298) +++ trunk/milena/mln/core/image2d_h.hh (revision 1299) @@ -54,6 +54,18 @@ /// Constructor with the numbers of rows and columns /// border thickness. + /// + /// image2d_h(3,6) will build this hexa image : + /// + /// 1 3 5 + /// 0 2 4 + /// -------------- + /// 0| x x x + /// | + /// 2| x x x + /// | + /// 4| x x x + image2d_h(int nrows, int ncols, unsigned bdr = border::thickness); //using super_::init_; @@ -65,7 +77,9 @@ template <typename V> image2d_h<V>::image2d_h(int nrows, int ncols, unsigned bdr) { + // numbers of cols can't be odd. mln_assertion(ncols % 2 == 0); + image2d<V> ima(nrows, ncols / 2, bdr);
participants (1)
-
Matthieu Garrigues