1953: Have most of the test suite compile again.

https://svn.lrde.epita.fr/svn/oln/trunk/milena If I'm not mistaken, all tests should compile now, except these two ones: tests/value/graylevel.cc tests/value/graylevel_f.cc for some obscure ambiguous name resolution. Though most of them now compile, many tests fail, for various reasons (changes in interfaces/expected results, SEGVs, etc.). Any help to fix these tests is welcome! Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Have most of the test suite compile again. * mln/draw/graph.hh: Catch up with the interface of mln::p_graph<P>. * mln/metal/math/pow.hh (mln::metal::math::impl::pow_int_) * mln/value/float01_.hh (mln::trait::value_< mln::value::float01_<n> >) * mln/value/int_s.hh (mln::trait::value_< mln::value::int_s<n> >) * mln/value/int_u.hh (mln::trait::value_< mln::value::int_u<n> >): Give a name to the enum to pacify the compiler. * mln/value/graylevel.hh (mln::value::graylevel<n>::graylevel): Explicitly call the ctor of the first super class, as recommended by g++ 4.0.1. * mln/value/internal/integer.hh: s|mln/value/internal/scalar.hh|mln/value/concept/scalar.hh| * mln/metal/math/sqrt.hh (mln::metal::math::impl::sqrt<N>): Fix the number of template parameters. * mln/canvas/all.hh: s|mln/canvas/champfer.hh|mln/canvas/chamfer.hh|. * mln/canvas/browsing/all.hh: s|dir_ricard51.hh|dir_struct_elt_incr_update.hh|. * mln/win/line.hh (mln::win::line<M, i C>::psite): New typedef. * mln/labeling/all.hh: No longer include the (missing) header mln/labeling/estimate.hh. * tests/level/sort_points.cc: Remove this outdated test. * tests/level/Makefile.am (check_PROGRAMS): Remove sort_points. (sort_points_SOURCES): Remove. * tests/subsampling/type.cc: Move... * sandbox/jardonnet/test/type.cc: ...here. This test depends on files located in sandbox/jardonnet/. * tests/subsampling/Makefile.am (check_PROGRAMS, type_SOURCES) (TESTS): Remove. * tests/level/naive/Makefile.am (median_CXXFLAGS): Set to (TESTS_CXXFLAGS_SPEED), to speed up test execution. * tests/literal/medium_gray.cc: Add missing header inclusions. * tests/value/quat.cc: Likewise. Catch up with the new location of quat (algebra::, instead of value::). * tests/algebra/mat.cc: Likewise. * tests/value/Makefile.am (check_PROGRAMS): Remove macros. (macros_SOURCES): Remove. (EXTRA_DIST): New. Set to macros.hh. * tests/binarization/thresholding.cc: s/thresholding/threshold/. Don't use hard-coded paths for images. * tests/display/Makefile.am (TESTS): Disable tests show and save_and_show. mln/canvas/all.hh | 2 +- mln/canvas/browsing/all.hh | 2 +- mln/draw/graph.hh | 8 ++++---- mln/labeling/all.hh | 1 - mln/metal/math/pow.hh | 4 ++-- mln/metal/math/sqrt.hh | 4 ++-- mln/value/float01_.hh | 2 +- mln/value/graylevel.hh | 3 ++- mln/value/int_s.hh | 2 +- mln/value/int_u.hh | 2 +- mln/value/internal/integer.hh | 2 +- mln/win/line.hh | 3 +++ tests/algebra/mat.cc | 2 +- tests/binarization/thresholding.cc | 23 ++++++++++------------- tests/display/Makefile.am | 6 +++++- tests/level/Makefile.am | 2 -- tests/level/naive/Makefile.am | 2 +- tests/literal/medium_gray.cc | 2 ++ tests/subsampling/Makefile.am | 7 ------- tests/value/Makefile.am | 5 +++-- tests/value/quat.cc | 11 +++++++---- 21 files changed, 48 insertions(+), 47 deletions(-) Index: mln/draw/graph.hh --- mln/draw/graph.hh (revision 1952) +++ mln/draw/graph.hh (working copy) @@ -95,16 +95,16 @@ // Draw the background. level::fill(ima, 0); // Draw the lines (edges). - for (size_t l = 0; l < pg.nlines(); ++l) + for (size_t l = 0; l < pg.nedges(); ++l) line (exact(ima), // FIXME: Too low-level. See similar remarks // in mln/core/graph_image.hh - pg.gr_.node_data(pg.gr_.edge(l).n1()), - pg.gr_.node_data(pg.gr_.edge(l).n2()), + pg.gr_->node_data(pg.gr_->edge(l).n1()), + pg.gr_->node_data(pg.gr_->edge(l).n2()), link_v); // Draw the points (nodes). for (size_t p = 0; p < pg.npoints(); ++p) - exact(ima)(pg.gr_.node_data(p)) = node_v; + exact(ima)(pg.gr_->node_data(p)) = node_v; } template <typename I, typename P, typename V> Index: mln/metal/math/pow.hh --- mln/metal/math/pow.hh (revision 1952) +++ mln/metal/math/pow.hh (working copy) @@ -59,13 +59,13 @@ template <int x, int n> struct pow_int_ { - enum { value = x * pow_int_<x, n-1>::value }; + enum res_ { value = x * pow_int_<x, n-1>::value }; }; template <int x> struct pow_int_< x, 0 > { - enum { value = 1 }; + enum res_ { value = 1 }; }; template <> Index: mln/value/float01_.hh --- mln/value/float01_.hh (revision 1952) +++ mln/value/float01_.hh (working copy) @@ -62,7 +62,7 @@ template <unsigned n> struct value_< mln::value::float01_<n> > { - enum { + enum constants_ { nbits = n, card = mln_value_card_from_(nbits) }; Index: mln/value/int_s.hh --- mln/value/int_s.hh (revision 1952) +++ mln/value/int_s.hh (working copy) @@ -75,7 +75,7 @@ typedef mln::value::int_s<n> self_; public: - enum { + enum constants_ { nbits = n, card = mln_value_card_from_(n) - 1 }; Index: mln/value/int_u.hh --- mln/value/int_u.hh (revision 1952) +++ mln/value/int_u.hh (working copy) @@ -81,7 +81,7 @@ typedef typename mln::value::internal::encoding_unsigned_<n>::ret enc_; public: - enum { + enum constants_ { nbits = n, card = mln_value_card_from_(n) }; Index: mln/value/graylevel.hh --- mln/value/graylevel.hh (revision 1952) +++ mln/value/graylevel.hh (working copy) @@ -460,7 +460,8 @@ template <unsigned n> inline - graylevel<n>::graylevel(const graylevel<n>& rhs) + graylevel<n>::graylevel(const graylevel<n>& rhs) : + Integer< graylevel<n> >() { this->v_ = rhs.v_; } Index: mln/value/internal/integer.hh --- mln/value/internal/integer.hh (revision 1952) +++ mln/value/internal/integer.hh (working copy) @@ -33,7 +33,7 @@ * \brief Define a generic class for integer values. */ -# include <mln/value/internal/scalar.hh> +# include <mln/value/concept/scalar.hh> namespace mln { Index: mln/metal/math/sqrt.hh --- mln/metal/math/sqrt.hh (revision 1952) +++ mln/metal/math/sqrt.hh (working copy) @@ -46,7 +46,7 @@ namespace math { - // sqrt_int<x, n> + // sqrt_int<x> namespace impl { @@ -92,7 +92,7 @@ // sqrt<N> - template <typename X, typename N> + template <typename N> struct sqrt; template <int n> Index: mln/canvas/all.hh --- mln/canvas/all.hh (revision 1952) +++ mln/canvas/all.hh (working copy) @@ -48,7 +48,7 @@ # include <mln/canvas/browsing/all.hh> # include <mln/canvas/morpho/all.hh> -# include <mln/canvas/champfer.hh> +# include <mln/canvas/chamfer.hh> # include <mln/canvas/labeling.hh> #endif // ! MLN_CANVAS_ALL_HH Index: mln/canvas/browsing/all.hh --- mln/canvas/browsing/all.hh (revision 1952) +++ mln/canvas/browsing/all.hh (working copy) @@ -46,7 +46,7 @@ } # include <mln/canvas/browsing/directional.hh> -# include <mln/canvas/browsing/dir_ricard51.hh> +# include <mln/canvas/browsing/dir_struct_elt_incr_update.hh> # include <mln/canvas/browsing/fwd.hh> # include <mln/canvas/browsing/snake_fwd.hh> Index: mln/win/line.hh --- mln/win/line.hh (revision 1952) +++ mln/win/line.hh (working copy) @@ -63,6 +63,9 @@ /// Point associated type. typedef point_<M, int> point; + /// Psite associated type. + typedef point psite; + /// Dpoint associated type. typedef dpoint_<M, int> dpoint; Index: mln/labeling/all.hh --- mln/labeling/all.hh (revision 1952) +++ mln/labeling/all.hh (working copy) @@ -54,7 +54,6 @@ # include <mln/labeling/background.hh> # include <mln/labeling/blobs.hh> -# include <mln/labeling/estimate.hh> # include <mln/labeling/flat_zones.hh> # include <mln/labeling/foreground.hh> # include <mln/labeling/level.hh> Index: tests/level/Makefile.am --- tests/level/Makefile.am (revision 1952) +++ tests/level/Makefile.am (working copy) @@ -20,7 +20,6 @@ memset_ \ paste \ saturate \ - sort_points \ sort_psites \ sort_psites_full \ stretch \ @@ -42,7 +41,6 @@ memset__SOURCES = memset_.cc paste_SOURCES = paste.cc saturate_SOURCES = saturate.cc -sort_points_SOURCES = sort_points.cc sort_psites_SOURCES = sort_psites.cc stretch_SOURCES = stretch.cc take_SOURCES = take.cc Index: tests/subsampling/Makefile.am --- tests/subsampling/Makefile.am (revision 1952) +++ tests/subsampling/Makefile.am (working copy) @@ -1,10 +1,3 @@ ## Process this file through Automake to create Makefile.in -*- Makefile -*- include $(top_srcdir)/milena/tests/tests.mk - -check_PROGRAMS = \ - type - -type_SOURCES = type.cc - -TESTS = $(check_PROGRAMS) Index: tests/level/naive/Makefile.am --- tests/level/naive/Makefile.am (revision 1952) +++ tests/level/naive/Makefile.am (working copy) @@ -15,6 +15,6 @@ # For the moment, we just have the second test. We run it during # target `check', but we shall move it to target `check-full' as soon # as a smaller and faster test is written. -median_CXXFLAGS = $(LONG_TESTS_CXXFLAGS) +median_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED) TESTS = $(check_PROGRAMS) Index: tests/literal/medium_gray.cc --- tests/literal/medium_gray.cc (revision 1952) +++ tests/literal/medium_gray.cc (working copy) @@ -32,6 +32,8 @@ #include <mln/literal/grays.hh> #include <mln/value/graylevel.hh> +#include <mln/value/gl8.hh> +#include <mln/value/gl16.hh> int main() Index: tests/value/quat.cc --- tests/value/quat.cc (revision 1952) +++ tests/value/quat.cc (working copy) @@ -32,16 +32,19 @@ #include <iostream> -#include <mln/value/quat.hh> +#include <mln/core/contract.hh> + +#include <mln/algebra/quat.hh> +#include <mln/norm/l2.hh> int main() { using namespace mln; - value::quat q1(3.f, 4.f, 1.6f, 0.5f); - value::quat q2(1.2, make::vec(3, 6, 4)); - value::quat q3(make::vec(1.3, 3., -6., 4.)); + algebra::quat q1(3.f, 4.f, 1.6f, 0.5f); + algebra::quat q2(1.2, make::vec(3, 6, 4)); + algebra::quat q3(make::vec(1.3, 3., -6., 4.)); std::cout << q1 << std::endl; std::cout << q2 << std::endl; Index: tests/algebra/mat.cc --- tests/algebra/mat.cc (revision 1952) +++ tests/algebra/mat.cc (working copy) @@ -43,7 +43,7 @@ using namespace mln; algebra::mat<1,3,float> m1(all_to(4.)); - algebra::mat<2,2,float> m2 = metal::mat<2,2,float>::Id; + algebra::mat<2,2,float> m2 = algebra::mat<2,2,float>::Id; h_mat<1,float> hm1(m2); h_mat<2,float> hm2; Index: tests/value/Makefile.am --- tests/value/Makefile.am (revision 1952) +++ tests/value/Makefile.am (working copy) @@ -23,7 +23,6 @@ int_u8 \ interop \ label \ - macros \ quat \ rgb8 \ scalar \ @@ -48,7 +47,6 @@ int_s16_SOURCES = int_s16.cc int_u8_SOURCES = int_u8.cc label_SOURCES = label.cc -macros_SOURCES = macros.cc quat_SOURCES = quat.cc rgb8_SOURCES = rgb8.cc scalar_SOURCES = scalar.cc @@ -63,3 +61,6 @@ TESTS = $(check_PROGRAMS) # FIXME: Enable when make check_full works. # TESTS_FULL = $(check_full_PROGRAMS) + +# FIXME: What's the purpose of this file? +EXTRA_DIST = macros.hh Index: tests/binarization/thresholding.cc --- tests/binarization/thresholding.cc (revision 1952) +++ tests/binarization/thresholding.cc (working copy) @@ -25,23 +25,18 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/*! \file tests/binarization/thresholding.cc - * - * \brief Test on mln::binarization::thresholding - */ - -// FIXME for make check - +/// \file tests/binarization/thresholding.cc +/// \brief Test on mln::binarization::threshold. #include <mln/core/image2d.hh> -#include <mln/binarization/thresholding.hh> +#include <mln/binarization/threshold.hh> #include <mln/level/all.hh> #include <mln/io/pgm/load.hh> #include <mln/io/ppm/load.hh> #include <mln/io/pbm/save.hh> -//#include "tests/data.hh" +#include "tests/data.hh" int main(int argc, char **) { @@ -50,17 +45,19 @@ { image2d<int_u8> lena; - io::pgm::load(lena, "../../img/lena.pgm"); - io::pbm::save(binarization::thresholding(lena, argc), "out1.pgm"); + io::pgm::load(lena, MLN_IMG_DIR "lena.pgm"); + // FIXME: argc? Weird. + io::pbm::save(binarization::threshold(lena, argc), "out1.pgm"); } { image2d<int_u8> l; image2d<int> lena; - io::pgm::load(l, "../../img/lena.pgm"); + io::pgm::load(l, MLN_IMG_DIR "img/lena.pgm"); level::paste(l, lena); - io::pbm::save(binarization::thresholding(lena, argc), "out2.pgm"); + // FIXME: argc? Weird. + io::pbm::save(binarization::threshold(lena, argc), "out2.pgm"); } } Index: tests/display/Makefile.am --- tests/display/Makefile.am (revision 1952) +++ tests/display/Makefile.am (working copy) @@ -11,4 +11,8 @@ save_and_show_SOURCES = save_and_show.cc color_pretty_SOURCES = color_pretty.cc -TESTS = $(check_PROGRAMS) +# FIXME: Don't execute `save' and `save_and_show' by default! These +# tests require a running X11 server (as well as a `pkill' binary...). +# Perform the necessary checks at configure time first. +#TESTS = $(check_PROGRAMS) +TESTS = color_pretty
participants (1)
-
Roland Levillain