proto-1.0 150: Fix core/fwd_qiter2d test

https://svn.lrde.epita.fr/svn/oln/prototypes/proto-1.0 ChangeLog | 14 ++++++++++++++ oln/core/abstract/qiter.hh | 2 +- oln/core/gen/regular_fwd_qiter.hh | 5 +++-- oln/core/gen/regular_qiter.hh | 2 ++ tests/core/tests/fwd_qiter2d | 11 ++++------- tests/core/tests/fwd_witer2d | 26 -------------------------- 6 files changed, 24 insertions(+), 36 deletions(-) Index: olena/ChangeLog from Roland Levillain <roland@lrde.epita.fr> Fix core/fwd_qiter2d test. * tests/core/tests/fwd_witer2d: Rename file as... * tests/core/tests/fwd_qiter2d: ...this. Adjust to the new interface of q-iterators. * oln/core/gen/regular_fwd_qiter.hh (abstract::qiter<self_type>): Make it a friend. (impl_invalidate): Explicitely cast to avoid comparisons between signed and unsigned values. * oln/core/gen/regular_qiter.hh (abstract::qiter<E>): Make it a friend. 2005-04-14 Roland Levillain <roland@lrde.epita.fr> Index: olena/tests/core/tests/fwd_witer2d --- olena/tests/core/tests/fwd_witer2d (revision 149) +++ olena/tests/core/tests/fwd_witer2d (working copy) @@ -1,26 +0,0 @@ - // -*- C++ -*- -#include <oln/core/2d/fwd_witer2d.hh> -#include <oln/core/abstract/piter.hh> - -#include <ntg/all.hh> - -#include <cassert> - -using namespace oln; -using namespace ntg; - -template <typename E> -bool foo(const E& w) -{ - oln_type_of(E, fwd_witer) i(w); - unsigned cpt = 0; - for_all(i) - ++cpt; - return not (cpt == w.card()); -} - -int main() -{ - window2d w = win_c8p(); - return foo(w); -} Index: olena/tests/core/tests/fwd_qiter2d --- olena/tests/core/tests/fwd_qiter2d (revision 147) +++ olena/tests/core/tests/fwd_qiter2d (working copy) @@ -1,20 +1,17 @@ // -*- C++ -*- -#include <oln/core/2d/fwd_witer2d.hh> -#include <oln/core/abstract/piter.hh> - -#include <ntg/all.hh> +#include <oln/core/2d/window2d.hh> #include <cassert> using namespace oln; -using namespace ntg; template <typename E> bool foo(const E& w) { - oln_type_of(E, fwd_witer) i(w); + oln_wn_type_of(E, fwd_iter) q(w); unsigned cpt = 0; - for_all(i) + point2d p; + for_all_q_of_p(q, p) ++cpt; return not (cpt == w.card()); } Index: olena/oln/core/abstract/qiter.hh --- olena/oln/core/abstract/qiter.hh (revision 149) +++ olena/oln/core/abstract/qiter.hh (working copy) @@ -35,7 +35,7 @@ # define for_all_q_of_p(q, p) \ - for(q.ensure_is_qiter(), q.center_at(p), q.start(); q.is_valid(); q.next()) + for(q.ensure_is_qiter(), q.start_at_p(p); q.is_valid(); q.next()) # define for_all_remaining_q( q ) \ for(q.ensure_is_piter(); q.is_valid(); q.next()) Index: olena/oln/core/gen/regular_fwd_qiter.hh --- olena/oln/core/gen/regular_fwd_qiter.hh (revision 149) +++ olena/oln/core/gen/regular_fwd_qiter.hh (working copy) @@ -54,6 +54,7 @@ } friend class abstract::iter<self_type>; + friend class abstract::qiter<self_type>; protected: @@ -69,12 +70,12 @@ bool impl_is_valid() const { - return this->pos_ != this->win_.card(); + return this->pos_ != int(this->win_.card()); } void impl_invalidate() { - this->pos_ = this->win_.card(); + this->pos_ = int(this->win_.card()); } }; Index: olena/oln/core/gen/regular_qiter.hh --- olena/oln/core/gen/regular_qiter.hh (revision 149) +++ olena/oln/core/gen/regular_qiter.hh (working copy) @@ -80,6 +80,8 @@ return point_type(*this).nth(i); } + friend class abstract::qiter<E>; + protected: int pos_;
participants (1)
-
Roland Levillain