Commit 8f9affba authored by Roland Levillain's avatar Roland Levillain
Browse files

Fix some tests and get rid of many warnings.

	* mln/value/int_u_sat.hh (int_u_sat<n>::int_u_sat(int))
	(int_u_sat<n>::operator=(int))
	* tests/accu/max_h.cc,
	* tests/accu/median.cc,
	* tests/accu/min_h.cc,
	* tests/labeling/level.cc,
	* tests/line_piter.cc,
	* tests/linear_log.cc,
	* tests/win/disk2d.cc,
	* tests/win/octagon2d.cc: Pacify the compiler w.r.t. comparisons
	between signed and unsigned values.
	* tests/border/fill.cc: Likewise.
	(check): Fix the return type of this function.
	* tests/win/diag2d.cc: Use English in messages, not French.
	* tests/value/graylevel.cc: Test the division of a gl8 value by an
	int_s8 value.
	* tests/line_convolve.cc: Adjust the call to mln::io::load to
	match the current interface.
	* tests/value/float01_bis.cc,
	* tests/sparse_image.cc,
	* tests/rle_image.cc
	Disable these tests.
	* tests/Makefile.am (check_PROGRAMS): Remove chamfer,
	fun_x2x_composed, fun_x2x_rotation, fun_x2x_translation, h_vec and
	run_pset.
	(chamfer_SOURCES, fun_x2x_composed_SOURCES)
	(fun_x2x_rotation_SOURCES, fun_x2x_translation_SOURCES)
	(run_pset_SOURCES): Remove.
	(h_vec_SOURCES): Move...
	* tests/core/Makefile.am: ...here.
	(check_PROGRAMS): Add h_vec.
	* tests/value/builtin.cc: Move...
	* tests/value/builtin/builtin.cc: ...here.
	Pacify the compiler w.r.t. unused variables.
	* tests/value/Makefile.am (check_PROGRAMS): Remove builtin.
	(builtin_SOURCES): Move...
	* tests/value/builtin/Makefile.am: ...here.
	(check_PROGRAMS, TESTS): New.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@1653 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 5b25da8d
