
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2007-11-28 Matthieu Garrigues <garrigues@lrde.epita.fr> Review debug directory. * mln/debug/iota.hh: Resolve a fixme due to a resolved bug (in operator %) * mln/debug/iota.spe.hh: likewise * tests/Makefile.am: Move debug tests... * tests/debug/Makefile.am: ...here * tests/debug_iota.cc: Rename as... * tests/debug/iota.cc: ...this. * tests/debug_println.cc: Rename as... * tests/debug/println.cc: ...this. * tests/debug_println_with_border.cc: Rename as... * tests/debug/println_with_border.cc: ...this. --- mln/debug/iota.hh | 4 - mln/debug/iota.spe.hh | 4 - tests/Makefile.am | 1 tests/debug/Makefile.am | 11 +++++ tests/debug/iota.cc | 57 +++++++++++++++++++++++++++ tests/debug/println.cc | 46 ++++++++++++++++++++++ tests/debug/println_with_border.cc | 76 +++++++++++++++++++++++++++++++++++++ 7 files changed, 193 insertions(+), 6 deletions(-) Index: trunk/milena/tests/debug_println_with_border.cc (deleted) =================================================================== Index: trunk/milena/tests/debug_iota.cc (deleted) =================================================================== Index: trunk/milena/tests/debug_println.cc (deleted) =================================================================== Index: trunk/milena/tests/debug/iota.cc =================================================================== --- trunk/milena/tests/debug/iota.cc (revision 0) +++ trunk/milena/tests/debug/iota.cc (revision 1561) @@ -0,0 +1,57 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file tests/debug_iota.cc + * + * \brief Tests on mln::debug::iota. + */ + +#include <mln/core/image2d.hh> + +#include <mln/value/int_u8.hh> + +#include <mln/debug/iota.hh> +#include <mln/level/compare.hh> + +int main() +{ + using namespace mln; + using value::int_u8; + + { + int vs[4][4] = { {1, 2, 3, 4}, + {5, 6, 7, 8}, + {9, 10,11,12}, + {13,14,15,16} }; + + image2d<int> ref = make::image2d(vs); + image2d<int> ima(4, 4); + + debug::iota(ima); + mln_assertion(ima == ref); + } +} Index: trunk/milena/tests/debug/println_with_border.cc =================================================================== --- trunk/milena/tests/debug/println_with_border.cc (revision 0) +++ trunk/milena/tests/debug/println_with_border.cc (revision 1561) @@ -0,0 +1,76 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file tests/debug_println_with_border.cc + * + * \brief Test on mln::debug::println_with_border. + */ + +#include <mln/core/image2d.hh> +#include <mln/core/image1d.hh> +#include <mln/level/fill.hh> +#include <mln/debug/println.hh> +#include <mln/debug/println_with_border.hh> + + +using namespace mln; + + +int main() +{ + border::thickness = 3; + + { + image2d<bool> msk(3, 3); + msk.at(0, 0) = true; + msk.at(1, 0) = true; + msk.at(2, 0) = true; + + msk.at(0, 1) = true; + msk.at(1, 1) = false; + msk.at(2, 1) = true; + + msk.at(0, 2) = true; + msk.at(1, 2) = true; + msk.at(2, 2) = true; + + debug::println(msk); + debug::println_with_border(msk); + } + + { + image1d<bool> msk(3); + msk.at(0) = false; + msk.at(1) = true; + msk.at(2) = false; + + debug::println(msk); + debug::println_with_border(msk); + + } + +} Index: trunk/milena/tests/debug/Makefile.am =================================================================== --- trunk/milena/tests/debug/Makefile.am (revision 1560) +++ trunk/milena/tests/debug/Makefile.am (revision 1561) @@ -1,3 +1,14 @@ ## Process this file through Automake to create Makefile.in -*- Makefile -*- include $(top_srcdir)/milena/tests/tests.mk + +check_PROGRAMS = \ + println \ + println_with_border \ + iota + +println_SOURCES = println.cc +println_with_border_SOURCES = println_with_border.cc +iota_SOURCES = iota.cc + +TESTS = $(check_PROGRAMS) Index: trunk/milena/tests/debug/println.cc =================================================================== --- trunk/milena/tests/debug/println.cc (revision 0) +++ trunk/milena/tests/debug/println.cc (revision 1561) @@ -0,0 +1,46 @@ +// Copyright (C) 2007 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/*! \file tests/debug_println.cc + * + * \brief Test on mln::debug::println. + */ + +#include <mln/core/image2d.hh> +#include <mln/level/fill.hh> +#include <mln/debug/println.hh> + + +using namespace mln; + + +int main() +{ + image2d<bool> msk(3, 3); + msk.at(1, 1) = true; + debug::println(msk); +} Index: trunk/milena/tests/Makefile.am =================================================================== --- trunk/milena/tests/Makefile.am (revision 1560) +++ trunk/milena/tests/Makefile.am (revision 1561) @@ -9,6 +9,7 @@ canvas \ core \ display \ + debug \ draw \ fun \ histo \ Index: trunk/milena/mln/debug/iota.spe.hh =================================================================== --- trunk/milena/mln/debug/iota.spe.hh (revision 1560) +++ trunk/milena/mln/debug/iota.spe.hh (revision 1561) @@ -54,9 +54,7 @@ unsigned i = 0; mln_pixter(I) p(input); for_all(p) - // FIXME : remove the convertion when the bug will be - // resolved. - p.val() = ++i % int(mln_max(mln_value(I))); + p.val() = ++i % mln_max(mln_value(I)); } } // end of namespace mln::debug::impl Index: trunk/milena/mln/debug/iota.hh =================================================================== --- trunk/milena/mln/debug/iota.hh (revision 1560) +++ trunk/milena/mln/debug/iota.hh (revision 1561) @@ -66,9 +66,7 @@ unsigned i = 0; mln_piter(I) p(input.domain()); for_all(p) - // FIXME : remove the convertion when the bug will be - // resolved. - input(p) = ++i % int(mln_max(mln_value(I))); + input(p) = ++i % mln_max(mln_value(I)); } } // end of namespace mln::debug::impl