1642: Get rid of hard-coded paths to input images in remaining tests.

https://svn.lrde.epita.fr/svn/oln/trunk Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Get rid of hard-coded paths to input images in remaining tests. * milena/tests/core/mono_obased_rle_image.cc, * milena/tests/core/mono_rle_image.cc, * milena/tests/core/obased_rle_image.cc, * milena/tests/core/rle_image.cc, * milena/tests/core/sparse_image.cc, * milena/tests/display/save_and_show.cc, * milena/tests/display/show.cc, * milena/tests/fun/x2x/rotation.cc, * milena/tests/io/fits/fits.cc, * milena/tests/io/pbm/pbm.cc, * milena/tests/io/pgm/pgm.cc, * milena/tests/io/pgm/pgm16.cc, * milena/tests/io/pgm/pgm19.cc, * milena/tests/io/pgm/pgm27.cc, * milena/tests/io/ppm/ppm.cc, * milena/tests/io/ppm/ppm16.cc, * milena/tests/io/ppm/ppm23.cc, * milena/tests/labeling/background.cc, * milena/tests/labeling/blobs.cc, * milena/tests/labeling/flat_zones.cc, * milena/tests/labeling/foreground.cc, * milena/tests/labeling/level.cc, * milena/tests/labeling/regional_maxima.cc, * milena/tests/labeling/regional_minima.cc, * milena/tests/level/approx/median.cc, * milena/tests/level/median.cc, * milena/tests/level/median_dir.cc, * milena/tests/level/median_fast.cc, * milena/tests/level/median_hline2d.cc, * milena/tests/level/naive/median.cc, * milena/tests/line_convolve.cc, * milena/tests/linear_convolve.cc, * milena/tests/linear_gaussian.cc, * milena/tests/linear_lap.cc, * milena/tests/linear_log.cc, * milena/tests/plain.cc: Use tests/data.hh to get the path to the img/ directory. * milena/tests/level/Makefile.am (SUBDIRS): New. Add approx and naive. * milena/tests/level/approx/Makefile.am (check_PROGRAMS, median_SOURCES, TESTS): New. * milena/tests/level/naive/Makefile.am: Likewise. * milena/tests/fi_adaptor.cc, * milena/tests/fun/x2x/composed.cc, * milena/tests/seed2tiling.cc, * milena/tests/trait_op_plus.cc, * milena/tests/util/branch_iter.cc, * milena/tests/util/branch_iter_ind.cc, * milena/tests/value/quat.cc, * milena/tests/win/backdiag2d.cc, * milena/tests/win/cube3d.cc, * milena/tests/win/diag2d.cc, * milena/tests/win/disk2d.cc, * milena/tests/win/hline2d.cc, * milena/tests/win/octagon2d.cc, * milena/tests/win/vline2d.cc: Wrap long lines. core/mono_obased_rle_image.cc | 18 ++++++++++-------- core/mono_rle_image.cc | 16 +++++++++++----- core/obased_rle_image.cc | 18 ++++++++++-------- core/rle_image.cc | 16 ++++++++++------ core/sparse_image.cc | 17 +++++++++++------ core/t_image.cc | 4 +++- display/save_and_show.cc | 7 +++++-- display/show.cc | 6 ++++-- fi_adaptor.cc | 15 +++++++-------- fun/x2x/composed.cc | 9 ++++++--- fun/x2x/rotation.cc | 8 +++++--- io/fits/fits.cc | 17 ++++++----------- io/pbm/pbm.cc | 6 ++++-- io/pgm/pgm.cc | 20 ++++++++------------ io/pgm/pgm16.cc | 17 ++++++++--------- io/pgm/pgm19.cc | 17 +++++++---------- io/pgm/pgm27.cc | 12 +++++------- io/ppm/ppm.cc | 6 +++--- io/ppm/ppm16.cc | 29 ++++++++++++++--------------- io/ppm/ppm23.cc | 13 +++++++------ labeling/background.cc | 6 ++++-- labeling/blobs.cc | 6 ++++-- labeling/flat_zones.cc | 6 ++++-- labeling/foreground.cc | 6 ++++-- labeling/level.cc | 9 ++++++--- labeling/regional_maxima.cc | 6 ++++-- labeling/regional_minima.cc | 6 ++++-- level/Makefile.am | 2 ++ level/approx/Makefile.am | 7 +++++++ level/approx/median.cc | 8 ++++---- level/median.cc | 6 +++--- level/median_dir.cc | 6 ++++-- level/median_fast.cc | 7 +++++-- level/median_hline2d.cc | 6 +++--- level/naive/Makefile.am | 7 +++++++ level/naive/median.cc | 10 ++++++---- level/stretch_full.cc | 2 +- line_convolve.cc | 6 ++++-- linear_convolve.cc | 10 ++++++---- linear_gaussian.cc | 8 ++++++-- linear_lap.cc | 7 +++++-- linear_log.cc | 9 +++++++-- main.cc | 2 ++ plain.cc | 9 ++++++--- seed2tiling.cc | 8 ++++++-- test_positive.cc | 1 + trait_op_plus.cc | 3 ++- trait_op_uminus.cc | 3 +++ trait_super.cc | 2 +- util/branch_iter.cc | 3 ++- util/branch_iter_ind.cc | 3 ++- value/builtin.cc | 2 ++ value/float01.cc | 2 ++ value/graylevel.cc | 6 +++--- value/graylevel_full.cc | 2 +- value/int_s16.cc | 2 ++ value/int_u8.cc | 2 ++ value/interop.cc | 2 +- value/quat.cc | 3 ++- value/rgb8.cc | 2 +- value/scalar.cc | 3 +++ value/set.cc | 1 + win/backdiag2d.cc | 7 +++++-- win/cube3d.cc | 6 ++++-- win/diag2d.cc | 6 ++++-- win/disk2d.cc | 7 +++++-- win/hline2d.cc | 7 +++++-- win/octagon2d.cc | 8 ++++++-- win/vline2d.cc | 7 +++++-- window1d.cc | 3 ++- 70 files changed, 325 insertions(+), 204 deletions(-) Index: milena/tests/window1d.cc --- milena/tests/window1d.cc (revision 1641) +++ milena/tests/window1d.cc (working copy) @@ -46,7 +46,8 @@ mln_assertion(w.is_centered() == false); mln_assertion(w.is_symmetric() == true); - // w.insert(-1,0); // Do not compile as expected. + // FIXME: Does not compile as expected. + // w.insert(-1,0); w.insert(-1); w.insert( 1); Index: milena/tests/linear_log.cc --- milena/tests/linear_log.cc (revision 1641) +++ milena/tests/linear_log.cc (working copy) @@ -1,4 +1,4 @@ -// 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,6 +42,8 @@ #include <mln/estim/min_max.hh> #include <mln/level/stretch.hh> +#include "tests/data.hh" + int main() { @@ -50,13 +52,16 @@ border::thickness = 2; - image2d<int_u8> lena = io::pgm::load("../img/lena.pgm"); + image2d<int_u8> lena; + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); image2d<int> tmp(lena.domain()); linear::LoG_5x5(lena, tmp); { int min, max; estim::min_max(tmp, min, max); + // FIXME: This assertion fails. (Maybe the input file has been + // changed, but this line was not updated?) mln_assertion(min == -929 && max == 1458); } Index: milena/tests/level/median.cc --- milena/tests/level/median.cc (revision 1641) +++ milena/tests/level/median.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -39,7 +39,7 @@ #include <mln/value/int_u8.hh> #include <mln/level/median.hh> - +#include "tests/data.hh" int main() @@ -51,7 +51,7 @@ border::thickness = 6; image2d<int_u8> lena; - io::pgm::load(lena, "../../img/lena.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); image2d<int_u8> out(lena.domain()); level::median(lena, rect, out); Index: milena/tests/level/median_hline2d.cc --- milena/tests/level/median_hline2d.cc (revision 1641) +++ milena/tests/level/median_hline2d.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -40,7 +40,7 @@ #include <mln/level/median.hh> #include <mln/level/compare.hh> - +#include "tests/data.hh" int main() @@ -51,7 +51,7 @@ border::thickness = 0; image2d<int_u8> lena; - io::pgm::load(lena, "../../img/lena.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); image2d<int_u8> out(lena.domain()), ref(lena.domain()); Index: milena/tests/level/median_fast.cc --- milena/tests/level/median_fast.cc (revision 1641) +++ milena/tests/level/median_fast.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -44,6 +44,8 @@ #include <mln/core/dpoints_pixter.hh> #include <mln/core/pixel.hh> +#include "tests/data.hh" + namespace mln { @@ -79,6 +81,7 @@ using namespace mln; using value::int_u8; + // FIXME: Dead code. // { // win::rectangle2d rect(3, 3); // border::thickness = 4; @@ -94,7 +97,7 @@ border::thickness = 52; image2d<int_u8> lena; - io::pgm::load(lena, "../../img/lena.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); image2d<int_u8> out(lena.domain()); level::fast_median(lena, rect, out); Index: milena/tests/level/approx/median.cc --- milena/tests/level/approx/median.cc (revision 1641) +++ milena/tests/level/approx/median.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -40,7 +40,7 @@ #include <mln/value/int_u8.hh> #include <mln/level/approx/median.hh> - +#include "tests/data.hh" int main() @@ -53,10 +53,10 @@ border::thickness = 52; image2d<int_u8> lena; - - io::pgm::load(lena, "../../../img/lena.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); image2d<int_u8> out(lena.domain()); + // FIXME: Dead code? // level::approx::median(lena, rect, out); level::approx::median(lena, oct, out); io::pgm::save(out, "out.pgm"); Index: milena/tests/level/approx/Makefile.am --- milena/tests/level/approx/Makefile.am (revision 1641) +++ milena/tests/level/approx/Makefile.am (working copy) @@ -1,3 +1,10 @@ ## Process this file through Automake to create Makefile.in -*- Makefile -*- include $(top_srcdir)/milena/tests/tests.mk + +check_PROGRAMS = \ + median + +median_SOURCES = median.cc + +TESTS = $(check_PROGRAMS) Index: milena/tests/level/median_dir.cc --- milena/tests/level/median_dir.cc (revision 1641) +++ milena/tests/level/median_dir.cc (working copy) @@ -1,4 +1,4 @@ -// 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,6 +38,8 @@ #include <mln/value/int_u8.hh> #include <mln/level/median.hh> +#include "tests/data.hh" + int main() { @@ -47,7 +49,7 @@ border::thickness = 7; image2d<int_u8> lena; - io::pgm::load(lena, "../../img/lena.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); image2d<int_u8> out(lena.domain()); level::median_dir(lena, 1, 15, out); Index: milena/tests/level/stretch_full.cc --- milena/tests/level/stretch_full.cc (revision 1641) +++ milena/tests/level/stretch_full.cc (working copy) @@ -64,7 +64,7 @@ level::stretch(input, output); - // FIXME : How test that? + // FIXME: How to test that? } template <typename I, typename J> Index: milena/tests/level/naive/median.cc --- milena/tests/level/naive/median.cc (revision 1641) +++ milena/tests/level/naive/median.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -39,6 +39,8 @@ #include <mln/value/int_u8.hh> #include <mln/level/naive/median.hh> +#include "tests/data.hh" + using namespace mln; using namespace mln::value; @@ -49,9 +51,9 @@ win::rectangle2d rec(51, 51); border::thickness = 52; - image2d<int_u8> - lena = io::pgm::load("../img/lena.pgm"), - out(lena.domain()); + image2d<int_u8> lena; + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); + image2d<int_u8> out(lena.domain()); level::naive::median(lena, rec, out); io::pgm::save(out, "out.pgm"); Index: milena/tests/level/naive/Makefile.am --- milena/tests/level/naive/Makefile.am (revision 1641) +++ milena/tests/level/naive/Makefile.am (working copy) @@ -1,3 +1,10 @@ ## Process this file through Automake to create Makefile.in -*- Makefile -*- include $(top_srcdir)/milena/tests/tests.mk + +check_PROGRAMS = \ + median + +median_SOURCES = median.cc + +TESTS = $(check_PROGRAMS) Index: milena/tests/level/Makefile.am --- milena/tests/level/Makefile.am (revision 1641) +++ milena/tests/level/Makefile.am (working copy) @@ -1,5 +1,7 @@ ## Process this file through Automake to create Makefile.in -*- Makefile -*- +SUBDIRS = approx naive + include $(top_srcdir)/milena/tests/tests.mk check_PROGRAMS = \ Index: milena/tests/main.cc --- milena/tests/main.cc (revision 1641) +++ milena/tests/main.cc (working copy) @@ -25,6 +25,8 @@ // reasons why the executable file might be covered by the GNU General // Public License. +// FIXME: Rename (and possibly move) this file. + /*! * \file tests/main.cc * Index: milena/tests/value/set.cc --- milena/tests/value/set.cc (revision 1641) +++ milena/tests/value/set.cc (working copy) @@ -59,6 +59,7 @@ using namespace mln; test<bool>(); + // FIXME: Dead code? // test<unsigned char>(); // test<unsigned short>(); // test<value::int_u8>(); Index: milena/tests/value/graylevel_f.cc Index: milena/tests/value/rgb8.cc --- milena/tests/value/rgb8.cc (revision 1641) +++ milena/tests/value/rgb8.cc (working copy) @@ -50,7 +50,7 @@ v.blue() = 2; rgb8 c(0, 1, 2); - // FIXME: Do not compile because we lack ops! + // FIXME: Does not compile because we lack ops! // mln_sum_(rgb8) sum; // sum + c; // c = c + c; Index: milena/tests/value/scalar.cc --- milena/tests/value/scalar.cc (revision 1641) +++ milena/tests/value/scalar.cc (working copy) @@ -46,6 +46,7 @@ { namespace trait { + // FIXME: Dead code? // template <typename O1, typename O2> // struct set_binary_< op::less, Object,O1, Object,O2 > { typedef bool ret; }; @@ -71,6 +72,7 @@ { using namespace mln; + // FIXME: Dead code? // int i = 51; // foo(i); // foo( value::scalar(i) ); @@ -84,6 +86,7 @@ b = value::scalar(j) < value::scalar(j); + // FIXME: Dead code? // mln_trait_op_less_(value::scalar_< value::int_u8 >, value::scalar_< value::int_u8 >) tmp; // void* v = tmp; Index: milena/tests/value/builtin.cc --- milena/tests/value/builtin.cc (revision 1641) +++ milena/tests/value/builtin.cc (working copy) @@ -60,6 +60,7 @@ typedef double ret; }; + // FIXME: Dead code? // template <typename I> // struct set_unary_< op::test, // mln::value::Integer, I > @@ -85,6 +86,7 @@ typedef double ret; }; + // FIXME: Dead code? // template < typename I, typename S > // struct set_binary_< op::test_2, // mln::value::Integer, I, Index: milena/tests/value/float01.cc --- milena/tests/value/float01.cc (revision 1641) +++ milena/tests/value/float01.cc (working copy) @@ -79,6 +79,7 @@ result operator()(float01_<16> v) const { result ret = int(v.value() * 255); + // FIXME: Dead code. //std::cout << v << "-> " << ret << std::endl; return ret; } @@ -143,6 +144,7 @@ io::pgm::save(lena, "out.pgm"); io::pgm::save(ref, "ref.pgm"); mln_assertion(lena == ref); + // FIXME: Dead code. //debug::println(out); } Index: milena/tests/value/int_u8.cc --- milena/tests/value/int_u8.cc (revision 1641) +++ milena/tests/value/int_u8.cc (working copy) @@ -65,6 +65,7 @@ sym_compare_assert(3.0f, ==, i); sym_compare_assert(i, !=, 2.99f); + // FIXME: Is this an incorrect behavior or what? // Error at run-time as expected :-) // i = 256; // i = -1; @@ -159,6 +160,7 @@ i *= d; sym_compare_assert(i, ==, 0.f); + // FIXME: Is this an incorrect behavior or what? // Error at run-time as expected :-) // i = 128; // i *= 2; Index: milena/tests/value/quat.cc --- milena/tests/value/quat.cc (revision 1641) +++ milena/tests/value/quat.cc (working copy) @@ -66,7 +66,8 @@ std::cout << q2.conj() << std::endl; std::cout << q2.inv() << std::endl; - std::cout << norm::l2(q2.to_vec()) << ' ' << norm::l2(q2.inv().to_vec()) << std::endl; + std::cout << norm::l2(q2.to_vec()) << ' '<< norm::l2(q2.inv().to_vec()) + << std::endl; std::cout << q2.inv().inv() << std::endl; } Index: milena/tests/value/graylevel_full.cc --- milena/tests/value/graylevel_full.cc (revision 1641) +++ milena/tests/value/graylevel_full.cc (working copy) @@ -80,7 +80,7 @@ mln_assertion(f == g); mln_assertion(h == g); - // FIXME : make the following tests compile. + // FIXME: Make the following tests compile. { // With gray_f. //gl8 a = mln::value::internal::gray_f(12.5); Index: milena/tests/value/interop.cc --- milena/tests/value/interop.cc (revision 1641) +++ milena/tests/value/interop.cc (working copy) @@ -52,7 +52,7 @@ using value::int_s8; - + // FIXME: Dead code? // { // // Operations on int_u<n> // int_u8 i = 128; Index: milena/tests/value/int_s16.cc --- milena/tests/value/int_s16.cc (revision 1641) +++ milena/tests/value/int_s16.cc (working copy) @@ -89,6 +89,7 @@ mln_assertion(3.0f == i); mln_assertion(i != 2.99f); + // FIXME: Is this an incorrect behavior or what? // Error at run-time as expected :-) // i = 256; // i = -1; @@ -176,6 +177,7 @@ i *= d; mln_assertion(i == 0); + // FIXME: Is this an incorrect behavior or what? // Error at run-time as expected :-) // i = 128; // i *= 2; Index: milena/tests/value/graylevel.cc --- milena/tests/value/graylevel.cc (revision 1641) +++ milena/tests/value/graylevel.cc (working copy) @@ -46,7 +46,7 @@ -// FIXME : make a more explicit error message. +// FIXME: Give a more explicit error message. // template <typename T> // void foo() // { @@ -72,7 +72,7 @@ using mln::literal::black; - // FIXME : make all the test pass. + // FIXME: Make all the test pass. gl8 a(white); gl8 b(white); @@ -151,7 +151,7 @@ } { - // FIXME : comparaison with literals doesn't work + // FIXME: comparison with literals doesn't work // c = a; // mln_assertion(c == white); Index: milena/tests/win/backdiag2d.cc --- milena/tests/win/backdiag2d.cc (revision 1641) +++ milena/tests/win/backdiag2d.cc (working copy) @@ -50,8 +50,11 @@ for (int x = -5; x <= 5; ++x) for (int y = -5; y <= 5; ++y) { - mln_assertion(((abs(x) <= 4) && (abs(y) <= 4)) || !diag.has(dpoint2d(y, x))); - mln_assertion((x == y) == (diag.has(dpoint2d(y, x))) || abs(x) > 4 || abs(y) > 4); + mln_assertion(((abs(x) <= 4) && (abs(y) <= 4)) || + !diag.has(dpoint2d(y, x))); + mln_assertion((x == y) == (diag.has(dpoint2d(y, x))) || + abs(x) > 4 || + abs(y) > 4); } debug::println(convert::to_image(diag)); Index: milena/tests/win/disk2d.cc --- milena/tests/win/disk2d.cc (revision 1641) +++ milena/tests/win/disk2d.cc (working copy) @@ -51,8 +51,11 @@ for (int x = -30; x <= 30; ++x) for (int y = -30; y <= 30; ++y) { - mln_assertion(((abs(x) <= 27) && (abs(y) <= 27)) || !disk.has(dpoint2d(y, x))); - mln_assertion(((x * x + y * y) <= l2) == (disk.has(dpoint2d(y, x))) || abs(x) > 27 || abs(y) > 27); + mln_assertion(((abs(x) <= 27) && (abs(y) <= 27)) || + !disk.has(dpoint2d(y, x))); + mln_assertion(((x * x + y * y) <= l2) == (disk.has(dpoint2d(y, x))) || + abs(x) > 27 || + abs(y) > 27); } debug::println(convert::to_image(disk)); Index: milena/tests/win/octagon2d.cc --- milena/tests/win/octagon2d.cc (revision 1641) +++ milena/tests/win/octagon2d.cc (working copy) @@ -50,8 +50,12 @@ for (int x = -16; x <= 16; ++x) for (int y = -16; y <= 16; ++y) { - mln_assertion(((abs(x) <= 6) && (abs(y) <= 6)) || !oct.has(dpoint2d(y, x))); - mln_assertion((abs(x) + abs(y) <= l / 2 + l / 6) == (oct.has(dpoint2d(y, x))) || abs(x) > 2 || abs(y) > 2); + mln_assertion(((abs(x) <= 6) && (abs(y) <= 6)) || + !oct.has(dpoint2d(y, x))); + mln_assertion((abs(x) + abs(y) <= l / 2 + l / 6) == + (oct.has(dpoint2d(y, x))) || + abs(x) > 2 || + abs(y) > 2); } debug::println(convert::to_image(oct)); Index: milena/tests/win/vline2d.cc --- milena/tests/win/vline2d.cc (revision 1641) +++ milena/tests/win/vline2d.cc (working copy) @@ -50,8 +50,11 @@ for (int x = -5; x <= 5; ++x) for (int y = -5; y <= 5; ++y) { - mln_assertion(((abs(x) <= 2) && (abs(y) <= 2)) || !vline.has(dpoint2d(x, y))); - mln_assertion((0 == x) == (vline.has(dpoint2d(y, x))) || abs(x) > 2 || abs(y) > 2); + mln_assertion(((abs(x) <= 2) && (abs(y) <= 2)) || + !vline.has(dpoint2d(x, y))); + mln_assertion((0 == x) == (vline.has(dpoint2d(y, x))) || + abs(x) > 2 || + abs(y) > 2); } debug::println(convert::to_image(vline)); Index: milena/tests/win/cube3d.cc --- milena/tests/win/cube3d.cc (revision 1641) +++ milena/tests/win/cube3d.cc (working copy) @@ -51,8 +51,10 @@ for (int y = -5; y <= 5; ++y) for (int z = -5; z <= 5; ++z) { - mln_assertion(((abs(x) <= 2) && (abs(y) <= 2) && (abs(z) <= 2)) || !cube.has(dpoint3d(z, y, x))); - mln_assertion((abs(x) <= 2 && abs(y) <= 2 && abs(z) <= 2) == (cube.has(dpoint3d(z, y, x)))); + mln_assertion(((abs(x) <= 2) && (abs(y) <= 2) && (abs(z) <= 2)) || + !cube.has(dpoint3d(z, y, x))); + mln_assertion((abs(x) <= 2 && abs(y) <= 2 && abs(z) <= 2) == + (cube.has(dpoint3d(z, y, x)))); } debug::println(convert::to_image(cube)); Index: milena/tests/win/hline2d.cc --- milena/tests/win/hline2d.cc (revision 1641) +++ milena/tests/win/hline2d.cc (working copy) @@ -50,8 +50,11 @@ for (int x = -5; x <= 5; ++x) for (int y = -5; y <= 5; ++y) { - mln_assertion(((abs(x) <= 2) && (abs(y) <= 2)) || !hline.has(dpoint2d(x, y))); - mln_assertion((0 == y) == (hline.has(dpoint2d(y, x))) || abs(x) > 2 || abs(y) > 2); + mln_assertion(((abs(x) <= 2) && (abs(y) <= 2)) || + !hline.has(dpoint2d(x, y))); + mln_assertion((0 == y) == (hline.has(dpoint2d(y, x))) || + abs(x) > 2 || + abs(y) > 2); } debug::println(convert::to_image(hline)); Index: milena/tests/win/diag2d.cc --- milena/tests/win/diag2d.cc (revision 1641) +++ milena/tests/win/diag2d.cc (working copy) @@ -50,7 +50,8 @@ for (int x = -5; x <= 5; ++x) for (int y = -5; y <= 5; ++y) { - mln_assertion(((abs(x) <= 2) && (abs(y) <= 2)) || !diag.has(dpoint2d(y, x))); + mln_assertion(((abs(x) <= 2) && (abs(y) <= 2)) || + !diag.has(dpoint2d(y, x))); std::cout << "x = " << x << ", y = " @@ -58,7 +59,8 @@ << " : " << ((diag.has(dpoint2d(x, y))) ? "VRAI" : "FAUX") << std::endl; - mln_assertion((x == -y) == (diag.has(dpoint2d(y, x))) || abs(x) > 2 || abs(y) > 2); + mln_assertion((x == -y) == + (diag.has(dpoint2d(y, x))) || abs(x) > 2 || abs(y) > 2); } debug::println(convert::to_image(diag)); Index: milena/tests/display/show.cc --- milena/tests/display/show.cc (revision 1641) +++ milena/tests/display/show.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -45,6 +45,8 @@ # include <mln/display/color_pretty.hh> # include <mln/io/ppm/save.hh> +#include "tests/data.hh" + int main() { @@ -53,7 +55,7 @@ unsigned max = 51; - image2d<bool> input = io::pbm::load("../../img/toto.pbm"); + image2d<bool> input = io::pbm::load(MLN_IMG_DIR "/toto.pbm"); // Create a weighted windows : // 0 2 0 Index: milena/tests/display/save_and_show.cc --- milena/tests/display/save_and_show.cc (revision 1641) +++ milena/tests/display/save_and_show.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -44,13 +44,16 @@ # include <mln/display/save_and_show.hh> # include <mln/level/fill.hh> +#include "tests/data.hh" + + int main() { using namespace mln; unsigned max = 51; - image2d<bool> input = io::pbm::load("../../img/toto.pbm"); + image2d<bool> input = io::pbm::load(MLN_IMG_DIR "/toto.pbm"); // Create a weighted windows : // 0 2 0 Index: milena/tests/util/branch_iter.cc --- milena/tests/util/branch_iter.cc (revision 1641) +++ milena/tests/util/branch_iter.cc (working copy) @@ -46,7 +46,8 @@ util::node<int>* g = f->add_child(31); f->add_child(32); - g->add_child(41)->add_child(51)->add_child(61)->add_child(71)->add_child(81)->add_child(91); + g->add_child(41)->add_child(51)->add_child(61)->add_child(71) + ->add_child(81)->add_child(91); g->add_child(42); f->add_child(33); f->add_child(34); Index: milena/tests/util/branch_iter_ind.cc --- milena/tests/util/branch_iter_ind.cc (revision 1641) +++ milena/tests/util/branch_iter_ind.cc (working copy) @@ -46,7 +46,8 @@ util::node<int>* g = f->add_child(31); f->add_child(32); - g->add_child(41)->add_child(51)->add_child(61)->add_child(71)->add_child(81)->add_child(91); + g->add_child(41)->add_child(51)->add_child(61)->add_child(71) + ->add_child(81)->add_child(91); g->add_child(42); f->add_child(33); f->add_child(34); Index: milena/tests/labeling/regional_maxima.cc --- milena/tests/labeling/regional_maxima.cc (revision 1641) +++ milena/tests/labeling/regional_maxima.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -36,13 +36,15 @@ #include <mln/io/pgm/load.hh> #include <mln/labeling/regional_maxima.hh> +#include "tests/data.hh" + int main() { using namespace mln; using value::int_u8; - image2d<int_u8> lena = io::pgm::load<int_u8>("../../img/tiny.pgm"); + image2d<int_u8> lena = io::pgm::load<int_u8>(MLN_IMG_DIR "/tiny.pgm"); unsigned n; labeling::regional_maxima(lena, c4(), n); Index: milena/tests/labeling/background.cc --- milena/tests/labeling/background.cc (revision 1641) +++ milena/tests/labeling/background.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -36,12 +36,14 @@ #include <mln/labeling/background.hh> #include <mln/logical/not.hh> +#include "tests/data.hh" + int main() { using namespace mln; - image2d<bool> pic = io::pbm::load("../../img/picasso.pbm"); + image2d<bool> pic = io::pbm::load(MLN_IMG_DIR "/picasso.pbm"); unsigned n; labeling::background(logical::not_(pic), c4(), n); mln_assertion(n == 33); Index: milena/tests/labeling/blobs.cc --- milena/tests/labeling/blobs.cc (revision 1641) +++ milena/tests/labeling/blobs.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -35,12 +35,14 @@ #include <mln/core/neighb2d.hh> #include <mln/labeling/blobs.hh> +#include "tests/data.hh" + int main() { using namespace mln; - image2d<bool> pic = io::pbm::load("../../img/picasso.pbm"); + image2d<bool> pic = io::pbm::load(MLN_IMG_DIR "/picasso.pbm"); unsigned n; labeling::blobs(pic, c4(), n); mln_assertion(n == 33); Index: milena/tests/labeling/flat_zones.cc --- milena/tests/labeling/flat_zones.cc (revision 1641) +++ milena/tests/labeling/flat_zones.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -39,13 +39,15 @@ #include <mln/labeling/blobs.hh> #include <mln/pw/all.hh> +#include "tests/data.hh" + int main() { using namespace mln; using value::int_u8; - image2d<int_u8> lena = io::pgm::load<int_u8>("../../img/tiny.pgm"); + image2d<int_u8> lena = io::pgm::load<int_u8>(MLN_IMG_DIR "/tiny.pgm"); unsigned n; image2d<unsigned> labels = labeling::flat_zones(lena, c4(), n); Index: milena/tests/labeling/level.cc --- milena/tests/labeling/level.cc (revision 1641) +++ milena/tests/labeling/level.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -44,20 +44,23 @@ #include <mln/debug/println.hh> +#include "tests/data.hh" + int main() { using namespace mln; using value::int_u8; - image2d<int_u8> lena = io::pgm::load<int_u8>("../../img/tiny.pgm"); + image2d<int_u8> lena = io::pgm::load<int_u8>(MLN_IMG_DIR "/tiny.pgm"); image2d<bool> lvl(lena.domain()); unsigned n, npixels = 0; for (unsigned l = 0; l <= 255; ++l) { image2d<unsigned> labels = labeling::level(lena, l, c4(), n); - unsigned npix = accu::compute< accu::count >(labels | (pw::value(labels) != pw::cst(0))); + unsigned npix = + accu::compute<accu::count>(labels | (pw::value(labels) != pw::cst(0))); npixels += npix; } mln_assertion(npixels == lena.npoints()); Index: milena/tests/labeling/foreground.cc --- milena/tests/labeling/foreground.cc (revision 1641) +++ milena/tests/labeling/foreground.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -35,12 +35,14 @@ #include <mln/core/neighb2d.hh> #include <mln/labeling/foreground.hh> +#include "tests/data.hh" + int main() { using namespace mln; - image2d<bool> pic = io::pbm::load("../../img/picasso.pbm"); + image2d<bool> pic = io::pbm::load(MLN_IMG_DIR "/picasso.pbm"); unsigned n; labeling::foreground(pic, c4(), n); mln_assertion(n == 33); Index: milena/tests/labeling/regional_minima.cc --- milena/tests/labeling/regional_minima.cc (revision 1641) +++ milena/tests/labeling/regional_minima.cc (working copy) @@ -1,4 +1,4 @@ -// 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,13 +37,15 @@ #include <mln/pw/all.hh> #include <mln/labeling/regional_minima.hh> +#include "tests/data.hh" + int main() { using namespace mln; using value::int_u8; - image2d<int_u8> lena = io::pgm::load<int_u8>("../../img/tiny.pgm"); + image2d<int_u8> lena = io::pgm::load<int_u8>(MLN_IMG_DIR "/tiny.pgm"); unsigned n; labeling::regional_minima((pw::cst(255) - pw::value(lena)) | lena.domain(), Index: milena/tests/trait_super.cc --- milena/tests/trait_super.cc (revision 1641) +++ milena/tests/trait_super.cc (working copy) @@ -89,7 +89,7 @@ void is_test() {} }; - + // FIXME: Dead code? // template <typename I> // void foo(const Integer<I>&) // { Index: milena/tests/plain.cc --- milena/tests/plain.cc (revision 1641) +++ milena/tests/plain.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -39,14 +39,17 @@ #include <mln/io/pgm/load.hh> #include <mln/io/pgm/save.hh> +#include "tests/data.hh" + + int main() { using namespace mln; using value::int_u8; { - plain< image2d<int_u8> > - lena = io::pgm::load<int_u8>("../img/lena.pgm"); + plain< image2d<int_u8> > lena + = io::pgm::load<int_u8>(MLN_IMG_DIR "/lena.pgm"); image2d<int_u8> ima; image2d<int_u8> ima2; Index: milena/tests/core/sparse_image.cc --- milena/tests/core/sparse_image.cc (revision 1641) +++ milena/tests/core/sparse_image.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -44,6 +44,9 @@ #include <mln/core/sparse_encode.hh> +#include "tests/data.hh" + + struct fold_t : public mln::Function_v2v< fold_t > { typedef mln::value::int_u8 result; @@ -51,23 +54,25 @@ }; - int main() { using namespace mln; using value::int_u8; image2d<int_u8> lena; - io::pgm::load(lena, "../../img/small.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "/small.pgm"); image2d<int_u8> cmp(lena.domain()); unsigned n; - image2d<unsigned> labels = labeling::blobs((pw::value(lena) > pw::cst(172u)) | lena.domain(), + image2d<unsigned> labels = + labeling::blobs((pw::value(lena) > pw::cst(172u)) | lena.domain(), c4(), n); - sparse_image<point2d, int_u8> sparse = sparse_encode(level::transform(labels, fold_t())); + sparse_image<point2d, int_u8> sparse = + sparse_encode(level::transform(labels, fold_t())); - std::cout << n << ", compression :" << sparse.compression() << std::endl; + std::cout << n << ", compression ratio: " << sparse.compression() + << std::endl; level::fill(cmp, literal::zero); level::paste(sparse, cmp); Index: milena/tests/core/obased_rle_image.cc --- milena/tests/core/obased_rle_image.cc (revision 1641) +++ milena/tests/core/obased_rle_image.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -44,6 +44,9 @@ #include <mln/core/obased_rle_encode.hh> +#include "tests/data.hh" + + struct fold_t : public mln::Function_v2v< fold_t > { typedef mln::value::int_u8 result; @@ -51,25 +54,24 @@ }; - int main() { using namespace mln; using value::int_u8; image2d<int_u8> lena; - io::pgm::load(lena, "../../img/small.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "/small.pgm"); image2d<int_u8> cmp(lena.domain()); unsigned n; - image2d<unsigned> - labels = labeling::blobs((pw::value(lena) > pw::cst(172u)) | lena.domain(), + image2d<unsigned> labels = + labeling::blobs((pw::value(lena) > pw::cst(172u)) | lena.domain(), c4(), n); - obased_rle_image<point2d, int_u8> - rle = obased_rle_encode(level::transform(labels, fold_t())); + obased_rle_image<point2d, int_u8> rle = + obased_rle_encode(level::transform(labels, fold_t())); - std::cout << n << ", compression :" << rle.compression() << std::endl; + std::cout << n << ", compression ratio: " << rle.compression() << std::endl; level::fill(cmp, literal::zero); level::paste(rle, cmp); Index: milena/tests/core/t_image.cc --- milena/tests/core/t_image.cc (revision 1641) +++ milena/tests/core/t_image.cc (working copy) @@ -36,7 +36,6 @@ #include <mln/debug/iota.hh> #include <mln/debug/println.hh> - int main() { using namespace mln; @@ -49,4 +48,7 @@ t_image<I> t_ima(ima, 0, 1); debug::println(t_ima); + + // FIXME: Enrich this test (exercise more features and write + // assertions). } Index: milena/tests/core/mono_rle_image.cc --- milena/tests/core/mono_rle_image.cc (revision 1641) +++ milena/tests/core/mono_rle_image.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -44,6 +44,9 @@ #include <mln/core/mono_rle_encode.hh> +#include "tests/data.hh" + + struct fold_t : public mln::Function_v2v< fold_t > { typedef mln::value::int_u8 result; @@ -56,22 +59,25 @@ result operator()(unsigned i) const { return i == 2 ? 2 : 0; } }; + int main() { using namespace mln; using value::int_u8; image2d<int_u8> lena; - io::pgm::load(lena, "../../img/small.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "/small.pgm"); image2d<int_u8> cmp(lena.domain()); unsigned n; - image2d<unsigned> labels = labeling::blobs((pw::value(lena) > pw::cst(172u)) | lena.domain(), + image2d<unsigned> labels = + labeling::blobs((pw::value(lena) > pw::cst(172u)) | lena.domain(), c4(), n); - mono_rle_image<point2d, int_u8> rle = mono_rle_encode(level::transform(labels, fold_t()), 2); + mono_rle_image<point2d, int_u8> rle = + mono_rle_encode(level::transform(labels, fold_t()), 2); - std::cout << n << ", compression :" << rle.compression() << std::endl; + std::cout << n << ", compression ratio: " << rle.compression() << std::endl; level::fill(cmp, literal::zero); level::paste(rle, cmp); Index: milena/tests/core/rle_image.cc --- milena/tests/core/rle_image.cc (revision 1641) +++ milena/tests/core/rle_image.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -44,6 +44,9 @@ #include <mln/core/rle_encode.hh> +#include "tests/data.hh" + + struct fold_t : public mln::Function_v2v< fold_t > { typedef mln::value::int_u8 result; @@ -51,23 +54,24 @@ }; - int main() { using namespace mln; using value::int_u8; image2d<int_u8> lena; - io::pgm::load(lena, "../../img/small.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "/small.pgm"); image2d<int_u8> cmp(lena.domain()); unsigned n; - image2d<unsigned> labels = labeling::blobs((pw::value(lena) > pw::cst(172u)) | lena.domain(), + image2d<unsigned> labels = + labeling::blobs((pw::value(lena) > pw::cst(172u)) | lena.domain(), c4(), n); - rle_image<point2d, int_u8> rle = rle_encode(level::transform(labels, fold_t())); + rle_image<point2d, int_u8> rle = + rle_encode(level::transform(labels, fold_t())); - std::cout << n << ", compression :" << rle.compression() << std::endl; + std::cout << n << ", compression ratio: " << rle.compression() << std::endl; level::fill(cmp, literal::zero); level::paste(rle, cmp); Index: milena/tests/core/mono_obased_rle_image.cc --- milena/tests/core/mono_obased_rle_image.cc (revision 1641) +++ milena/tests/core/mono_obased_rle_image.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -44,6 +44,9 @@ #include <mln/core/mono_obased_rle_encode.hh> +#include "tests/data.hh" + + struct fold_t : public mln::Function_v2v< fold_t > { typedef mln::value::int_u8 result; @@ -51,25 +54,24 @@ }; - int main() { using namespace mln; using value::int_u8; image2d<int_u8> lena; - io::pgm::load(lena, "../../img/small.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "/small.pgm"); image2d<int_u8> cmp(lena.domain()); unsigned n; - image2d<unsigned> - labels = labeling::blobs((pw::value(lena) > pw::cst(172u)) | lena.domain(), + image2d<unsigned> labels = + labeling::blobs((pw::value(lena) > pw::cst(172u)) | lena.domain(), c4(), n); - mono_obased_rle_image<point2d, int_u8> - rle = mono_obased_rle_encode(level::transform(labels, fold_t())); + mono_obased_rle_image<point2d, int_u8> rle = + mono_obased_rle_encode(level::transform(labels, fold_t())); - std::cout << n << ", compression :" << rle.compression() << std::endl; + std::cout << n << ", compression ratio: " << rle.compression() << std::endl; level::fill(cmp, literal::zero); level::paste(rle, cmp); Index: milena/tests/fi_adaptor.cc --- milena/tests/fi_adaptor.cc (revision 1641) +++ milena/tests/fi_adaptor.cc (working copy) @@ -56,12 +56,12 @@ using typename value::rgb8; { - // FIXME: - // Under Linux or under any *nix OS (i.e. under Unix or MacOSX), you need to call - // FreeImage_Initialise at the beginning of your main function and you need to call - // FreeImage_DeInitialise at the end of this main function (this is not needed when - // using FreeImage as a .SO). - + /* FIXME: Under GNU/Linux or under any *nix OS (i.e. under Unix or + Mac OS X), you need to call FreeImage_Initialise at the + beginning of your main function and you need to call + FreeImage_DeInitialise at the end of this main function (this + is not needed when using FreeImage as a shared library + (*.so)). */ //FreeImage_Initialise(); win::rectangle2d rect(51, 51); @@ -82,8 +82,7 @@ display::show (adaptor, "xv"); // FIXME: Likewise. - /* - Check if this statement holds in our case. Maybe we need to + /* Check if this statement holds in our case. Maybe we need to involve Libtool in to handle FreeImagePlus properly. */ //FreeImage_DeInitialise(); } Index: milena/tests/seed2tiling.cc --- milena/tests/seed2tiling.cc (revision 1641) +++ milena/tests/seed2tiling.cc (working copy) @@ -55,11 +55,15 @@ #include <mln/core/w_window2d_int.hh> #include <mln/make/win_chamfer.hh> -int main(int argc, char** argv) +int main(int argc, char* argv[]) { + // FIXME: A test should not be interactive. Maybe this program + // should be moved elsewehere. if (argc < 2) { - std::cerr << "missing argument : specify the location of the binary image (*.pbm)" << std::endl; + std::cerr << "missing argument: " + << "specify the location of the binary image (*.pbm)" + << std::endl; return 1; } using namespace mln; Index: milena/tests/trait_op_uminus.cc --- milena/tests/trait_op_uminus.cc (revision 1641) +++ milena/tests/trait_op_uminus.cc (working copy) @@ -78,6 +78,7 @@ namespace trait { + // FIXME: Dead code? // template <> // struct p_setrecise_unary_< op::uminus, test > // { @@ -105,6 +106,8 @@ { using namespace mln; + // FIXME: Dead code? + // { // mln_trait_op_uminus_(test) tmp; /* bool if precise */ // bool* b = &tmp; Index: milena/tests/trait_op_plus.cc --- milena/tests/trait_op_plus.cc (revision 1641) +++ milena/tests/trait_op_plus.cc (working copy) @@ -67,7 +67,8 @@ typedef bool ret; }; - // precise definition: my_image2d<T> + my_image2d<U> -> my_image2d<V> ('&' is to avoid compiling an empty class) + // precise definition: my_image2d<T> + my_image2d<U> -> my_image2d<V> + // ('&' is to avoid compiling an empty class) template <typename T, typename U> struct set_precise_binary_< op::plus, my_image2d<T>, my_image2d<U> > Index: milena/tests/linear_convolve.cc --- milena/tests/linear_convolve.cc (revision 1641) +++ milena/tests/linear_convolve.cc (working copy) @@ -1,4 +1,4 @@ -// 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,6 +42,8 @@ #include <mln/border/thickness.hh> #include <mln/linear/convolve.hh> +#include "tests/data.hh" + int main() { @@ -50,9 +52,9 @@ border::thickness = 2; - image2d<int_u8> - lena = io::pgm::load("../img/lena.pgm"), - out(lena.domain()); + image2d<int_u8> lena; + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); + image2d<int_u8> out(lena.domain()); float ws[] = { .04, .04, .04, .04, .04, .04, .04, .04, .04, .04, Index: milena/tests/test_positive.cc --- milena/tests/test_positive.cc (revision 1641) +++ milena/tests/test_positive.cc (working copy) @@ -59,6 +59,7 @@ test_v2b(fun::v2v::id<mln_value_(I)>() >= pw::cst(0)); + // FIXME: Dead code? // test2(fun::v2v::id<mln_value_(I)>() >= pw::cst(0)); // test::positive(ima); } Index: milena/tests/line_convolve.cc --- milena/tests/line_convolve.cc (revision 1641) +++ milena/tests/line_convolve.cc (working copy) @@ -1,4 +1,4 @@ -// 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,6 +42,8 @@ #include <mln/border/thickness.hh> #include <mln/linear/line_convolve.hh> +#include "tests/data.hh" + int main() { @@ -51,7 +53,7 @@ border::thickness = 4; image2d<int_u8> - lena = io::pgm::load("../img/lena.pgm"), + lena = io::pgm::load(MLN_IMG_DIR "/lena.pgm"), out(lena.domain()); image2d<float> tmp(lena.domain()); Index: milena/tests/fun/x2x/rotation.cc --- milena/tests/fun/x2x/rotation.cc (revision 1641) +++ milena/tests/fun/x2x/rotation.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -30,7 +30,6 @@ * \brief Tests on mln::fun::x2x::rotation. */ - #include <iostream> #include <mln/fun/x2x/rotation.hh> #include <mln/core/image2d.hh> @@ -40,13 +39,16 @@ #include <mln/core/interpolated.hh> #include <mln/make/vec.hh> +#include "tests/data.hh" + + int main() { using namespace mln; using value::int_u8; image2d<int_u8> lena; - io::pgm::load(lena, "../../../img/lena.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); image2d<int_u8> out(lena.domain()); interpolated<image2d<int_u8> > inter(lena); Index: milena/tests/fun/x2x/composed.cc --- milena/tests/fun/x2x/composed.cc (revision 1641) +++ milena/tests/fun/x2x/composed.cc (working copy) @@ -56,10 +56,13 @@ std::cout << "tr(vec) : " << tr(vec1) << std::endl; std::cout << "rot(vec) : " << rot(vec1) << std::endl; std::cout << "tr(rot(vec)) : " << compose(tr, rot)(vec1) << std::endl; - std::cout << "rot(rot_1(vec)) : " << compose(rot, rot.inv())(vec1) << std::endl; - std::cout << "tr(rot(tr(vec))) : " << compose(tr, compose(rot, tr))(vec1) << std::endl; + std::cout << "rot(rot_1(vec)) : " << compose(rot, rot.inv())(vec1) + << std::endl; + std::cout << "tr(rot(tr(vec))) : " << compose(tr, compose(rot, tr))(vec1) + << std::endl; std::cout << "(rototr_1)(rot(tr(vec)))) : " - << compose(compose(rot, tr).inv(), compose(rot, tr))(vec1) << std::endl; + << compose(compose(rot, tr).inv(), compose(rot, tr))(vec1) + << std::endl; mln_assertion(fabs(compose(rot, tr)(vec1)[0] - rot(tr(vec1))[0]) <= 0.125); mln_assertion(fabs(compose(rot, tr)(vec1)[1] - rot(tr(vec1))[1]) <= 0.125); mln_assertion(fabs(compose(rot, tr)(vec1)[2] - rot(tr(vec1))[2]) <= 0.125); Index: milena/tests/linear_gaussian.cc --- milena/tests/linear_gaussian.cc (revision 1641) +++ milena/tests/linear_gaussian.cc (working copy) @@ -1,4 +1,4 @@ -// 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,12 +42,16 @@ #include <mln/linear/gaussian.hh> +#include "tests/data.hh" + + int main() { using namespace mln; - image2d< value::int_u8 > lena = io::pgm::load("../img/lena.pgm"); + image2d< value::int_u8 > lena; + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); image2d<float> tmp(lena.domain()); linear::gaussian(lena, 5.1f, tmp); Index: milena/tests/linear_lap.cc --- milena/tests/linear_lap.cc (revision 1641) +++ milena/tests/linear_lap.cc (working copy) @@ -1,4 +1,4 @@ -// 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,8 @@ #include <mln/border/thickness.hh> #include <mln/linear/lap.hh> +#include "tests/data.hh" + int main() { @@ -45,7 +47,8 @@ border::thickness = 1; - image2d<int_u8> lena = io::pgm::load("../img/lena.pgm"); + image2d<int_u8> lena; + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); image2d<int> tmp(lena.domain()); linear::lap_4(lena, tmp); } Index: milena/tests/io/pgm/pgm27.cc --- milena/tests/io/pgm/pgm27.cc (revision 1641) +++ milena/tests/io/pgm/pgm27.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -41,6 +41,8 @@ #include <mln/level/transform.hh> #include <mln/level/compare.hh> +#include "tests/data.hh" + using namespace mln; @@ -66,6 +68,7 @@ } }; + int main() { using namespace mln; @@ -73,23 +76,18 @@ using value::int_u; typedef value::int_u<27> int_u27; - image2d<int_u8> - lena = io::pgm::load<int_u8>("../../../img/lena.pgm"); + image2d<int_u8> lena = io::pgm::load<int_u8>(MLN_IMG_DIR "/lena.pgm"); image2d<int_u27> out(lena.domain()); level::transform(lena, to27bits(), out); - io::pgm::save(out, "out27.pgm"); image2d<int_u27> lena2; io::pgm::load(lena2, "out27.pgm"); image2d<int_u8> out2(lena.domain()); - level::transform(lena2, to8bits(), out2); - io::pgm::save(out2, "out8.pgm"); - assert(out2 == lena); } Index: milena/tests/io/pgm/pgm19.cc --- milena/tests/io/pgm/pgm19.cc (revision 1641) +++ milena/tests/io/pgm/pgm19.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -40,6 +40,8 @@ #include <mln/level/transform.hh> #include <mln/level/compare.hh> +#include "tests/data.hh" + using namespace mln; @@ -65,6 +67,7 @@ } }; + int main() { using namespace mln; @@ -74,22 +77,16 @@ border::thickness = 52; - image2d<int_u8> - lena = io::pgm::load<int_u8>("../../../img/lena.pgm"); + image2d<int_u8> lena = io::pgm::load<int_u8>(MLN_IMG_DIR "/lena.pgm"); image2d<int_u19> out(lena.domain()); level::transform(lena, to19bits(), out); - io::pgm::save(out, "out19.pgm"); - image2d<int_u19> - lena2 = io::pgm::load<int_u19>("out19.pgm"); - image2d<int_u8> out2(lena.domain()); + image2d<int_u19> lena2 = io::pgm::load<int_u19>("out19.pgm"); + image2d<int_u8> out2(lena.domain()); level::transform(lena2, to8bits(), out2); - io::pgm::save(out2, "out8.pgm"); - assert(out2 == lena); - } Index: milena/tests/io/pgm/pgm.cc --- milena/tests/io/pgm/pgm.cc (revision 1641) +++ milena/tests/io/pgm/pgm.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -40,33 +40,29 @@ #include <mln/level/compare.hh> +#include "tests/data.hh" + + int main() { using namespace mln; using value::int_u8; { - image2d<int_u8> - lena = io::pgm::load<int_u8>("../../../img/lena.pgm"); - + image2d<int_u8> lena = io::pgm::load<int_u8>(MLN_IMG_DIR "/lena.pgm"); io::pgm::save(lena, "out.pgm"); - image2d<int_u8> - lena2 = io::pgm::load<int_u8>("out.pgm"); - + image2d<int_u8> lena2 = io::pgm::load<int_u8>("out.pgm"); mln_assertion(lena2 == lena); } - { - image2d< value::int_u<8> > - lena, lena2; - io::pgm::load(lena, "../../../img/lena.pgm"); + image2d< value::int_u<8> > lena, lena2; + io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm"); io::pgm::save(lena, "out.pgm"); io::pgm::load(lena2, "out.pgm"); mln_assertion(lena2 == lena); } - } Index: milena/tests/io/pgm/pgm16.cc --- milena/tests/io/pgm/pgm16.cc (revision 1641) +++ milena/tests/io/pgm/pgm16.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -41,6 +41,8 @@ #include <mln/level/transform.hh> +#include "tests/data.hh" + using namespace mln; @@ -66,6 +68,7 @@ } }; + int main() { using namespace mln; @@ -76,32 +79,28 @@ win::rectangle2d rect(51, 51); border::thickness = 52; - image2d<int_u8> - lena = io::pgm::load<int_u8>("../../../img/lena.pgm"); + image2d<int_u8> lena = io::pgm::load<int_u8>(MLN_IMG_DIR "/lena.pgm"); image2d<int_u16> out(lena.domain()); level::transform(lena, to16bits(), out); - io::pgm::save(out, "out16.pgm"); - image2d<int_u16> - lena2 = io::pgm::load<int_u16>("out16.pgm"); - image2d<int_u8> out2(lena.domain()); + image2d<int_u16> lena2 = io::pgm::load<int_u16>("out16.pgm"); + image2d<int_u8> out2(lena.domain()); level::transform(lena2, to8bits(), out2); - io::pgm::save(out2, "out8.pgm"); } { + /* FIXME: Is this dead code, or code not working? Be more specific. */ // Abort // image2d< value::int_u<8> > a; // io::pgm::load(a, "out16.pgm"); image2d< value::int_u<16> > b; io::pgm::load(b, "out16.pgm"); - } } Index: milena/tests/io/fits/fits.cc --- milena/tests/io/fits/fits.cc (revision 1641) +++ milena/tests/io/fits/fits.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -39,25 +39,20 @@ #include <mln/io/pfm/save.hh> #include <mln/io/pfm/load.hh> +#include "tests/data.hh" + int main() { using namespace mln; { - image2d<float> - fits_in = io::fits::load("../../../img/test.fits"); + image2d<float> fits_in = io::fits::load(MLN_IMG_DIR "/test.fits"); io::pfm::save(fits_in, "out.pfm"); - - image2d<float> - pfm = io::pfm::load("out.pfm"); - + image2d<float> pfm = io::pfm::load("out.pfm"); mln_assertion(pfm == fits_in); io::pfm::save(fits_in, "out2.pfm"); - - image2d<float> - pfm2 = io::pfm::load("out2.pfm"); - + image2d<float> pfm2 = io::pfm::load("out2.pfm"); mln_assertion(fits_in == pfm2); } } Index: milena/tests/io/ppm/ppm.cc --- milena/tests/io/ppm/ppm.cc (revision 1641) +++ milena/tests/io/ppm/ppm.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ #include <mln/level/compare.hh> - +#include "tests/data.hh" int main() @@ -46,7 +46,7 @@ using namespace mln; using value::rgb8; - image2d<rgb8> lena = io::ppm::load<rgb8>("../../../img/lena.ppm"); + image2d<rgb8> lena = io::ppm::load<rgb8>(MLN_IMG_DIR "/lena.ppm"); io::ppm::save(lena, "out.ppm"); image2d<rgb8> lena2; Index: milena/tests/io/ppm/ppm23.cc --- milena/tests/io/ppm/ppm23.cc (revision 1641) +++ milena/tests/io/ppm/ppm23.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -40,6 +40,8 @@ #include <mln/level/compare.hh> +#include "tests/data.hh" + using namespace mln; @@ -79,14 +81,13 @@ typedef image2d<rgb8> I; - // load a 8bits image A - image2d<rgb8> - a = io::ppm::load<rgb8>("../../../img/lena.ppm"); + // load a 8-bit image A + image2d<rgb8> a = io::ppm::load<rgb8>(MLN_IMG_DIR "/lena.ppm"); image2d<rgb23> b(a.domain()); image2d<rgb8>::fwd_piter p(b.domain()); - // save it as a 23bits ppm image B + // save it as a 23-bit ppm image B to23bits f; for_all(p) b(p) = f(a(p)); @@ -98,7 +99,7 @@ image2d<rgb8> d(a.domain()); - // save C as a 8bits ppm image D + // save C as a 8-bit ppm image D to8bits g; for_all(p) d(p) = g(c(p)); Index: milena/tests/io/ppm/ppm16.cc --- milena/tests/io/ppm/ppm16.cc (revision 1641) +++ milena/tests/io/ppm/ppm16.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -41,6 +41,8 @@ #include <mln/level/compare.hh> +#include "tests/data.hh" + using namespace mln; @@ -79,26 +81,24 @@ typedef image2d<rgb8> I; { - // load a 8bits image A - image2d<rgb8> - a = io::ppm::load<rgb8>("../../../img/lena.ppm"); + // load a 8-bit image A + image2d<rgb8> a = io::ppm::load<rgb8>(MLN_IMG_DIR "/lena.ppm"); image2d<rgb16> b(a.domain()); image2d<rgb8>::fwd_piter p(b.domain()); - // save it as a 16bits ppm image B + // save it as a 16-bit ppm image B to16bits f; for_all(p) b(p) = f(a(p)); io::ppm::save(b, "out16.ppm"); // reload B into C - image2d<rgb16> - c = io::ppm::load<rgb16>("out16.ppm"); + image2d<rgb16> c = io::ppm::load<rgb16>("out16.ppm"); image2d<rgb8> d(a.domain()); - // save C as a 8bits ppm image D + // save C as a 8-bit ppm image D to8bits g; for_all(p) d(p) = g(c(p)); @@ -111,27 +111,26 @@ { // Abort // image2d<rgb8> a; -// io::ppm::load(a, "../../../img/lena_16.ppm"); +// io::ppm::load(a, MLN_IMG_DIR "/lena_16.ppm"); image2d< value::rgb<16> > b; - io::ppm::load(b, "../../../img/lena_16.ppm"); + io::ppm::load(b, MLN_IMG_DIR "/lena_16.ppm"); } { // Abort // image2d< value::rgb<8> > a = -// io::ppm::load("../../../img/lena_16.ppm"); +// io::ppm::load(MLN_IMG_DIR "/lena_16.ppm"); // Abort // image2d< value::rgb<16> > a = -// io::ppm::load< value::rgb<16> >("../../../img/lena.ppm"); +// io::ppm::load< value::rgb<16> >(MLN_IMG_DIR "/lena.ppm"); image2d< value::rgb<16> > a = - io::ppm::load< value::rgb<16> >("../../../img/lena_16.ppm"); + io::ppm::load< value::rgb<16> >(MLN_IMG_DIR "/lena_16.ppm"); image2d< value::rgb<8> > b = - io::ppm::load< value::rgb<8> >("../../../img/lena.ppm"); - + io::ppm::load< value::rgb<8> >(MLN_IMG_DIR "/lena.ppm"); } } Index: milena/tests/io/pbm/pbm.cc --- milena/tests/io/pbm/pbm.cc (revision 1641) +++ milena/tests/io/pbm/pbm.cc (working copy) @@ -1,4 +1,4 @@ -// 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 @@ -36,12 +36,14 @@ #include <mln/level/compare.hh> +#include "tests/data.hh" + int main() { using namespace mln; - image2d<bool> pic = io::pbm::load("../../../img/picasso.pbm"); + image2d<bool> pic = io::pbm::load(MLN_IMG_DIR "/picasso.pbm"); io::pbm::save(pic, "pic.pbm"); image2d<bool> pic2 = io::pbm::load("pic.pbm");
participants (1)
-
Roland Levillain