2008-01-10 Roland Levillain <roland@lrde.epita.fr>
Fix some tests and get rid of many warnings.
* mln/value/int_u_sat.hh (int_u_sat<n>::int_u_sat(int))
(int_u_sat<n>::operator=(int))
* tests/accu/max_h.cc,
* tests/accu/median.cc,
* tests/accu/min_h.cc,
* tests/labeling/level.cc,
* tests/line_piter.cc,
* tests/linear_log.cc,
* tests/win/disk2d.cc,
* tests/win/octagon2d.cc: Pacify the compiler w.r.t. comparisons
between signed and unsigned values.
* tests/border/fill.cc: Likewise.
(check): Fix the return type of this function.
* tests/win/diag2d.cc: Use English in messages, not French.
* tests/value/graylevel.cc: Test the division of a gl8 value by an
int_s8 value.
* tests/line_convolve.cc: Adjust the call to mln::io::load to
match the current interface.
* tests/value/float01_bis.cc,
* tests/sparse_image.cc,
* tests/rle_image.cc
Disable these tests.
* tests/Makefile.am (check_PROGRAMS): Remove chamfer,
fun_x2x_composed, fun_x2x_rotation, fun_x2x_translation, h_vec and
run_pset.
(chamfer_SOURCES, fun_x2x_composed_SOURCES)
(fun_x2x_rotation_SOURCES, fun_x2x_translation_SOURCES)
(run_pset_SOURCES): Remove.
(h_vec_SOURCES): Move...
* tests/core/Makefile.am: ...here.
(check_PROGRAMS): Add h_vec.
* tests/value/builtin.cc: Move...
* tests/value/builtin/builtin.cc: ...here.
Pacify the compiler w.r.t. unused variables.
* tests/value/Makefile.am (check_PROGRAMS): Remove builtin.
(builtin_SOURCES): Move...
* tests/value/builtin/Makefile.am: ...here.
(check_PROGRAMS, TESTS): New.
2008-01-09 Roland Levillain <roland@lrde.epita.fr>
* mln/linear/sobel.hh: Fix dates in copyright header.
......
......@@ -151,10 +151,9 @@ namespace mln
static const unsigned max_ = mln_max(int_u<n>);
if (i < 0)
this->v_ = 0;
// FIXME: This comparison triggers a warning between signed and
// unsigned values from the compiler. If it is valid, use a
// cast and leave a comment about it.
else if (i > max_)
// Explicitly cast I to unsigned to avoid a warning between
// signed and unsigned values from the compiler.
else if (static_cast<unsigned>(i) > max_)
this->v_ = max_;
else
this->v_ = i;
......@@ -175,7 +174,9 @@ namespace mln
static const unsigned max_ = mln_max(int_u<n>);
if (i < 0)
this->v_ = 0;
else if (i > max_)
// Explicitly cast I to unsigned to avoid a warning between
// signed and unsigned values from the compiler.
else if (static_cast<unsigned>(i) > max_)
this->v_ = max_;
else
this->v_ = i;
......
......@@ -24,6 +24,9 @@ SUBDIRS = \
value \
win
# FIXME: rle_image.cc and sparse_image.cc are probably garbage now
# (superseded by core/rle_image.cc and core/sparse_image.cc). Ask
# Simon whether we can remove them.
check_PROGRAMS = \
border_resize_image1d_1 \
border_resize_image1d_2 \
......@@ -41,7 +44,6 @@ check_PROGRAMS = \
box3d \
\
cast_image \
chamfer \
convert_to_image \
convert_to_tiles \
convert_to_p_array \
......@@ -54,13 +56,8 @@ check_PROGRAMS = \
\
estim_mean \
\
fun_x2x_composed \
fun_x2x_rotation \
fun_x2x_translation \
\
hexa \
histo_to_image1d \
h_vec \
\
image1d \
image2d \
......@@ -101,7 +98,6 @@ check_PROGRAMS = \
pw_value \
\
rle_image \
run_pset \
\
safe_image \
seed2tiling \
......@@ -144,7 +140,6 @@ box2d_SOURCES = box2d.cc
box3d_SOURCES = box3d.cc
cast_image_SOURCES = cast_image.cc
chamfer_SOURCES = chamfer.cc
convert_to_image_SOURCES = convert_to_image.cc
convert_to_tiles_SOURCES = convert_to_tiles.cc
convert_to_p_array_SOURCES = convert_to_p_array.cc
......@@ -157,13 +152,8 @@ dpoints_pixter_SOURCES = dpoints_pixter.cc
estim_mean_SOURCES = estim_mean.cc
fun_x2x_composed_SOURCES = fun_x2x_composed.cc
fun_x2x_rotation_SOURCES = fun_x2x_rotation.cc
fun_x2x_translation_SOURCES = fun_x2x_translation.cc
hexa_SOURCES = hexa.cc
histo_to_image1d_SOURCES = histo_to_image1d.cc
h_vec_SOURCES = h_vec.cc
image1d_SOURCES = image1d.cc
image2d_SOURCES = image2d.cc
......@@ -204,7 +194,6 @@ pw_image_SOURCES = pw_image.cc
pw_value_SOURCES = pw_value.cc
rle_image_SOURCES = rle_image.cc
run_pset_SOURCES = run_pset.cc
safe_image_SOURCES = safe_image.cc
seed2tiling_SOURCES = seed2tiling.cc
......
// Copyright (C) 2007 EPITA Research and Development Laboratory
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
......@@ -58,5 +58,5 @@ int main()
a.take(234);
a.take(234);
a.take(234);
mln_assertion(a.to_result() == 234);
mln_assertion(a.to_result() == 234u);
}
// Copyright (C) 2007 EPITA Research and Development Laboratory
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
......@@ -54,7 +54,7 @@ int main()
med.take(1);
med.take(0);
mln_assertion(med.to_result() == 5);
mln_assertion(med.to_result() == 5u);
}
{
......@@ -64,6 +64,6 @@ int main()
med.take(7);
med.take(0);
mln_assertion(med.to_result() == 7);
mln_assertion(med.to_result() == 7u);
}
}
// Copyright (C) 2007 EPITA Research and Development Laboratory
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
......@@ -58,5 +58,5 @@ int main()
a.take(234);
a.take(234);
a.take(234);
mln_assertion(a.to_result() == 42);
mln_assertion(a.to_result() == 42u);
}
// Copyright (C) 2007 EPITA Research and Development Laboratory
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
......@@ -38,7 +38,7 @@
using namespace mln;
int
void
check(int size, int border)
{
int w = size + 2 * border;
......@@ -48,11 +48,11 @@ check(int size, int 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);
mln_assertion (ima[i] == 42u);
else
if ((i % w < border) &&
(border + size <= i % w))
mln_assertion (ima[i] == 42);
mln_assertion (ima[i] == 42u);
}
int
......
......@@ -6,6 +6,7 @@ check_PROGRAMS = \
category \
clone \
exact \
h_vec \
initialize \
mesh_elt_window \
mesh_image \
......@@ -25,6 +26,7 @@ check_PROGRAMS = \
category_SOURCES = category.cc
clone_SOURCES = clone.cc
exact_SOURCES = exact.cc
h_vec_SOURCES = h_vec.cc
initialize_SOURCES = initialize.cc
mesh_elt_window_SOURCES = mesh_elt_window.cc
mesh_image_SOURCES = mesh_image.cc
......
......@@ -60,7 +60,7 @@ int main()
{
image2d<unsigned> labels = labeling::level(lena, l, c4(), n);
unsigned npix =
accu::compute<accu::count>(labels | (pw::value(labels) != pw::cst(0)));
accu::compute<accu::count>(labels | (pw::value(labels) != pw::cst(0u)));
npixels += npix;
}
mln_assertion(npixels == lena.npoints());
......
......@@ -52,9 +52,9 @@ int main()
border::thickness = 4;
image2d<int_u8>
lena = io::pgm::load(MLN_IMG_DIR "/lena.pgm"),
out(lena.domain());
image2d<int_u8> lena;
io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
image2d<int_u8> out(lena.domain());
image2d<float> tmp(lena.domain());
float ws[] = { .11, .11, .11, .11, .11, .11, .11, .11, .11 };
......
// Copyright (C) 2007 EPITA Research and Development Laboratory
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
......@@ -42,7 +42,7 @@ int main()
image2d<int> f(b, border);
image2d<int>::line_piter p(f.domain());
unsigned i = 1;
int i = 1;
for_all(p)
{
mln_assertion(p[1] == 0 && p[0] == i++);
......
......@@ -71,6 +71,6 @@ int main()
{
int_u8 min, max;
estim::min_max(out, min, max);
mln_assertion(min == 0 && max == 255);
mln_assertion(min == 0u && max == 255u);
}
}
......@@ -32,6 +32,13 @@
* \todo Trouble with ctor/init since there is no ctor with arg!
*/
// FIXME: There's already a test named rle_image.cc in tests/core. It
// seems to be pretty old material, not in sync with the current
// version of rle_image for a long time. Disable it before asking for
// its deletion.
#include <mln/core/image2d.hh>
#include <mln/core/rle_image.hh>
#include <mln/core/rle_encode.hh>
......@@ -55,6 +62,9 @@ void test(const Pset& my_set)
int
main()
{
// FIXME: Disabled (cf. supra).
#if 0
mln::point2d p, q, r;
r = make::point2d(0, 1);
q = make::point2d(2, 2);
......@@ -90,4 +100,6 @@ main()
// std::cout << std::endl;
return 0;
#endif
}
......@@ -29,6 +29,14 @@
*
* \brief Tests on mln::sparse_image.
*/
// FIXME: There's already a test named sparse_image.cc in tests/core.
// It seems to be pretty old material, not in sync with the current
// version of sparse_image for a long time. Disable it before asking
// for its deletion.
#include <mln/core/image2d.hh>
#include <mln/core/sparse_image.hh>
#include <mln/core/sparse_encode.hh>
......@@ -70,6 +78,9 @@ void test2(I& ima)
int
main()
{
// FIXME: Disabled (cf. supra).
#if 0
mln::point2d p, q, r;
p = mln::make::point2d(0, 1);
q = mln::make::point2d(3, 0);
......@@ -109,4 +120,6 @@ main()
// std::cout << std::endl;
return 0;
#endif
}
......@@ -12,7 +12,6 @@ SUBDIRS = \
check_PROGRAMS = \
bool \
builtin \
equiv \
float01_bis \
float01 \
......@@ -33,7 +32,6 @@ check_PROGRAMS = \
# rgb_full
bool_SOURCES = bool.cc
builtin_SOURCES = builtin.cc
equiv_SOURCES = equiv.cc
float01_bis_SOURCES = float01_bis.cc
float01_SOURCES = float01.cc
......
## Process this file through Automake to create Makefile.in -*- Makefile -*-
include $(top_srcdir)/milena/tests/tests.mk
check_PROGRAMS = \
builtin
# FIXME: Rename this test, as `builtin' is not enough relevant.
builtin_SOURCES = builtin.cc
TESTS = $(check_PROGRAMS)
// Copyright (C) 2007 EPITA Research and Development Laboratory
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
......@@ -114,9 +114,13 @@ int main()
{
mln::trait::solve_binary< trait::op::test_2, int, value::scalar_< value::int_u8 > >::ret tmp;
double& d = tmp;
// Avoid a warning about unused variable D.
d = d;
}
{
mln::trait::solve_unary< trait::op::test, int >::ret tmp;
double& d = tmp;
// Avoid a warning about unused variable D.
d = d;
}
}
......@@ -34,8 +34,14 @@
#include <mln/value/float01_8.hh>
#include <mln/value/float01_16.hh>
int main()
{
/* FIXME: The contents of this test seens to have nothing to do with
floats. I (Roland) suspect a copy-and-paste error here. Either
rename the test or turn it into an actual test on floats or get
rid of it. */
#if 0
using namespace mln::value;
float01_8 a;
......@@ -50,4 +56,5 @@ int main()
c = (a * 2) / 2;
assert(c == white);
#endif
}
// Copyright (C) 2007 EPITA Research and Development Laboratory
// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
......@@ -37,6 +37,7 @@
#include <mln/value/glf.hh>
#include <mln/value/int_u8.hh>
#include <mln/value/int_s8.hh>
#include <mln/value/float01_f.hh>
#include <mln/value/float01_.hh>
......@@ -127,12 +128,20 @@ int main()
mln_assertion(a / true == a);
// gl8 / Integer
/* FIXME: The compiler emits a warning about a comparison between
signed and unsigned for the first line, but not for the second.
This behavior is strange, since
a * int_u(23);
triggers no warning. See whether traits and conversions are
handled symmetrically for `*' and `/'. */
a / int_u8(23);
a / int_s8(23);
// gl8 / Floating
a / float01_f(.23);
a / float01_<16>(.23);
}
{
......
......@@ -49,6 +49,7 @@ int main()
// Assignment.
{
i = 51;
// FIXME: Triggers a warning about signed vs unsigned comparison.
sym_compare_assert(i, ==, 51);
i = 51u;
......@@ -185,6 +186,7 @@ int main()
c /= 2;
sym_compare_assert(c, ==, 50.f);
// FIXME: Triggers a warning about signed vs unsigned comparison.
d /= 2.4f;
}
......
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