Commit 905f8bff authored by Guillaume Duhamel's avatar Guillaume Duhamel
Browse files

Add border subdirectory in test and add/update test.


	* tests/border: New subdirectory for border test.
	* tests/Makefile.am: Add border subdirectory.

	* tests/border/duplicate.cc: New test for duplicate.
	* tests/border/fill.cc: New test for duplicate.
	* tests/border_get.cc: Remove ...
	* tests/border/get.cc: ... and replace here.
	* tests/border/resize.cc: Move test for resize.

	* tests/level/median_dir.cc,
	* tests/level/median_fast.cc,
	* tests/level/median_hline2d.cc: Fix path for image.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@1496 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 576b4958
2007-11-16 Guillaume Duhamel <guillaume.duhamel@lrde.epita.fr>
Add border subdirectory in test and add/update test.
* tests/border: New subdirectory for border test.
* tests/Makefile.am: Add border subdirectory.
* tests/border/duplicate.cc: New test for duplicate.
* tests/border/fill.cc: New test for duplicate.
* tests/border_get.cc: Remove ...
* tests/border/get.cc: ... and replace here.
* tests/border/resize.cc: Move test for resize.
* tests/level/median_dir.cc,
* tests/level/median_fast.cc,
* tests/level/median_hline2d.cc: Fix path for image.
2007-11-16 Simon Nivault <simon.nivault@lrde.epita.fr>
Review the mln/canvas/browsing directory.
......
......@@ -3,7 +3,8 @@
include $(top_srcdir)/milena/tests/tests.mk
SUBDIRS = norm \
level
level \
border
check_PROGRAMS = \
accu_all \
......
// 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_duplicate/test_border_duplicate_image2d_1.cc
*
* \brief Tests on mln::border::duplicate.
*/
#include <mln/core/image2d.hh>
#include <mln/debug/iota.hh>
#include <mln/border/duplicate.hh>
using namespace mln;
int
main (void)
{
image2d<int> ima(3, 3, 1);
debug::iota (ima);
border::duplicate (ima);
mln_assertion(ima[ 0] == 1);
mln_assertion(ima[ 1] == 1);
mln_assertion(ima[ 2] == 2);
mln_assertion(ima[ 3] == 3);
mln_assertion(ima[ 4] == 3);
mln_assertion(ima[ 5] == 1);
mln_assertion(ima[ 6] == 1);
mln_assertion(ima[ 7] == 2);
mln_assertion(ima[ 8] == 3);
mln_assertion(ima[ 9] == 3);
mln_assertion(ima[10] == 4);
mln_assertion(ima[11] == 4);
mln_assertion(ima[12] == 5);
mln_assertion(ima[13] == 6);
mln_assertion(ima[14] == 6);
mln_assertion(ima[15] == 7);
mln_assertion(ima[16] == 7);
mln_assertion(ima[17] == 8);
mln_assertion(ima[18] == 9);
mln_assertion(ima[19] == 9);
mln_assertion(ima[20] == 7);
mln_assertion(ima[21] == 7);
mln_assertion(ima[22] == 8);
mln_assertion(ima[23] == 9);
mln_assertion(ima[24] == 9);
}
// 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_fill/test_border_fill_image2d_1.cc
*
* \brief Tests on mln::border::fill.
*/
#include <mln/border/fill.hh>
#include <mln/core/image2d.hh>
#include <mln/value/int_u8.hh>
#include <mln/debug/println_with_border.hh>
using namespace mln;
int
check(int size, int border)
{
int w = size + 2 * border;
int ww = w *w;
image2d<value::int_u8> ima(size, size, border);
border::fill (ima, 42);
for(int i = 0; i < ww; ++i)
if ((i / w < border) || (i / w > border + size))
mln_assertion (ima[i] == 42);
else
if ((i % w < border) &&
(border + size <= i % w))
mln_assertion (ima[i] == 42);
}
int
main (void)
{
for (int i = 1; i < 42; ++i)
for (int j = 1; j < 42; ++j)
check(i, j);
}
......@@ -69,14 +69,14 @@ int main()
mln_assertion( ima.has(point2d(2,2)) == true );
sub_image<I, box2d> sub(ima, b);
mln_assertion( sub.has (point2d(2,2)) == false &&
mln_assertion( sub.has (point2d(2,2)) == false &&
sub.owns_(point2d(2,2)) == false );
mln_assertion(border::get(sub) == 0);
image_if<I, f_box2d_t> imaif(ima, f_b);
mln_assertion( imaif.has (point2d(2,2)) == false &&
mln_assertion( imaif.has (point2d(2,2)) == false &&
imaif.owns_(point2d(2,2)) == true );
mln_assertion(border::get(imaif) == 51);
mln_assertion(border::get( (ima | b) | f_b ) == 0);
}
// 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_image2d_1.cc
*
* \brief Tests on mln::border::resize.
*/
#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>
using namespace mln;
int
main (void)
{
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;
border::resize (ima, new_border);
std::cout << "after resize ("
<< new_border
<< ")"
<< std::endl;
debug::println_with_border(ima);
std::cout << std::endl;
}
......@@ -47,7 +47,7 @@ int main()
border::thickness = 7;
image2d<int_u8>
lena = io::pgm::load("../img/lena.pgm"),
lena = io::pgm::load("../../img/lena.pgm"),
out(lena.domain());
level::median_dir(lena, 1, 15, out);
......
......@@ -94,7 +94,7 @@ int main()
border::thickness = 52;
image2d<int_u8>
lena = io::pgm::load("../img/lena.pgm"),
lena = io::pgm::load("../../img/lena.pgm"),
out(lena.domain());
level::fast_median(lena, rect, out);
......
......@@ -51,7 +51,7 @@ int main()
border::thickness = 0;
image2d<int_u8>
lena = io::pgm::load("../img/lena.pgm"),
lena = io::pgm::load("../../img/lena.pgm"),
out(lena.domain()),
ref(lena.domain());
......
Markdown is supported
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