
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2007-11-19 Guillaume Duhamel <guillaume.duhamel@lrde.epita.fr> Update level tree test. * tests/border/adjust.cc: New file to test adjsut. * tests/border/find.cc: New. Update * tests/border/get.cc, * tests/border/resize.cc: Update these tests. --- adjust.cc | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ find.cc | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ get.cc | 2 +- resize.cc | 30 +++++------------------------- 4 files changed, 104 insertions(+), 26 deletions(-) Index: trunk/milena/tests/border/get.cc =================================================================== --- trunk/milena/tests/border/get.cc (revision 1496) +++ trunk/milena/tests/border/get.cc (revision 1497) @@ -25,7 +25,7 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/*! \file tests/border_get.cc +/*! \file tests/border/get.cc * * \brief Tests on mln::border::get. */ Index: trunk/milena/tests/border/find.cc =================================================================== --- trunk/milena/tests/border/find.cc (revision 0) +++ trunk/milena/tests/border/find.cc (revision 1497) @@ -0,0 +1,50 @@ +// 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/border/find.cc + * + * \brief Tests on mln::border::find. + */ + +#include <mln/core/image2d.hh> +#include <mln/core/sub_image.hh> + +#include <mln/debug/iota.hh> +#include <mln/border/find.hh> +#include <mln/core/clone.hh> + + + +int main() +{ + using namespace mln; + image2d<int> ima(3, 3, 51); + debug::iota(ima); + + box2d b = make::box2d(2,2); + mln_assertion(border::find( clone(ima | b)) == 51); +} Index: trunk/milena/tests/border/resize.cc =================================================================== --- trunk/milena/tests/border/resize.cc (revision 1496) +++ trunk/milena/tests/border/resize.cc (revision 1497) @@ -32,11 +32,9 @@ #include <mln/core/image2d.hh> -#include <mln/debug/iota.hh> #include <mln/value/int_u8.hh> #include <mln/border/resize.hh> -#include <mln/debug/println_with_border.hh> -#include <mln/border/fill.hh> +#include <mln/border/get.hh> using namespace mln; @@ -46,28 +44,10 @@ unsigned border = 1; unsigned new_border = 3; - std::cout << std::endl - << "Test 2d resize" - << std::endl - << std::endl; image2d<value::int_u8> ima(3, 2, border); - debug::iota(ima); - border::fill(ima, 8); - - std::cout << "before resize (" - << border - << ")" - << std::endl; - debug::println_with_border(ima); - std::cout << std::endl; - - + mln_assertion(border::get(ima) == border); border::resize (ima, new_border); - std::cout << "after resize (" - << new_border - << ")" - << std::endl; - debug::println_with_border(ima); - std::cout << std::endl; - + mln_assertion(border::get(ima) == new_border); + border::resize (ima, border); + mln_assertion(border::get(ima) == border); } Index: trunk/milena/tests/border/adjust.cc =================================================================== --- trunk/milena/tests/border/adjust.cc (revision 0) +++ trunk/milena/tests/border/adjust.cc (revision 1497) @@ -0,0 +1,48 @@ +// 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/border/adjust.cc + * + * \brief Tests on mln::border::adjust. + */ + +#include <mln/core/image2d.hh> +#include <mln/border/get.hh> +#include <mln/border/adjust.hh> + +int main() +{ + using namespace mln; + + typedef image2d<int> I; + + I ima(3,3, 51); + border::adjust(ima, 51); + mln_assertion(border::get(ima) == 51); + border::adjust(ima, 2); + mln_assertion(border::get(ima) == 51); +}