Commit cb82d5a5 authored by Ugo Jardonnet's avatar Ugo Jardonnet
Browse files

Add test for neighborhood.

	* tests/core/neighb2d.cc: New.
	* tests/core/Makefile.am: .
	* oln/core/automatic/impl.hh: .
	* oln/core/abstract/internal/image_impl.hh: .


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@861 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 9296b4a9
2007-03-09 Ugo Jardonnet <ugo.jardonnet@lrde.epita.fr>
Add test for neighborhood.
* tests/core/neighb2d.cc: New.
* tests/core/Makefile.am: .
* oln/core/automatic/impl.hh: .
* oln/core/abstract/internal/image_impl.hh: .
2007-03-09 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Update tests.
......
......@@ -29,7 +29,7 @@
# define OLN_CORE_ABSTRACT_INTERNAL_IMAGE_IMPL_HH
# include <mlc/flags.hh>
# include <oln/core/typedefs.hh>
// # include <oln/core/typedefs.hh>
# include <oln/core/abstract/any.hh>
# include <oln/core/macros.hh>
......
......@@ -28,7 +28,7 @@
#ifndef OLN_CORE_AUTOMATIC_IMPL_HH
# define OLN_CORE_AUTOMATIC_IMPL_HH
# include <oln/core/typedefs.hh>
// # include <oln/core/typedefs.hh>
namespace oln
......
......@@ -24,6 +24,7 @@ check_PROGRAMS = \
grid \
image2d \
npoints \
neighb2d \
window2d \
at
......@@ -34,6 +35,7 @@ grid_SOURCES = grid.cc
image2d_SOURCES = image2d.cc
npoints_SOURCES = npoints.cc
window2d_SOURCES = window2d.cc
neighb2d_SOURCES = neighb2d.cc
# Methods.
at_SOURCES = at.cc
......
// 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.
/// Test oln::neighb2d.
#include <oln/core/2d/image2d.hh>
#include <oln/core/2d/neighb2d.hh>
namespace test
{
template <typename I>
unsigned run(const oln::Image_with_Nbh<I>& input)
{
oln_piter(I) p(input.points());
oln_niter(I) n(p, input.nbhood());
unsigned count = 0;
for_all(p)
{
for_all(n)
if (input.owns_(n))
++count;
}
return count;
}
}
int main()
{
using namespace oln;
image2d<bool> ima(3, 3);
// 2 + 3 + 2 +
// 3 + 4 + 3 +
// 2 + 3 + 2 = 24
std::cout << test::run(ima + c4) << std::endl;
assert(test::run(ima + c4) == 24);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment