URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-30 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add full tests for logical subdirectory.
* tests/logical/and_full.cc,
* tests/logical/and_not_full.cc,
* tests/logical/not_full.cc,
* tests/logical/or_full.cc: New full tests for logical.
---
and_full.cc | 225 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
and_not_full.cc | 225 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
not_full.cc | 187 ++++++++++++++++++++++++++++++++++++++++++++++
or_full.cc | 225 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 862 insertions(+)
Index: trunk/milena/tests/logical/or_full.cc
===================================================================
--- trunk/milena/tests/logical/or_full.cc (revision 0)
+++ trunk/milena/tests/logical/or_full.cc (revision 1576)
@@ -0,0 +1,225 @@
+// 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/logical/or_full.cc
+ *
+ * \brief Tests on mln::logical::or.
+ */
+
+#include <mln/core/image1d.hh>
+#include <mln/core/image2d.hh>
+#include <mln/core/image3d.hh>
+#include <mln/logical/or.hh>
+#include <mln/level/compare.hh>
+#include <mln/level/apply.hh>
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+#include <mln/core/concept/function.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_u16.hh>
+#include <mln/value/int_s8.hh>
+#include <mln/value/int_s16.hh>
+
+#include <mln/literal/zero.hh>
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ template <typename V, typename T = V, typename R = T>
+ struct chess_value_t : public Function_v2v< chess_value_t<V,T,R> >
+ {
+ chess_value_t (V mod) : mod_ (mod) {}
+
+ typedef R result;
+ R operator()(const V& v) const
+ {
+ return v % mod_ ? v : literal::zero;
+ }
+
+ V mod_;
+ };
+
+ }
+
+ }
+
+ template <typename I, typename J>
+ void
+ chck(Image<I>& ima1_, const Image<J>& ima2_)
+ {
+ const I& ima1 = exact(ima1_);
+ I& ima3 = exact(ima1_);
+ const J& ima2 = exact(ima2_);
+ mln_concrete(I) log = logical::or_(ima1, ima2);
+
+ mln_assertion (ima2.domain () >= ima1.domain ());
+ mln_piter(I) p (ima1.domain ());
+ for_all(p)
+ mln_assertion ((ima1(p) || ima2(p)) == log(p));
+ logical::or_inplace(ima3, ima2);
+ for_all(p)
+ mln_assertion (ima3(p) == log(p));
+ }
+
+
+ template <typename I, typename J>
+ void
+ chk1d(unsigned col,
+ unsigned mod1, unsigned mod2)
+ {
+ image1d<I> ima1 (col);
+ image1d<J> ima2 (col);
+
+ debug::iota(ima1);
+ debug::iota(ima2);
+
+ level::apply(ima1, fun::v2v::chess_value_t<I>(mod1) );
+ level::apply(ima2, fun::v2v::chess_value_t<J>(mod2) );
+
+ chck(ima1, ima2);
+ }
+
+
+ template <typename I, typename J>
+ void
+ chk2d(unsigned row, unsigned col,
+ unsigned mod1, unsigned mod2)
+ {
+ image2d<I> ima1 (row, col);
+ image2d<J> ima2 (row, col);
+
+ debug::iota(ima1);
+ debug::iota(ima2);
+
+ level::apply(ima1, fun::v2v::chess_value_t<I>(mod1) );
+ level::apply(ima2, fun::v2v::chess_value_t<J>(mod2) );
+
+ chck(ima1, ima2);
+ }
+
+
+ template <typename I, typename J>
+ void
+ chk3d(unsigned sli, unsigned row, unsigned col,
+ unsigned mod1, unsigned mod2)
+ {
+ image3d<I> ima1 (sli, row, col);
+ image3d<J> ima2 (sli, row, col);
+
+ debug::iota(ima1);
+ debug::iota(ima2);
+
+ level::apply(ima1, fun::v2v::chess_value_t<I>(mod1) );
+ level::apply(ima2, fun::v2v::chess_value_t<J>(mod2) );
+
+ chck(ima1, ima2);
+ }
+
+
+}
+
+
+
+
+
+int main()
+{
+ using namespace mln;
+
+ unsigned max_mod1 = 8;
+ unsigned max_mod2 = 8;
+ unsigned max_cols = 16;
+ unsigned max_rows = 8;
+ unsigned max_slis = 2;
+
+ std::cerr << "Tests logical::or" << std::endl;
+
+ (std::cerr << "in 1d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod1; ++i)
+ for (unsigned j = 1; j < max_mod2; ++j)
+ for (unsigned k = 1; k < max_cols; ++k)
+ {
+ chk1d<int, int>(k, i, j);
+ chk1d<unsigned, unsigned>(k, i, j);
+ chk1d<value::int_s8, value::int_s8>(k, i, j);
+ chk1d<int, unsigned>(k, i, j);
+ chk1d<unsigned, value::int_u8>(k, i, j);
+ chk1d<int, value::int_s8>(k, i, j);
+ chk1d<unsigned, value::int_u16>(k, i, j);
+ chk1d<int, value::int_s16>(k, i, j);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+ (std::cerr << "in 2d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod1; ++i)
+ for (unsigned j = 1; j < max_mod2; ++j)
+ for (unsigned k = 1; k < max_cols; ++k)
+ for (unsigned l = 1; l < max_rows; ++l)
+ {
+ chk2d<int, int>(l ,k, i, j);
+ chk2d<unsigned, unsigned>(l ,k, i, j);
+ chk2d<value::int_s8, value::int_s8>(l ,k, i, j);
+ chk2d<int, unsigned>(l ,k, i, j);
+ chk2d<unsigned, value::int_u8>(l ,k, i, j);
+ chk2d<int, value::int_s8>(l ,k, i, j);
+ chk2d<unsigned, value::int_u16>(l ,k, i, j);
+ chk2d<int, value::int_s16>(l ,k, i, j);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+ (std::cerr << "in 3d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod1; ++i)
+ for (unsigned j = 1; j < max_mod2; ++j)
+ for (unsigned k = 1; k < max_cols; ++k)
+ for (unsigned l = 1; l < max_rows; ++l)
+ for (unsigned m = 1; m < max_slis; ++m)
+ {
+ chk3d<int, int>(m, l ,k, i, j);
+ chk3d<unsigned, unsigned>(m, l ,k, i, j);
+ chk3d<value::int_s8, value::int_s8>(m, l ,k, i, j);
+ chk3d<int, unsigned>(m, l ,k, i, j);
+ chk3d<unsigned, value::int_u8>(m, l ,k, i, j);
+ chk3d<int, value::int_s8>(m, l ,k, i, j);
+ chk3d<unsigned, value::int_u16>(m, l ,k, i, j);
+ chk3d<int, value::int_s16>(m, l ,k, i, j);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+}
Index: trunk/milena/tests/logical/not_full.cc
===================================================================
--- trunk/milena/tests/logical/not_full.cc (revision 0)
+++ trunk/milena/tests/logical/not_full.cc (revision 1576)
@@ -0,0 +1,187 @@
+// 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/logical/and_full.cc
+ *
+ * \brief Tests on mln::logical::and.
+ */
+
+#include <mln/core/image1d.hh>
+#include <mln/core/image2d.hh>
+#include <mln/core/image3d.hh>
+#include <mln/logical/not.hh>
+#include <mln/level/compare.hh>
+#include <mln/level/apply.hh>
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+#include <mln/core/concept/function.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_u16.hh>
+#include <mln/value/int_s8.hh>
+#include <mln/value/int_s16.hh>
+
+#include <mln/literal/zero.hh>
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ template <typename V, typename T = V, typename R = T>
+ struct chess_value_t : public Function_v2v< chess_value_t<V,T,R> >
+ {
+ chess_value_t (V mod) : mod_ (mod) {}
+
+ typedef R result;
+ R operator()(const V& v) const
+ {
+ return v % mod_ ? v : literal::zero;
+ }
+
+ V mod_;
+ };
+
+ }
+
+ }
+
+ template <typename I>
+ void
+ chck(Image<I>& ima_)
+ {
+ const I& ima = exact(ima_);
+ I& ima2 = exact(ima_);
+ mln_concrete(I) log = logical::not_(ima);
+
+ mln_piter(I) p (ima.domain ());
+ for_all(p)
+ mln_assertion (!ima(p) == log(p));
+ logical::not_inplace(ima2);
+ for_all(p)
+ mln_assertion (ima2(p) == log(p));
+ }
+
+
+ template <typename I>
+ void
+ chk1d(unsigned col, unsigned mod)
+ {
+ image1d<I> ima (col);
+ debug::iota(ima);
+ level::apply(ima, fun::v2v::chess_value_t<I>(mod) );
+
+ chck(ima);
+ }
+
+
+ template <typename I>
+ void
+ chk2d(unsigned row, unsigned col, unsigned mod)
+ {
+ image2d<I> ima (row, col);
+ debug::iota(ima);
+ level::apply(ima, fun::v2v::chess_value_t<I>(mod) );
+
+ chck(ima);
+ }
+
+
+ template <typename I>
+ void
+ chk3d(unsigned sli, unsigned row, unsigned col,
+ unsigned mod)
+ {
+ image3d<I> ima (sli, row, col);
+ debug::iota(ima);
+ level::apply(ima, fun::v2v::chess_value_t<I>(mod) );
+
+ chck(ima);
+ }
+
+}
+
+
+
+int main()
+{
+ using namespace mln;
+
+ unsigned max_mod = 64;
+ unsigned max_cols = 128;
+ unsigned max_rows = 4;
+ unsigned max_slis = 2;
+
+ std::cerr << "Tests logical::not" << std::endl;
+
+ (std::cerr << "in 1d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod; ++i)
+ for (unsigned j = 1; j < max_cols; ++j)
+ {
+ chk1d<int>(j, i);
+ chk1d<unsigned>(j, i);
+ chk1d<value::int_s8>(j, i);
+ chk1d<value::int_s16>(j, i);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+ (std::cerr << "in 2d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod; ++i)
+ for (unsigned j = 1; j < max_rows; ++j)
+ for (unsigned k = 1; k < max_cols; ++k)
+ {
+ chk2d<int>(j, k, i);
+ chk2d<unsigned>(j, k, i);
+ chk2d<value::int_s8>(j, k, i);
+ chk2d<value::int_s16>(j, k, i);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+ (std::cerr << "in 3d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod; ++i)
+ for (unsigned j = 1; j < max_slis; ++j)
+ for (unsigned k = 1; k < max_rows; ++k)
+ for (unsigned l = 1; l < max_cols; ++l)
+ {
+ chk3d<int>(j, k, l, i);
+ chk3d<unsigned>(j, k, l, i);
+ chk3d<value::int_s8>(j, k, l, i);
+ chk3d<value::int_s16>(j, k, l, i);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+}
Index: trunk/milena/tests/logical/and_not_full.cc
===================================================================
--- trunk/milena/tests/logical/and_not_full.cc (revision 0)
+++ trunk/milena/tests/logical/and_not_full.cc (revision 1576)
@@ -0,0 +1,225 @@
+// 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/logical/and_not_full.cc
+ *
+ * \brief Tests on mln::logical::and.
+ */
+
+#include <mln/core/image1d.hh>
+#include <mln/core/image2d.hh>
+#include <mln/core/image3d.hh>
+#include <mln/logical/and_not.hh>
+#include <mln/level/compare.hh>
+#include <mln/level/apply.hh>
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+#include <mln/core/concept/function.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_u16.hh>
+#include <mln/value/int_s8.hh>
+#include <mln/value/int_s16.hh>
+
+#include <mln/literal/zero.hh>
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ template <typename V, typename T = V, typename R = T>
+ struct chess_value_t : public Function_v2v< chess_value_t<V,T,R> >
+ {
+ chess_value_t (V mod) : mod_ (mod) {}
+
+ typedef R result;
+ R operator()(const V& v) const
+ {
+ return v % mod_ ? v : literal::zero;
+ }
+
+ V mod_;
+ };
+
+ }
+
+ }
+
+ template <typename I, typename J>
+ void
+ chck(Image<I>& ima1_, const Image<J>& ima2_)
+ {
+ const I& ima1 = exact(ima1_);
+ I& ima3 = exact(ima1_);
+ const J& ima2 = exact(ima2_);
+ mln_concrete(I) log = logical::and_not(ima1, ima2);
+
+ mln_assertion (ima2.domain () >= ima1.domain ());
+ mln_piter(I) p (ima1.domain ());
+ for_all(p)
+ mln_assertion ((ima1(p) && !ima2(p)) == log(p));
+ logical::and_not_inplace(ima3, ima2);
+ for_all(p)
+ mln_assertion (ima3(p) == log(p));
+ }
+
+
+ template <typename I, typename J>
+ void
+ chk1d(unsigned col,
+ unsigned mod1, unsigned mod2)
+ {
+ image1d<I> ima1 (col);
+ image1d<J> ima2 (col);
+
+ debug::iota(ima1);
+ debug::iota(ima2);
+
+ level::apply(ima1, fun::v2v::chess_value_t<I>(mod1) );
+ level::apply(ima2, fun::v2v::chess_value_t<J>(mod2) );
+
+ chck(ima1, ima2);
+ }
+
+
+ template <typename I, typename J>
+ void
+ chk2d(unsigned row, unsigned col,
+ unsigned mod1, unsigned mod2)
+ {
+ image2d<I> ima1 (row, col);
+ image2d<J> ima2 (row, col);
+
+ debug::iota(ima1);
+ debug::iota(ima2);
+
+ level::apply(ima1, fun::v2v::chess_value_t<I>(mod1) );
+ level::apply(ima2, fun::v2v::chess_value_t<J>(mod2) );
+
+ chck(ima1, ima2);
+ }
+
+
+ template <typename I, typename J>
+ void
+ chk3d(unsigned sli, unsigned row, unsigned col,
+ unsigned mod1, unsigned mod2)
+ {
+ image3d<I> ima1 (sli, row, col);
+ image3d<J> ima2 (sli, row, col);
+
+ debug::iota(ima1);
+ debug::iota(ima2);
+
+ level::apply(ima1, fun::v2v::chess_value_t<I>(mod1) );
+ level::apply(ima2, fun::v2v::chess_value_t<J>(mod2) );
+
+ chck(ima1, ima2);
+ }
+
+
+}
+
+
+
+
+
+int main()
+{
+ using namespace mln;
+
+ unsigned max_mod1 = 8;
+ unsigned max_mod2 = 8;
+ unsigned max_cols = 16;
+ unsigned max_rows = 8;
+ unsigned max_slis = 2;
+
+ std::cerr << "Tests logical::and_not" << std::endl;
+
+ (std::cerr << "in 1d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod1; ++i)
+ for (unsigned j = 1; j < max_mod2; ++j)
+ for (unsigned k = 1; k < max_cols; ++k)
+ {
+ chk1d<int, int>(k, i, j);
+ chk1d<unsigned, unsigned>(k, i, j);
+ chk1d<value::int_s8, value::int_s8>(k, i, j);
+ chk1d<int, unsigned>(k, i, j);
+ chk1d<unsigned, value::int_u8>(k, i, j);
+ chk1d<int, value::int_s8>(k, i, j);
+ chk1d<unsigned, value::int_u16>(k, i, j);
+ chk1d<int, value::int_s16>(k, i, j);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+ (std::cerr << "in 2d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod1; ++i)
+ for (unsigned j = 1; j < max_mod2; ++j)
+ for (unsigned k = 1; k < max_cols; ++k)
+ for (unsigned l = 1; l < max_rows; ++l)
+ {
+ chk2d<int, int>(l ,k, i, j);
+ chk2d<unsigned, unsigned>(l ,k, i, j);
+ chk2d<value::int_s8, value::int_s8>(l ,k, i, j);
+ chk2d<int, unsigned>(l ,k, i, j);
+ chk2d<unsigned, value::int_u8>(l ,k, i, j);
+ chk2d<int, value::int_s8>(l ,k, i, j);
+ chk2d<unsigned, value::int_u16>(l ,k, i, j);
+ chk2d<int, value::int_s16>(l ,k, i, j);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+ (std::cerr << "in 3d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod1; ++i)
+ for (unsigned j = 1; j < max_mod2; ++j)
+ for (unsigned k = 1; k < max_cols; ++k)
+ for (unsigned l = 1; l < max_rows; ++l)
+ for (unsigned m = 1; m < max_slis; ++m)
+ {
+ chk3d<int, int>(m, l ,k, i, j);
+ chk3d<unsigned, unsigned>(m, l ,k, i, j);
+ chk3d<value::int_s8, value::int_s8>(m, l ,k, i, j);
+ chk3d<int, unsigned>(m, l ,k, i, j);
+ chk3d<unsigned, value::int_u8>(m, l ,k, i, j);
+ chk3d<int, value::int_s8>(m, l ,k, i, j);
+ chk3d<unsigned, value::int_u16>(m, l ,k, i, j);
+ chk3d<int, value::int_s16>(m, l ,k, i, j);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+}
Index: trunk/milena/tests/logical/and_full.cc
===================================================================
--- trunk/milena/tests/logical/and_full.cc (revision 0)
+++ trunk/milena/tests/logical/and_full.cc (revision 1576)
@@ -0,0 +1,225 @@
+// 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/logical/and_full.cc
+ *
+ * \brief Tests on mln::logical::and.
+ */
+
+#include <mln/core/image1d.hh>
+#include <mln/core/image2d.hh>
+#include <mln/core/image3d.hh>
+#include <mln/logical/and.hh>
+#include <mln/level/compare.hh>
+#include <mln/level/apply.hh>
+#include <mln/debug/iota.hh>
+#include <mln/debug/println.hh>
+#include <mln/core/concept/function.hh>
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_u16.hh>
+#include <mln/value/int_s8.hh>
+#include <mln/value/int_s16.hh>
+
+#include <mln/literal/zero.hh>
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ template <typename V, typename T = V, typename R = T>
+ struct chess_value_t : public Function_v2v< chess_value_t<V,T,R> >
+ {
+ chess_value_t (V mod) : mod_ (mod) {}
+
+ typedef R result;
+ R operator()(const V& v) const
+ {
+ return v % mod_ ? v : literal::zero;
+ }
+
+ V mod_;
+ };
+
+ }
+
+ }
+
+ template <typename I, typename J>
+ void
+ chck(Image<I>& ima1_, const Image<J>& ima2_)
+ {
+ const I& ima1 = exact(ima1_);
+ I& ima3 = exact(ima1_);
+ const J& ima2 = exact(ima2_);
+ mln_concrete(I) log = logical::and_(ima1, ima2);
+
+ mln_assertion (ima2.domain () >= ima1.domain ());
+ mln_piter(I) p (ima1.domain ());
+ for_all(p)
+ mln_assertion ((ima1(p) && ima2(p)) == log(p));
+ logical::and_inplace(ima3, ima2);
+ for_all(p)
+ mln_assertion (ima3(p) == log(p));
+ }
+
+
+ template <typename I, typename J>
+ void
+ chk1d(unsigned col,
+ unsigned mod1, unsigned mod2)
+ {
+ image1d<I> ima1 (col);
+ image1d<J> ima2 (col);
+
+ debug::iota(ima1);
+ debug::iota(ima2);
+
+ level::apply(ima1, fun::v2v::chess_value_t<I>(mod1) );
+ level::apply(ima2, fun::v2v::chess_value_t<J>(mod2) );
+
+ chck(ima1, ima2);
+ }
+
+
+ template <typename I, typename J>
+ void
+ chk2d(unsigned row, unsigned col,
+ unsigned mod1, unsigned mod2)
+ {
+ image2d<I> ima1 (row, col);
+ image2d<J> ima2 (row, col);
+
+ debug::iota(ima1);
+ debug::iota(ima2);
+
+ level::apply(ima1, fun::v2v::chess_value_t<I>(mod1) );
+ level::apply(ima2, fun::v2v::chess_value_t<J>(mod2) );
+
+ chck(ima1, ima2);
+ }
+
+
+ template <typename I, typename J>
+ void
+ chk3d(unsigned sli, unsigned row, unsigned col,
+ unsigned mod1, unsigned mod2)
+ {
+ image3d<I> ima1 (sli, row, col);
+ image3d<J> ima2 (sli, row, col);
+
+ debug::iota(ima1);
+ debug::iota(ima2);
+
+ level::apply(ima1, fun::v2v::chess_value_t<I>(mod1) );
+ level::apply(ima2, fun::v2v::chess_value_t<J>(mod2) );
+
+ chck(ima1, ima2);
+ }
+
+
+}
+
+
+
+
+
+int main()
+{
+ using namespace mln;
+
+ unsigned max_mod1 = 8;
+ unsigned max_mod2 = 8;
+ unsigned max_cols = 16;
+ unsigned max_rows = 8;
+ unsigned max_slis = 2;
+
+ std::cerr << "Tests logical::and" << std::endl;
+
+ (std::cerr << "in 1d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod1; ++i)
+ for (unsigned j = 1; j < max_mod2; ++j)
+ for (unsigned k = 1; k < max_cols; ++k)
+ {
+ chk1d<int, int>(k, i, j);
+ chk1d<unsigned, unsigned>(k, i, j);
+ chk1d<value::int_s8, value::int_s8>(k, i, j);
+ chk1d<int, unsigned>(k, i, j);
+ chk1d<unsigned, value::int_u8>(k, i, j);
+ chk1d<int, value::int_s8>(k, i, j);
+ chk1d<unsigned, value::int_u16>(k, i, j);
+ chk1d<int, value::int_s16>(k, i, j);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+ (std::cerr << "in 2d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod1; ++i)
+ for (unsigned j = 1; j < max_mod2; ++j)
+ for (unsigned k = 1; k < max_cols; ++k)
+ for (unsigned l = 1; l < max_rows; ++l)
+ {
+ chk2d<int, int>(l ,k, i, j);
+ chk2d<unsigned, unsigned>(l ,k, i, j);
+ chk2d<value::int_s8, value::int_s8>(l ,k, i, j);
+ chk2d<int, unsigned>(l ,k, i, j);
+ chk2d<unsigned, value::int_u8>(l ,k, i, j);
+ chk2d<int, value::int_s8>(l ,k, i, j);
+ chk2d<unsigned, value::int_u16>(l ,k, i, j);
+ chk2d<int, value::int_s16>(l ,k, i, j);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+ (std::cerr << "in 3d ... ").flush ();
+ {
+ for (unsigned i = 1; i < max_mod1; ++i)
+ for (unsigned j = 1; j < max_mod2; ++j)
+ for (unsigned k = 1; k < max_cols; ++k)
+ for (unsigned l = 1; l < max_rows; ++l)
+ for (unsigned m = 1; m < max_slis; ++m)
+ {
+ chk3d<int, int>(m, l ,k, i, j);
+ chk3d<unsigned, unsigned>(m, l ,k, i, j);
+ chk3d<value::int_s8, value::int_s8>(m, l ,k, i, j);
+ chk3d<int, unsigned>(m, l ,k, i, j);
+ chk3d<unsigned, value::int_u8>(m, l ,k, i, j);
+ chk3d<int, value::int_s8>(m, l ,k, i, j);
+ chk3d<unsigned, value::int_u16>(m, l ,k, i, j);
+ chk3d<int, value::int_s16>(m, l ,k, i, j);
+ }
+ }
+ std::cerr << "OK" << std::endl;
+
+}
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-29 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add full tests for border.
* tests/border/equalize_full.cc,
* tests/border/find_full.cc,
* tests/border/resize_full.cc: New full tests.
* tests/border/resize.cc: Fix typo.
---
equalize_full.cc | 84 ++++++++++++++++++++++++++++
find_full.cc | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
resize.cc | 2
resize_full.cc | 135 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 380 insertions(+), 1 deletion(-)
Index: trunk/milena/tests/border/resize.cc
===================================================================
--- trunk/milena/tests/border/resize.cc (revision 1570)
+++ trunk/milena/tests/border/resize.cc (revision 1571)
@@ -25,7 +25,7 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/border_resize_image2d_1.cc
+/*! \file tests/border/resize.cc
*
* \brief Tests on mln::border::resize.
*/
Index: trunk/milena/tests/border/equalize_full.cc
===================================================================
--- trunk/milena/tests/border/equalize_full.cc (revision 0)
+++ trunk/milena/tests/border/equalize_full.cc (revision 1571)
@@ -0,0 +1,84 @@
+// 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/equalize_full.cc
+ *
+ * \brief Tests on mln::border::equalize.
+ */
+
+#include <mln/core/image1d.hh>
+#include <mln/core/image2d.hh>
+#include <mln/core/image3d.hh>
+#include <mln/border/get.hh>
+#include <mln/border/equalize.hh>
+
+int main()
+{
+ using namespace mln;
+ unsigned sli = 5;
+ unsigned row = 10;
+ unsigned col = 20;
+ unsigned border1 = 42;
+ unsigned border2 = 36;
+ unsigned new_border = 51;
+
+
+
+ {
+ typedef image1d<int> I;
+ (std::cerr << "Tests border::equalize in 1d ... ").flush ();
+ I ima1(col, border1);
+ I ima2(col, border2);
+ border::equalize(ima1, ima2, new_border);
+ mln_assertion(border::get(ima1) == new_border);
+ mln_assertion(border::get(ima2) == new_border);
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ typedef image2d<int> I;
+ (std::cerr << "Tests border::equalize in 2d ... ").flush ();
+ I ima1(row, col, border1);
+ I ima2(row, col, border2);
+ border::equalize(ima1, ima2, new_border);
+ mln_assertion(border::get(ima1) == new_border);
+ mln_assertion(border::get(ima2) == new_border);
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ typedef image3d<int> I;
+ (std::cerr << "Tests border::equalize in 3d ... ").flush ();
+ I ima1(sli, row, col, border1);
+ I ima2(sli, row, col, border2);
+ border::equalize(ima1, ima2, new_border);
+ mln_assertion(border::get(ima1) == new_border);
+ mln_assertion(border::get(ima2) == new_border);
+ std::cerr << "OK" << std::endl;
+ }
+
+}
Index: trunk/milena/tests/border/find_full.cc
===================================================================
--- trunk/milena/tests/border/find_full.cc (revision 0)
+++ trunk/milena/tests/border/find_full.cc (revision 1571)
@@ -0,0 +1,160 @@
+// 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_full.cc
+ *
+ * \brief Tests on mln::border::find.
+ */
+
+#include <mln/core/image1d.hh>
+#include <mln/core/image2d.hh>
+#include <mln/core/image3d.hh>
+#include <mln/core/sub_image.hh>
+
+#include <mln/core/image_if.hh>
+#include <mln/fun/p2b/chess.hh>
+#include <mln/border/find.hh>
+#include <mln/literal/origin.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/value/rgb8.hh>
+
+
+#include <mln/debug/iota.hh>
+#include <mln/border/find.hh>
+#include <mln/core/clone.hh>
+
+
+struct f_box1d_t : mln::Function_p2b< f_box1d_t >
+{
+ f_box1d_t(const mln::box1d& b)
+ : b_(b)
+ {
+ }
+ mln::box1d b_;
+ bool operator()(const mln::point1d& p) const
+ {
+ return b_.has(p);
+ }
+};
+
+struct f_box2d_t : mln::Function_p2b< f_box2d_t >
+{
+ f_box2d_t(const mln::box2d& b)
+ : b_(b)
+ {
+ }
+ mln::box2d b_;
+ bool operator()(const mln::point2d& p) const
+ {
+ return b_.has(p);
+ }
+};
+
+struct f_box3d_t : mln::Function_p2b< f_box3d_t >
+{
+ f_box3d_t(const mln::box3d& b)
+ : b_(b)
+ {
+ }
+ mln::box3d b_;
+ bool operator()(const mln::point3d& p) const
+ {
+ return b_.has(p);
+ }
+};
+
+
+int main()
+{
+ using namespace mln;
+
+ box1d b1(literal::origin, point1d(1));
+ box2d b2(literal::origin, point2d(1,1));
+ box3d b3(literal::origin, point3d(1,1,1));
+ f_box1d_t f_b1(b1);
+ f_box2d_t f_b2(b2);
+ f_box3d_t f_b3(b3);
+ mln::fun::p2b::chess_t c_b;
+
+ {
+ typedef image1d<int> I;
+ (std::cerr << "Tests border::find on int in 1d ... ").flush ();
+ I ima(3, 51);
+ debug::iota(ima);
+ mln_assertion(border::find(ima) == 51);
+ sub_image<I, box1d> sub(ima, b1);
+ mln_assertion(border::find(sub) == 51);
+
+ image_if<I, f_box1d_t> imaif(ima, f_b1);
+ mln_assertion(border::find(imaif) == 51);
+
+ mln_assertion(border::find( (ima | b1) ) == 51);
+ mln_assertion(border::find( (ima | b1) | f_b1 ) == 51);
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ typedef image2d<value::int_u8> I;
+ (std::cerr << "Tests border::find on int_u8 in 2d ... ").flush ();
+ I ima(10, 10, 42);
+ debug::iota(ima);
+ mln_assertion(border::find(ima) == 42);
+ sub_image<I, box2d> sub(ima, b2);
+ mln_assertion(border::find(sub) == 42);
+
+ image_if<I, f_box2d_t > imaif(ima, f_b2);
+ mln_assertion(border::find(imaif) == 42);
+
+ image_if<I, fun::p2b::chess_t > imaif_chess(ima, c_b);
+ mln_assertion(border::find(imaif_chess) == 42);
+
+
+ mln_assertion(border::find( (ima | b2) ) == 42);
+ mln_assertion(border::find( (ima | b2) | f_b2 ) == 42);
+ mln_assertion(border::find( (ima | b2) | c_b ) == 42);
+ mln_assertion(border::find( (ima | b2) | c_b | f_b2 ) == 42);
+ mln_assertion(border::find( (ima | b2) | f_b2 | c_b ) == 42);
+
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ typedef image3d<value::rgb8> I;
+ (std::cerr << "Tests border::find on rgb8 in 3d ... ").flush ();
+ I ima(10, 10, 10, 36);
+ mln_assertion(border::find(ima) == 36);
+ mln_assertion( ima.has(point3d(2,2,2)) == true );
+ sub_image<I, box3d> sub(ima, b3);
+ mln_assertion(border::find(sub) == 36);
+
+ image_if<I, f_box3d_t> imaif(ima, f_b3);
+ mln_assertion(border::find(imaif) == 36);
+ mln_assertion(border::find( (ima | b3) ) == 36);
+ mln_assertion(border::find( (ima | b3) | f_b3 ) == 36);
+ std::cerr << "OK" << std::endl;
+ }
+}
Index: trunk/milena/tests/border/resize_full.cc
===================================================================
--- trunk/milena/tests/border/resize_full.cc (revision 0)
+++ trunk/milena/tests/border/resize_full.cc (revision 1571)
@@ -0,0 +1,135 @@
+// 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/resize_full.cc
+ *
+ * \brief Tests on mln::border::resize.
+ */
+
+
+#include <mln/core/image1d.hh>
+#include <mln/core/image2d.hh>
+#include <mln/core/image3d.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/border/resize.hh>
+#include <mln/border/get.hh>
+
+using namespace mln;
+
+int
+main (void)
+{
+ unsigned sli = 51;
+ unsigned row = 42;
+ unsigned col = 100;
+
+
+
+ unsigned border1 = 1;
+ unsigned border2 = 3;
+ unsigned border3 = 42;
+ unsigned border4 = 51;
+ unsigned border5 = 36;
+ unsigned border6 = 2;
+ unsigned border7 = 0;
+ unsigned border8 = 8;
+ unsigned border9 = 1;
+
+
+ {
+ (std::cerr << "Test border::resize in 1d ... ").flush ();
+ image1d<value::int_u8> ima(col, border1);
+
+ mln_assertion(border::get(ima) == border1);
+ border::resize (ima, border2);
+ mln_assertion(border::get(ima) == border2);
+ border::resize (ima, border3);
+ mln_assertion(border::get(ima) == border3);
+ border::resize (ima, border4);
+ mln_assertion(border::get(ima) == border4);
+ border::resize (ima, border5);
+ mln_assertion(border::get(ima) == border5);
+ border::resize (ima, border6);
+ mln_assertion(border::get(ima) == border6);
+ border::resize (ima, border7);
+ mln_assertion(border::get(ima) == border7);
+ border::resize (ima, border8);
+ mln_assertion(border::get(ima) == border8);
+ border::resize (ima, border9);
+ mln_assertion(border::get(ima) == border9);
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ (std::cerr << "Test border::resize in 2d ... ").flush ();
+ image2d<value::int_u8> ima(row, col, border1);
+
+ mln_assertion(border::get(ima) == border1);
+ border::resize (ima, border2);
+ mln_assertion(border::get(ima) == border2);
+ border::resize (ima, border3);
+ mln_assertion(border::get(ima) == border3);
+ border::resize (ima, border4);
+ mln_assertion(border::get(ima) == border4);
+ border::resize (ima, border5);
+ mln_assertion(border::get(ima) == border5);
+ border::resize (ima, border6);
+ mln_assertion(border::get(ima) == border6);
+ border::resize (ima, border7);
+ mln_assertion(border::get(ima) == border7);
+ border::resize (ima, border8);
+ mln_assertion(border::get(ima) == border8);
+ border::resize (ima, border9);
+ mln_assertion(border::get(ima) == border9);
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ (std::cerr << "Test border::resize in 3d ... ").flush ();
+ image3d<value::int_u8> ima(sli, row, col, border1);
+
+ mln_assertion(border::get(ima) == border1);
+ border::resize (ima, border2);
+ mln_assertion(border::get(ima) == border2);
+ border::resize (ima, border3);
+ mln_assertion(border::get(ima) == border3);
+ border::resize (ima, border4);
+ mln_assertion(border::get(ima) == border4);
+ border::resize (ima, border5);
+ mln_assertion(border::get(ima) == border5);
+ border::resize (ima, border6);
+ mln_assertion(border::get(ima) == border6);
+ border::resize (ima, border7);
+ mln_assertion(border::get(ima) == border7);
+ border::resize (ima, border8);
+ mln_assertion(border::get(ima) == border8);
+ border::resize (ima, border9);
+ mln_assertion(border::get(ima) == border9);
+ std::cerr << "OK" << std::endl;
+ }
+
+}
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-28 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add full test for border::get.
* tests/border/get_full.cc: New full test.
---
get_full.cc | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 116 insertions(+)
Index: trunk/milena/tests/border/get_full.cc
===================================================================
--- trunk/milena/tests/border/get_full.cc (revision 0)
+++ trunk/milena/tests/border/get_full.cc (revision 1567)
@@ -0,0 +1,116 @@
+// 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/get_full.cc
+ *
+ * \brief Tests on mln::border::get.
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/core/sub_image.hh>
+#include <mln/core/image_if.hh>
+#include <mln/fun/p2b/chess.hh>
+
+#include <mln/border/get.hh>
+#include <mln/literal/origin.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/value/rgb8.hh>
+
+
+struct f_box2d_t : mln::Function_p2b< f_box2d_t >
+{
+ f_box2d_t(const mln::box2d& b)
+ : b_(b)
+ {
+ }
+ mln::box2d b_;
+ bool operator()(const mln::point2d& p) const
+ {
+ return b_.has(p);
+ }
+};
+
+
+
+int main()
+{
+ using namespace mln;
+
+ box2d b(literal::origin, point2d(1,1));
+ f_box2d_t f_b(b);
+ mln::fun::p2b::chess_t c_b;
+
+ {
+ typedef image2d<int> I;
+ (std::cerr << "Tests border::get on int ... ").flush ();
+ I ima(3,3, 51);
+
+ mln_assertion(border::get(ima) == 51);
+ sub_image<I, box2d> sub(ima, b);
+ mln_assertion(border::get(sub) == 0);
+
+ image_if<I, f_box2d_t> imaif(ima, f_b);
+ mln_assertion(border::get(imaif) == 51);
+ mln_assertion(border::get( (ima | b) ) == 0);
+ mln_assertion(border::get( (ima | b) | f_b ) == 0);
+ std::cerr << "OK" << std::endl;
+ }
+
+
+ {
+ typedef image2d<value::int_u8> I;
+ (std::cerr << "Tests border::get on int_u8 ... ").flush ();
+ I ima(10, 10, 42);
+ mln_assertion(border::get(ima) == 42);
+ mln_assertion( ima.has(point2d(2,2)) == true );
+ sub_image<I, box2d> sub(ima, b);
+ mln_assertion(border::get(sub) == 0);
+
+ image_if<I, mln::fun::p2b::chess_t > imaif(ima, c_b);
+ mln_assertion(border::get(imaif) == 42);
+ mln_assertion(border::get( (ima | b) ) == 0);
+ mln_assertion(border::get( (ima | b) | c_b ) == 0);
+ std::cerr << "OK" << std::endl;
+ }
+
+ {
+ typedef image2d<value::rgb8> I;
+ (std::cerr << "Tests border::get on rgb8 ... ").flush ();
+ I ima(10, 10, 36);
+ mln_assertion(border::get(ima) == 36);
+ mln_assertion( ima.has(point2d(2,2)) == true );
+ sub_image<I, box2d> sub(ima, b);
+ mln_assertion(border::get(sub) == 0);
+
+ image_if<I, mln::fun::p2b::chess_t > imaif(ima, c_b);
+ mln_assertion(border::get(imaif) == 36);
+ mln_assertion(border::get( (ima | b) ) == 0);
+ mln_assertion(border::get( (ima | b) | c_b ) == 0);
+ std::cerr << "OK" << std::endl;
+ }
+
+}