Index: ChangeLog
from Christophe Berger <christophe(a)lrde.epita.fr>
* oln/morpho/geodesic_dilation.hh: New. Safe implementation.
* tests/morpho/tests/geodesic_dilation: New. Corresponding test.
* oln/morpho/geodesic_erosion.hh: New. Safe implementation.
* tests/morpho/tests/geodesic_erosion: New. Corresponding test.
oln/morpho/geodesic_dilation.hh | 133 +++++++++++++++++++++++++++++++++++
oln/morpho/geodesic_erosion.hh | 132 ++++++++++++++++++++++++++++++++++
tests/morpho/tests/geodesic_dilation | 44 +++++++++++
tests/morpho/tests/geodesic_erosion | 45 +++++++++++
4 files changed, 354 insertions(+)
Index: tests/morpho/tests/geodesic_erosion
--- tests/morpho/tests/geodesic_erosion (revision 0)
+++ tests/morpho/tests/geodesic_erosion (revision 0)
@@ -0,0 +1,45 @@
+#include "data.hh"
+//#include <oln/utils/md5.hh>
+
+//#include <oln/io/read_image.hh>
+//#include <oln/basics2d.hh>
+//#include <oln/core/abstract/image_with_nbh.hh>
+//#include <oln/morpho/opening.hh>
+//#include <oln/morpho/geodesic_erosion.hh>
+//#include <ntg/all.hh>
+
+
+bool check()
+{
+ // FIXME : really test this algorithm
+ // FAKE test below
+ std::cout << "FIXME : md5 does not math with olena-0.10 reference" << std::endl;
+ return false;
+ // FIXME : end fake test
+
+// oln::utils::key::value_type data_key[16] =
+// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // md5 of object.pbm's geodesic_erosion result
+// oln::utils::key key(data_key);
+
+// typedef oln::image2d<ntg::bin> im_type;
+
+// oln::neighborhood2d nbh(oln::neighb_c4());
+
+// im_type marker;
+// im_type mask;
+
+// marker = oln::io::read(rdata("object.pbm"));
+// mask = oln::morpho::opening(mask, oln::win_c4p()).exact();
+
+// if (oln::utils::md5(oln::morpho::geodesic_erosion(join(marker, nbh), mask).exact()) == key)
+// {
+// std::cout << "OK" << std::endl;
+// return false;
+// }
+// else
+// {
+// std::cout << "FAIL" << std::endl;
+// return true;
+// }
+}
Index: tests/morpho/tests/geodesic_dilation
--- tests/morpho/tests/geodesic_dilation (revision 0)
+++ tests/morpho/tests/geodesic_dilation (revision 0)
@@ -0,0 +1,44 @@
+#include "data.hh"
+//#include <oln/utils/md5.hh>
+
+//#include <oln/io/read_image.hh>
+//#include <oln/basics2d.hh>
+//#include <oln/core/abstract/image_with_nbh.hh>
+//#include <oln/morpho/opening.hh>
+//#include <oln/morpho/geodesic_erosion.hh>
+//#include <ntg/all.hh>
+
+bool check()
+{
+ // FIXME : really test this algorithm
+ // FAKE test below
+ std::cout << "FIXME : md5 does not math with olena-0.10 reference" << std::endl;
+ return false;
+ // FIXME : end fake test
+
+// oln::utils::key::value_type data_key[16] =
+// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; // md5 of object.pbm's geodesic_dilation result
+// oln::utils::key key(data_key);
+
+// typedef oln::image2d<ntg::bin> im_type;
+
+// oln::neighborhood2d nbh(oln::neighb_c4());
+
+// im_type marker;
+// im_type mask;
+
+// mask = oln::io::read(rdata("object.pbm"));
+// marker = oln::morpho::opening(mask, oln::win_c4p()).exact();
+
+// if (oln::utils::md5(oln::morpho::geodesic_dilation(join(marker, nbh), mask).exact()) == key)
+// {
+// std::cout << "OK" << std::endl;
+// return false;
+// }
+// else
+// {
+// std::cout << "FAIL" << std::endl;
+// return true;
+// }
+}
Index: oln/morpho/geodesic_dilation.hh
--- oln/morpho/geodesic_dilation.hh (revision 0)
+++ oln/morpho/geodesic_dilation.hh (revision 0)
@@ -0,0 +1,133 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 2005 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, 59 Temple Place - Suite 330, 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.
+
+#ifndef OLENA_MORPHO_GEODESIC_DILATION_HH
+# define OLENA_MORPHO_GEODESIC_DILATION_HH
+
+# include <mlc/cmp.hh>
+
+# include <oln/core/abstract/image_operator.hh>
+# include <oln/morpho/stat.hh>
+# include <oln/level/compare.hh>
+# include <oln/convert/nbh_to_se.hh>
+# include <oln/arith/min.hh>
+
+# include <oln/core/abstract/neighborhood.hh>
+# include <oln/morpho/dilation.hh>
+
+namespace oln {
+
+ namespace morpho {
+
+ // fwd declaration
+ template <class I1, class I2> struct geodesic_dilation_ret;
+
+ namespace proc {
+
+ template<class I1, class I2>
+ oln_type_of(I1, concrete)
+ geodesic_dilation(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask)
+ {
+ mlc::eq<oln_type_of(I1, size), oln_type_of(I2, size)>::ensure();
+ precondition(marker.size() == mask.size());
+ precondition(level::is_greater_or_equal(mask, marker));
+ oln_type_of(I1, concrete) output(marker.size());
+ marker.border_adapt_copy(marker.nbh_get().delta());
+ oln_type_of(I1, piter) p(marker);
+ for_all (p)
+ output[p] = arith::min(morpho::max(marker, p, convert::nbh_to_cse(marker.nbh_get())),
+ mask[p]);
+ return output;
+ }
+
+ } // end of namespace oln::morpho::proc
+
+ } // end of namespace oln::morpho
+
+
+
+ // super_type
+ template <class I1, class I2>
+ struct set_super_type< morpho::geodesic_dilation_ret<I1, I2> >
+ {
+ typedef abstract::image_binary_operator<oln_type_of(I1, concrete), I1, I2, morpho::geodesic_dilation_ret<I1, I2> > ret;
+ };
+
+
+ namespace morpho {
+
+ template <class I1, class I2>
+ struct geodesic_dilation_ret : public abstract::image_binary_operator<oln_type_of(I1, concrete), I1, I2, morpho::geodesic_dilation_ret<I1, I2> >
+ {
+ typedef abstract::image_binary_operator<oln_type_of(I1, concrete), I1, I2, geodesic_dilation_ret<I1, I2> > super_type;
+
+ geodesic_dilation_ret(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
+ {}
+ };
+
+
+ namespace safe {
+
+ template <class I1, class I2>
+ struct geodesic_dilation : public geodesic_dilation_ret<I1, I2>
+ {
+ typedef geodesic_dilation_ret<I1, I2> super_type;
+
+ geodesic_dilation(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
+ {}
+
+ void impl_run()
+ {
+ mlc::eq<oln_type_of(I1, size), oln_type_of(I2, size)>::ensure();
+ precondition((this->input1).size() == (this->input2).size());
+ precondition(level::is_greater_or_equal(this->input2, this->input1));
+ this->output = arith::min(dilation(this->input1.unbox(), this->input1.unbox().nbh_get()).output.unbox(), this->input2.unbox()).output;
+ }
+ };
+
+ } // end of namespace oln::morpho::safe
+
+ template<class I1, class I2>
+ geodesic_dilation_ret<I1, I2>
+ geodesic_dilation(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask)
+ {
+ safe::geodesic_dilation<I1, I2> tmp(marker, mask);
+ tmp.run();
+ return tmp;
+ }
+
+ } // end of namespace oln::morpho
+
+} // end of namespace oln
+
+#endif // OLENA_MORPHO_GEODESIC_DILATION_HH
Index: oln/morpho/geodesic_erosion.hh
--- oln/morpho/geodesic_erosion.hh (revision 0)
+++ oln/morpho/geodesic_erosion.hh (revision 0)
@@ -0,0 +1,132 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 2005 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, 59 Temple Place - Suite 330, 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.
+
+#ifndef OLENA_MORPHO_GEODESIC_EROSION_HH
+# define OLENA_MORPHO_GEODESIC_EROSION_HH
+
+# include <mlc/cmp.hh>
+
+# include <oln/core/abstract/image_operator.hh>
+# include <oln/morpho/stat.hh>
+# include <oln/level/compare.hh>
+# include <oln/convert/nbh_to_se.hh>
+# include <oln/arith/max.hh>
+
+# include <oln/core/abstract/neighborhood.hh>
+# include <oln/morpho/erosion.hh>
+
+namespace oln {
+
+ namespace morpho {
+
+ // fwd declaration
+ template <class I1, class I2> struct geodesic_erosion_ret;
+
+ namespace proc {
+
+ template<class I1, class I2>
+ oln_type_of(I1, concrete)
+ geodesic_erosion(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask)
+ {
+ mlc::eq<oln_type_of(I1, size), oln_type_of(I2, size)>::ensure();
+ precondition(marker.size() == mask.size());
+ precondition(level::is_greater_or_equal(marker, mask));
+ oln_type_of(I1, concrete) output(marker.size());
+ marker.border_adapt_copy(marker.nbh_get().delta());
+ oln_type_of(I1, piter) p(marker);
+ for_all (p)
+ output[p] = arith::max(morpho::min(marker, p, convert::nbh_to_cse(marker.nbh_get())),
+ mask[p]);
+ return output;
+ }
+
+ } // end of namespace oln::morpho::proc
+
+ } // end of namespace oln::morpho
+
+
+ // super_type
+ template <class I1, class I2>
+ struct set_super_type< morpho::geodesic_erosion_ret<I1, I2> >
+ {
+ typedef abstract::image_binary_operator<oln_type_of(I1, concrete), I1, I2, morpho::geodesic_erosion_ret<I1, I2> > ret;
+ };
+
+
+ namespace morpho {
+
+ template <class I1, class I2>
+ struct geodesic_erosion_ret : public abstract::image_binary_operator<oln_type_of(I1, concrete), I1, I2, morpho::geodesic_erosion_ret<I1, I2> >
+ {
+ typedef abstract::image_binary_operator<oln_type_of(I1, concrete), I1, I2, geodesic_erosion_ret<I1, I2> > super_type;
+
+ geodesic_erosion_ret(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
+ {}
+ };
+
+
+ namespace safe {
+
+ template <class I1, class I2>
+ struct geodesic_erosion : public geodesic_erosion_ret<I1, I2>
+ {
+ typedef geodesic_erosion_ret<I1, I2> super_type;
+
+ geodesic_erosion(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask) :
+ super_type(marker, mask)
+ {}
+
+ void impl_run()
+ {
+ mlc::eq<oln_type_of(I1, size), oln_type_of(I2, size)>::ensure();
+ precondition((this->input1).size() == (this->input2).size());
+ precondition(level::is_greater_or_equal(this->input2, this->input1));
+ this->output = arith::max(erosion(this->input1.unbox(), this->input1.unbox().nbh_get()).output.unbox(), this->input2.unbox()).output;
+ }
+ };
+
+ } // end of namespace oln::morpho::safe
+
+ template<class I1, class I2>
+ geodesic_erosion_ret<I1, I2>
+ geodesic_erosion(const abstract::image_with_nbh<I1>& marker,
+ const abstract::image<I2>& mask)
+ {
+ safe::geodesic_erosion<I1, I2> tmp(marker, mask);
+ tmp.run();
+ return tmp;
+ }
+
+ } // end of namespace oln::morpho
+
+} // end of namespace oln
+
+#endif // OLENA_MORPHO_GEODESIC_EROSION_HH
https://svn.lrde.epita.fr/svn/oln/prototypes/proto-1.0/olena
ChangeLog | 13 +++++
oln/core/any/grid.hh | 71 +++++++++++++++++++++++++++
oln/core/any/point.hh | 12 ++++
oln/core/pw/apply.hh | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++
oln/makefile.src | 2
tests/pw/Makefile.am | 5 +
tests/pw/tests/apply | 18 +++++++
7 files changed, 247 insertions(+), 1 deletion(-)
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add apply on point-wise functions.
* oln/core/pw/apply.hh: New file.
* tests/pw/Makefile.am: New file.
* tests/pw/tests/apply: New test.
* oln/core/any/grid.hh: New file.
* oln/core/any/point.hh: Conform to abstract::point constraints.
* oln/makefile.src (OLN_DEP): Add core/any/grid.hh and
core/pw/apply.hh.
2005-04-13 Roland Levillain <roland(a)lrde.epita.fr>
Property changes on: tests/pw
___________________________________________________________________
Name: svn:ignore
+ Makefile.in
Makefile
Index: tests/pw/tests/apply
--- tests/pw/tests/apply (revision 0)
+++ tests/pw/tests/apply (revision 0)
@@ -0,0 +1,18 @@
+ // -*- C++ -*-
+#include <iostream>
+
+#include <cmath>
+#include <oln/core/pw/apply.hh>
+#include <oln/core/pw/literal.hh>
+#include <oln/core/any/point.hh>
+
+using namespace oln;
+
+bool check()
+{
+ any_point p;
+ pw::literal<int> pv1 (p_lit(42));
+
+ int res = p_apply(mlc::make_unary_fun(std::negate<int>()), pv1)(p);
+ return !(res == -42);
+}
Index: tests/pw/Makefile.am
--- tests/pw/Makefile.am (revision 0)
+++ tests/pw/Makefile.am (revision 0)
@@ -0,0 +1,5 @@
+include ../check/Makefile.runtests
+include ../check/Makefile.check
+
+
+check-local: check-runtests
Index: oln/core/pw/apply.hh
--- oln/core/pw/apply.hh (revision 0)
+++ oln/core/pw/apply.hh (revision 0)
@@ -0,0 +1,127 @@
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330, 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.
+
+#ifndef OLENA_CORE_PW_APPLY_HH
+# define OLENA_CORE_PW_APPLY_HH
+
+# include <mlc/fun.hh>
+# include <oln/core/pw/abstract/function.hh>
+# include <oln/core/pw/macros.hh>
+
+
+namespace oln {
+
+ /*--------.
+ | Unary. |
+ `--------*/
+
+ // fwd decl
+ namespace pw {
+ template <typename F, typename T>
+ struct apply;
+ }
+
+ // super type
+ template <typename F, typename T>
+ struct set_super_type < pw::apply<F, T> >
+ {
+ typedef pw::abstract::function< pw::apply<F, T> > ret;
+ };
+
+ // props
+ template <typename F, typename T>
+ struct set_props < category::pw, pw::apply<F, T> >
+ {
+ typedef oln_pw_type_of(T, point) point_type;
+ typedef typename F::result_type value_type;
+ typedef oln_pw_type_of(T, size) size_type;
+ };
+
+
+ namespace pw {
+
+ template <typename F, typename T>
+ struct apply : public abstract::function < apply<F, T> >
+ {
+ typedef apply<F, T> self_type;
+
+ typedef oln_pw_type_of(self_type, point) point_type;
+ typedef oln_pw_type_of(self_type, value) value_type;
+ typedef oln_pw_type_of(self_type, size) size_type;
+
+ typedef abstract::function<self_type> super_type;
+
+ F f_;
+ T input_;
+
+ apply(const mlc::abstract::unary_function<F>& f,
+ const abstract::function<T>& input) :
+ super_type(),
+ f_(f.exact()),
+ input_(input.exact())
+ {
+ }
+
+ const size_type& impl_size() const
+ {
+ return input_.size();
+ }
+
+ const value_type impl_get(const point_type& p) const
+ {
+ return f_(input_(p));
+ }
+
+ bool impl_hold(const point_type& p) const
+ {
+ return input_.hold(p);
+ }
+
+ bool impl_hold_large(const point_type& p) const
+ {
+ return input_.hold_large(p);
+ }
+ };
+
+
+ } // end of namespace oln::pw
+
+} // end of namespace oln
+
+
+/// apply function on pwf
+
+template <typename F, typename T>
+oln::pw::apply<F, T> p_apply (const mlc::abstract::unary_function<F>& f,
+ const oln::pw::abstract::function<T>& x)
+{
+ oln::pw::apply<F, T> tmp(f, x);
+ return tmp;
+}
+
+
+#endif // ! OLENA_CORE_PW_APPLY_HH
Index: oln/core/any/grid.hh
--- oln/core/any/grid.hh (revision 0)
+++ oln/core/any/grid.hh (revision 0)
@@ -0,0 +1,71 @@
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330, 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.
+
+#ifndef OLENA_CORE_ANY_GRID_HH
+# define OLENA_CORE_ANY_GRID_HH
+
+# include <mlc/value.hh>
+# include <oln/core/abstract/grid.hh>
+
+
+namespace oln {
+
+ // fwd decls
+ struct any_grid;
+ struct any_point;
+ struct any_dpoint;
+ struct any_coord;
+
+ // super type
+ template <>
+ struct set_super_type < any_grid >
+ {
+ typedef abstract::grid< any_grid > ret;
+ };
+
+ // props
+ template <>
+ struct set_props < category::grid, any_grid >
+ {
+ typedef any_point point_type;
+ typedef any_dpoint dpoint_type;
+ typedef any_coord coord_type;
+ typedef mlc::value<unsigned,0> dimvalue_type;
+ };
+
+ struct any_grid : public abstract::grid< any_grid >
+ {
+ protected:
+ any_grid()
+ {}
+ };
+
+} // end of namespace oln
+
+
+
+#endif // ! OLENA_CORE_ANY_GRID_HH
Index: oln/core/any/point.hh
--- oln/core/any/point.hh (revision 138)
+++ oln/core/any/point.hh (working copy)
@@ -31,6 +31,7 @@
# include <iostream>
# include <oln/core/abstract/point.hh>
# include <oln/core/abstract/dpoint.hh>
+# include <oln/core/any/grid.hh>
namespace oln {
@@ -38,32 +39,41 @@
// fwd decls
struct any_point;
struct any_dpoint;
+ struct any_grid;
// props
template <>
struct set_props < category::point, any_point >
{
typedef any_dpoint dpoint_type;
+ typedef any_grid grid_type;
+ typedef any_coord coord_type;
};
struct any_point : public abstract::point < any_point >
{
-
bool impl_eq(const exact_type& rhs) const
{
return this->exact().impl_eq(rhs.exact());
}
+ const any_point impl_plus(const any_dpoint& rhs) const;
+
template <typename D>
const any_point impl_plus(const abstract::dpoint<D>& rhs) const
{
return any_point();
}
+ const any_dpoint impl_minus(const any_point& rhs) const;
+
template <typename P>
const any_dpoint impl_minus(const abstract::point<P>& rhs) const;
+ const any_coord impl_nth(unsigned i) const;
+
+ any_coord& impl_nth(unsigned i);
};
Index: oln/makefile.src
--- oln/makefile.src (revision 138)
+++ oln/makefile.src (working copy)
@@ -77,6 +77,7 @@
\
core/any/all.hh \
core/any/dpoint.hh \
+ core/any/grid.hh \
core/any/point.hh \
core/any/size.hh \
\
@@ -96,6 +97,7 @@
\
core/pw/abstract/binary_function.hh \
core/pw/abstract/function.hh \
+ core/pw/apply.hh \
core/pw/all.hh \
core/pw/cmp.hh \
core/pw/div.hh \
Ce patch ajoute un petit script olena/tests/sanity/check dans le
builddir qui permet de lancer un sanity check sur un fichier
donné. (Il est généré par configure, n'oubliez pas de relancer ce
dernier pour voir apparaître ce script).
Il suffit ensuite de le lancer en lui passant en argument un nom de
fichier, avec le chemin relatif au répertoire source d'Olena :
brasilia ~/src/oln % olena/tests/sanity/check oln/core/2d/point2d.hh
PASS: oln/core/2d/point2d.hh
C'est vraiment quick n' dirty , mais ça permet de gagner du temps
lorsque l'on veut relancer un test sur un fichier donné. (Le script
initial, olena/tests/sanity/includes.test avait plus ou moins cette
fonctionnalité, mais il fallait lui passer beaucoup de choses pour
qu'il fonctionne).
https://svn.lrde.epita.fr/svn/oln/prototypes/proto-1.0/olena
ChangeLog | 5 +++++
tests/sanity/Makefile.am | 2 +-
tests/sanity/check.in | 30 ++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+), 1 deletion(-)
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
* tests/sanity/check.in: New file.
* tests/sanity/Makefile.am (EXTRA_DIST): Add check.in.
2005-04-11 Roland Levillain <roland(a)lrde.epita.fr>
Index: tests/sanity/check.in
--- tests/sanity/check.in (revision 0)
+++ tests/sanity/check.in (revision 0)
@@ -0,0 +1,30 @@
+#! /bin/sh
+
+# Check that a header is self-contained and generates no warning.
+# This script is meant to be used ``by-hand'' to check a single file.
+
+: ${VERBOSE=1}
+
+. "@abs_builddir@/../check/defs" || exit 1
+
+set -e
+
+if test $# = 0; then
+ echo "usage: $0 oln/path/to/file.hh"
+ echo "(File path is relative to the Olena source directory.)"
+ exit 1
+else
+ top_srcdir=@abs_top_srcdir@
+ top_builddir=@abs_top_builddir@
+ file=$1
+ CPPFLAGS="$CPPFLAGS \
+ -I$top_srcdir/metalic -I$top_builddir/metalic \
+ -I$top_srcdir/integre -I$top_builddir/integre \
+ -I$top_srcdir/olena -I$top_builddir/olena"
+ echo "#include <$file>" > incltest.cc
+ if $CXX $CPPFLAGS $CXXFLAGS -c incltest.cc; then
+ echo " PASS: $file"
+ else
+ echo " FAIL: $file"
+ fi
+fi
Property changes on: tests/sanity/check.in
___________________________________________________________________
Name: svn:executable
+ *
Index: tests/sanity/Makefile.am
--- tests/sanity/Makefile.am (revision 135)
+++ tests/sanity/Makefile.am (working copy)
@@ -1,4 +1,4 @@
-EXTRA_DIST = includes.test
+EXTRA_DIST = check.in includes.test
check:
TOP_SRCDIR=$(top_srcdir) SRCDIR=$(srcdir) \