
URL: https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008 ChangeLog: 2008-09-12 Guillaume Lazzara <z@lrde.epita.fr> Remove deprecated tests. * milena/tests/core/site_set/p_priority_queue_fast.cc, * milena/tests/core/site_set/p_priority_queue_fast_with_array.cc, * milena/tests/core/site_set/p_runs.cc, * milena/tests/core/site_set/pset_array.cc: Remove these tests according to core/site_set/status.txt. --- mln/level/fill_with_value.hh | 2 mln/set/get.hh | 84 ++++++++++++++++++++++++++++++++ tests/core/image/Makefile.am | 28 +++++----- tests/core/site_set/Makefile.am | 18 +----- tests/core/site_set/p_image.cc | 68 +++++++++++++++++++++++++ tests/core/site_set/p_priority_queue.cc | 7 +- tests/core/site_set/p_set.cc | 20 ++----- tests/core/site_set/pset_if.cc | 6 +- 8 files changed, 187 insertions(+), 46 deletions(-) Index: branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue_fast.cc (deleted) =================================================================== Index: branches/cleanup-2008/milena/tests/core/site_set/p_runs.cc (deleted) =================================================================== Index: branches/cleanup-2008/milena/tests/core/site_set/p_image2d.cc (deleted) =================================================================== Index: branches/cleanup-2008/milena/tests/core/site_set/pset_array.cc (deleted) =================================================================== Index: branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue_fast_with_array.cc (deleted) =================================================================== Index: branches/cleanup-2008/milena/tests/core/site_set/p_image.cc =================================================================== --- branches/cleanup-2008/milena/tests/core/site_set/p_image.cc (revision 0) +++ branches/cleanup-2008/milena/tests/core/site_set/p_image.cc (revision 2246) @@ -0,0 +1,68 @@ +// Copyright (C) 2007, 2008 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/core/site_set/p_image2d.cc + * + * \brief Tests on mln::p_image2d. + */ + +#include <mln/core/image/image2d.hh> +#include <mln/core/site_set/p_image.hh> + +int main() +{ + using namespace mln; + + image2d<bool> ima(box2d(20,20)); + p_image<image2d<bool> > ps(ima); + ps.insert(make::point2d(6, 9)); + ps.insert(make::point2d(4, 2)); + ps.insert(make::point2d(4, 2)); + ps.insert(make::point2d(5, 1)); + mln_assertion(ps.nsites() == 3); + + ps.remove(make::point2d(5, 1)); + ps.remove(make::point2d(5, 1)); + + ps.remove(make::point2d(6, 9)); + ps.remove(make::point2d(4, 2)); + + mln_assertion(ps.nsites() == 0); + mln_assertion(ps.is_empty()); + + mln_fwd_piter_(box2d) p(inplace(make::box2d(13,13,19,15))); + for_all(p) + { + ps.insert(p); + } + ps.clear(); + for_all(p) + { + mln_assertion(!ps.has(p)); + } + +} Index: branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue.cc =================================================================== --- branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue.cc (revision 2245) +++ branches/cleanup-2008/milena/tests/core/site_set/p_priority_queue.cc (revision 2246) @@ -36,6 +36,7 @@ #include <mln/geom/bbox.hh> #include <mln/make/box2d.hh> #include <mln/set/has.hh> +#include <mln/set/get.hh> int main() @@ -95,9 +96,9 @@ q.push(5, p2); q.push(3, p1); -// mln_assertion(q[2] == p3); -// mln_assertion(q[1] == p1); -// mln_assertion(q[0] == p2); + mln_assertion(set::get(q, 2) == p3); + mln_assertion(set::get(q, 0) == p2); + mln_assertion(set::get(q, 1) == p1); q.clear(); mln_assertion(q.is_empty()); } Index: branches/cleanup-2008/milena/tests/core/site_set/Makefile.am =================================================================== --- branches/cleanup-2008/milena/tests/core/site_set/Makefile.am (revision 2245) +++ branches/cleanup-2008/milena/tests/core/site_set/Makefile.am (revision 2246) @@ -4,29 +4,21 @@ check_PROGRAMS = \ p_array \ - p_bgraph \ - p_image2d \ +## p_bgraph \ + p_image \ p_priority_queue \ - p_priority_queue_fast \ - p_priority_queue_fast_with_array \ p_queue \ p_queue_fast \ - p_runs \ p_set \ - pset_array \ pset_if p_array_SOURCES = p_array.cc p_bgraph_SOURCES = p_bgraph.cc -p_image2d_SOURCES = p_image2d.cc +p_image_SOURCES = p_image.cc p_priority_queue_SOURCES = p_priority_queue.cc -p_priority_queue_fast_SOURCES = p_priority_queue_fast.cc -p_priority_queue_fast_with_array_SOURCES = p_priority_queue_fast.cc -p_queue_SOURCES = p_priority_queue_fast.cc -p_queue_fast_SOURCES = p_priority_queue_fast.cc -p_runs_SOURCES = p_runs.cc +p_queue_SOURCES = p_queue.cc +p_queue_fast_SOURCES = p_queue_fast.cc p_set_SOURCES = p_set.cc -pset_array_SOURCES = pset_array.cc pset_if_SOURCES = pset_if.cc TESTS = $(check_PROGRAMS) Index: branches/cleanup-2008/milena/tests/core/site_set/pset_if.cc =================================================================== --- branches/cleanup-2008/milena/tests/core/site_set/pset_if.cc (revision 2245) +++ branches/cleanup-2008/milena/tests/core/site_set/pset_if.cc (revision 2246) @@ -36,6 +36,7 @@ #include <mln/fun/p2b/chess.hh> #include <mln/convert/to_image.hh> #include <mln/convert/to_p_set.hh> +#include <mln/estim/nsites.hh> int main() @@ -43,11 +44,10 @@ using namespace mln; box2d box_8x8 = make::box2d(8, 8); - mln_assertion((box_8x8 | fun::p2b::chess).nsites() == 32); + mln_assertion(estim::nsites((box_8x8 | fun::p2b::chess)) == 32); { p_set<point2d> s = convert::to_p_set(box_8x8 | fun::p2b::chess); - std::cout << (box_8x8 | fun::p2b::chess) << std::endl; - std::cout << s << std::endl; + mln_precondition(s == (box_8x8 | fun::p2b::chess)); } } Index: branches/cleanup-2008/milena/tests/core/site_set/p_set.cc =================================================================== --- branches/cleanup-2008/milena/tests/core/site_set/p_set.cc (revision 2245) +++ branches/cleanup-2008/milena/tests/core/site_set/p_set.cc (revision 2246) @@ -34,6 +34,8 @@ #include <mln/core/alias/point2d.hh> #include <mln/core/site_set/p_set.hh> +#include <mln/make/box2d.hh> +#include <mln/geom/bbox.hh> @@ -42,23 +44,15 @@ using namespace mln; p_set<point2d> ps; - ps - .insert(make::point2d(6, 9)) - .insert(make::point2d(4, 2)) - .insert(make::point2d(4, 2)) - .insert(make::point2d(5, 1)); + ps.insert(point2d(6, 9)); + ps.insert(point2d(4, 2)); + ps.insert(point2d(5, 1)); mln_assertion(ps.nsites() == 3); - std::cout << ps.bbox() << std::endl; - std::copy(ps.vect().begin(), ps.vect().end(), - std::ostream_iterator<point2d>(std::cout, " ")); - std::cout << std::endl; + mln_assertion(geom::bbox(ps) == make::box2d(4,1, 6, 9)); ps.remove(make::point2d(4, 2)); mln_assertion(ps.nsites() == 2); - std::cout << ps.bbox() << std::endl; - std::copy(ps.vect().begin(), ps.vect().end(), - std::ostream_iterator<point2d>(std::cout, " ")); - std::cout << std::endl; + mln_assertion(geom::bbox(ps) == make::box2d(5,1, 6, 9)); } Index: branches/cleanup-2008/milena/tests/core/image/Makefile.am =================================================================== --- branches/cleanup-2008/milena/tests/core/image/Makefile.am (revision 2245) +++ branches/cleanup-2008/milena/tests/core/image/Makefile.am (revision 2246) @@ -3,23 +3,25 @@ include $(top_srcdir)/milena/tests/tests.mk check_PROGRAMS = \ - bgraph_image \ +## bgraph_image \ cast_image \ - complex_image \ +## complex_image \ decorated_image \ flat_image \ - graph_image \ - graph_image_wst \ - hexa \ +## hexa \ +## graph_image \ +## graph_image_wst \ image1d \ image2d \ - image2d_h \ +## image2d_h \ image3d \ image_if \ + image_if_interval \ image_if_value \ - interpolated \ - line_graph_image \ + +## interpolated \ +## line_graph_image \ mono_obased_rle_image \ mono_rle_image \ obased_rle_image \ @@ -33,14 +35,14 @@ translate_image \ value_enc_image -bgraph_image_SOURCES = bgraph_image.cc +##bgraph_image_SOURCES = bgraph_image.cc cast_image_SOURCES = cast_image.cc -complex_image_SOURCES = complex_image.cc +##complex_image_SOURCES = complex_image.cc decorated_image_SOURCES = decorated_image.cc -graph_image_SOURCES = graph_image.cc -graph_image_wst_SOURCES = graph_image_wst.cc +##graph_image_SOURCES = graph_image.cc +##graph_image_wst_SOURCES = graph_image_wst.cc flat_image_SOURCES = flat_image.cc -hexa_SOURCES = hexa.cc +##hexa_SOURCES = hexa.cc image1d_SOURCES = image1d.cc image2d_SOURCES = image2d.cc image2d_h_SOURCES = image2d_h.cc Index: branches/cleanup-2008/milena/mln/level/fill_with_value.hh =================================================================== --- branches/cleanup-2008/milena/mln/level/fill_with_value.hh (revision 2245) +++ branches/cleanup-2008/milena/mln/level/fill_with_value.hh (revision 2246) @@ -81,7 +81,7 @@ template <typename I, typename V> inline - void fill_with_value_tests(Image<I>& ima, const V& val) + void fill_with_value_tests(Image<I>& ima, const V&) { mlc_is(mln_trait_image_value_io(I), mln::trait::image::value_io::read_write)::check(); Index: branches/cleanup-2008/milena/mln/set/get.hh =================================================================== --- branches/cleanup-2008/milena/mln/set/get.hh (revision 0) +++ branches/cleanup-2008/milena/mln/set/get.hh (revision 2246) @@ -0,0 +1,84 @@ +// Copyright (C) 2008 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. + +#ifndef MLN_SET_GET_HH +# define MLN_SET_GET_HH + +/*! \file mln/set/has.hh + * + * \brief Algorithm that returns the i th element in a site set. + * + * \todo Layout and specialize. + */ + +# include <mln/core/concept/site_set.hh> + + + +namespace mln +{ + + namespace set + { + + /// FIXME + template <typename S> + mln_site(S) + get(const Site_Set<S>& s, size_t index); + + +# ifndef MLN_INCLUDE_ONLY + + template <typename S> + mln_site(S) + get(const Site_Set<S>& s_, size_t index) + { + trace::entering("set::get"); + const S& s = exact(s_); + + mln_precondition(s.is_valid()); + mln_precondition(s.nsites() > index); + + mln_piter(S) p(s); + for_all(p) + if (index == 0) + break; + else + --index; + + trace::exiting("set::get"); + return p; + } + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::set + +} // end of namespace mln + + +#endif // ! MLN_SET_GET_HH