
* tests/core/alias/dpoint2d.cc: Exercise the substraction of a dpoint2d from a point2d. * tests/core/alias/neighb2d.cc: New. * tests/core/alias/Makefile.am (check_PROGRAMS): Add neighb2d. (neighb2d_SOURCES): New. * tests/io/dump/dump.cc: Exercise mln::io::dump::load and mln::io::dump::save with 3D binary images. * tests/io/dump/Makefile.am (MOSTLYCLEANFILES): Add dump-bool-3d.dump * tests/value/int_u32.cc: New test (known to fail). * tests/value/Makefile.am (check_PROGRAMS): Add int_u32. (int_u32_SOURCES): New. (XFAIL_TESTS): New. Add int_u32. --- milena/ChangeLog | 19 +++++++++++ milena/tests/core/alias/Makefile.am | 5 ++- milena/tests/core/alias/dpoint2d.cc | 4 ++- .../tests/core/alias/{window2d.cc => neighb2d.cc} | 27 +++++++++------ milena/tests/io/dump/Makefile.am | 7 ++-- milena/tests/io/dump/dump.cc | 35 +++++++++++++++++++- milena/tests/value/Makefile.am | 6 +++- milena/tests/value/{float01_f.cc => int_u32.cc} | 15 ++++---- 8 files changed, 93 insertions(+), 25 deletions(-) copy milena/tests/core/alias/{window2d.cc => neighb2d.cc} (74%) copy milena/tests/value/{float01_f.cc => int_u32.cc} (81%) diff --git a/milena/ChangeLog b/milena/ChangeLog index f329d34..632bacd 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,24 @@ 2011-07-12 Roland Levillain <roland@lrde.epita.fr> + Add more tests. + + * tests/core/alias/dpoint2d.cc: Exercise the substraction of a + dpoint2d from a point2d. + * tests/core/alias/neighb2d.cc: New. + * tests/core/alias/Makefile.am (check_PROGRAMS): Add neighb2d. + (neighb2d_SOURCES): New. + * tests/io/dump/dump.cc: Exercise mln::io::dump::load and + mln::io::dump::save with 3D binary images. + * tests/io/dump/Makefile.am (MOSTLYCLEANFILES): + Add dump-bool-3d.dump + * tests/value/int_u32.cc: New test (known to fail). + * tests/value/Makefile.am (check_PROGRAMS): Add int_u32. + (int_u32_SOURCES): New. + (XFAIL_TESTS): New. + Add int_u32. + +2011-07-12 Roland Levillain <roland@lrde.epita.fr> + * apps/generic-skel/image3d-skel.hh: Add `inline' qualifiers. 2011-07-11 Roland Levillain <roland@lrde.epita.fr> diff --git a/milena/tests/core/alias/Makefile.am b/milena/tests/core/alias/Makefile.am index 9c47da2..de78866 100644 --- a/milena/tests/core/alias/Makefile.am +++ b/milena/tests/core/alias/Makefile.am @@ -1,4 +1,5 @@ -# Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE). +# Copyright (C) 2008, 2009, 2011 EPITA Research and Development +# Laboratory (LRDE). # # This file is part of Olena. # @@ -23,6 +24,7 @@ box3d \ dpoint1d \ dpoint2d \ dpoint3d \ +neighb2d \ point1d \ point2d \ point3d \ @@ -39,6 +41,7 @@ box3d_SOURCES = box3d.cc dpoint1d_SOURCES = dpoint1d.cc dpoint2d_SOURCES = dpoint2d.cc dpoint3d_SOURCES = dpoint3d.cc +neighb2d_SOURCES = neighb2d.cc point1d_SOURCES = point1d.cc point2d_SOURCES = point2d.cc point3d_SOURCES = point3d.cc diff --git a/milena/tests/core/alias/dpoint2d.cc b/milena/tests/core/alias/dpoint2d.cc index 3accb81..07623c9 100644 --- a/milena/tests/core/alias/dpoint2d.cc +++ b/milena/tests/core/alias/dpoint2d.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -40,6 +41,7 @@ int main() mln_assertion(dp == q - p); mln_assertion(q == p + dp); + mln_assertion(p == q - dp); algebra::vec<2, float> v = dp; mln_assertion(v[0] / 2 == 1.5); diff --git a/milena/tests/core/alias/window2d.cc b/milena/tests/core/alias/neighb2d.cc similarity index 74% copy from milena/tests/core/alias/window2d.cc copy to milena/tests/core/alias/neighb2d.cc index 8940321..3590d90 100644 --- a/milena/tests/core/alias/window2d.cc +++ b/milena/tests/core/alias/neighb2d.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -23,7 +24,10 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#include <mln/core/alias/window2d.hh> +/// \file +/// \brief Exercise mln::neighb2d. + +#include <mln/core/alias/neighb2d.hh> #include <mln/convert/to_image.hh> @@ -31,19 +35,20 @@ int main() { using namespace mln; - window2d w; - - mln_assertion(w.is_centered() == false); - mln_assertion(w.is_symmetric() == true); + neighb2d nbh; - w .insert(-1,-1) - .insert( 1, 1); + bool vals[] = { 0, 1, 0, + 1, 0, 1, + 0, 1, 0 }; + convert::from_to(vals, nbh); - mln_assertion(w.delta() == 1); + mln_assertion(nbh.delta() == 1); + mln_assertion(nbh.size() == 4); + mln_assertion(nbh == c4()); // The code below is equivalent to: // image2d<bool> ima; - // convert::from_to(w, ima); - image2d<bool> ima = convert::to_image(w); + // convert::from_to(nbh, ima); + image2d<bool> ima = convert::to_image(nbh); (void) ima; } diff --git a/milena/tests/io/dump/Makefile.am b/milena/tests/io/dump/Makefile.am index dedd818..38cb55d 100644 --- a/milena/tests/io/dump/Makefile.am +++ b/milena/tests/io/dump/Makefile.am @@ -1,4 +1,5 @@ -# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory (LRDE). +# Copyright (C) 2009, 2010, 2011 EPITA Research and Development +# Laboratory (LRDE). # # This file is part of Olena. # @@ -16,8 +17,7 @@ include $(top_srcdir)/milena/tests/tests.mk -check_PROGRAMS = \ - dump +check_PROGRAMS = dump dump_SOURCES = dump.cc @@ -25,6 +25,7 @@ TESTS = $(check_PROGRAMS) MOSTLYCLEANFILES = \ dump-bool.dump \ + dump-bool-3d.dump \ dump-float.dump \ dump-int_u8.dump \ dump-rgb8.dump \ diff --git a/milena/tests/io/dump/dump.cc b/milena/tests/io/dump/dump.cc index f8b8f66..780c2b8 100644 --- a/milena/tests/io/dump/dump.cc +++ b/milena/tests/io/dump/dump.cc @@ -1,4 +1,5 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2009, 2010, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -23,7 +24,15 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. +/// \file +/// \brief Exercise mln::io::dump::load and mln::io::dump::save. + #include <mln/core/image/image2d.hh> +#include <mln/core/image/image3d.hh> +#include <mln/make/image3d.hh> + +#include <mln/debug/println.hh> + #include <mln/io/dump/load.hh> #include <mln/io/dump/save.hh> @@ -36,6 +45,7 @@ #include <mln/debug/println.hh> + int main() { using namespace mln; @@ -57,6 +67,29 @@ int main() mln_assertion(pic == pic2); } + /// Value: bool (in 3D). + { + bool data[4] = { 0, 1, + 1, 0 }; + image2d<bool> slice = make::image2d(data); + + // Create a 3D image where each slice is a copy of SLICE. + util::array< image2d<bool> > slices; + for (unsigned i = 0; i < 3; ++i) + slices.append(slice); + image3d<bool> pic = make::image3d(slices); + + debug::println(pic); + + io::dump::save(pic, "dump-bool-3d.dump"); + + image3d<bool> pic2; + io::dump::load(pic2, "dump-bool-3d.dump"); + + mln_assertion(pic.domain() == pic2.domain()); + mln_assertion(pic == pic2); + } + /// Value: int_u8 { value::int_u8 data[4] = { 5, 1, diff --git a/milena/tests/value/Makefile.am b/milena/tests/value/Makefile.am index 975d471..4b03bab 100644 --- a/milena/tests/value/Makefile.am +++ b/milena/tests/value/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2007, 2008, 2009 EPITA Research and Development +# Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development # Laboratory (LRDE). # # This file is part of Olena. @@ -28,6 +28,7 @@ check_PROGRAMS = \ int_s \ int_s16 \ int_u8 \ + int_u32 \ interop \ label \ proxy \ @@ -51,6 +52,7 @@ equiv_SOURCES = equiv.cc int_s_SOURCES = int_s.cc int_s16_SOURCES = int_s16.cc int_u8_SOURCES = int_u8.cc +int_u32_SOURCES = int_u32.cc interop_SOURCES = interop.cc label_SOURCES = label.cc proxy_SOURCES = proxy.cc @@ -59,6 +61,8 @@ scalar_SOURCES = scalar.cc set_SOURCES = set.cc sign_SOURCES = sign.cc +XFAIL_TESTS = int_u32 + #<<lrde # FIXME: Not distributed (yet). check_PROGRAMS += stack diff --git a/milena/tests/value/float01_f.cc b/milena/tests/value/int_u32.cc similarity index 81% copy from milena/tests/value/float01_f.cc copy to milena/tests/value/int_u32.cc index 7ca1e7a..61eb6e5 100644 --- a/milena/tests/value/float01_f.cc +++ b/milena/tests/value/int_u32.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -23,14 +23,15 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. +/// \file +/// \brief Exercise mln::value::int_u32. + #include <iostream> -#include <mln/value/float01_f.hh> +#include <mln/value/int_u32.hh> int main() { - using mln::value::float01_f; - - float01_f x = 0.5; - std::cout << x + 21.25 << std::endl; - x = x + 34; + // FIXME: This traits return `-1'. + std::cerr << mln::trait::value_<mln::value::int_u<32u> >::max() + << std::endl; } -- 1.7.2.5