https://svn.lrde.epita.fr/svn/oln/prototypes/proto-1.0
ChangeLog | 11 +++++++++++
oln/core/apply.hh | 12 ++++++------
tests/core/tests/apply-binary | 16 +++++++---------
tests/core/tests/apply-unary | 18 +++++++++---------
4 files changed, 33 insertions(+), 24 deletions(-)
Index: olena/ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix oln::apply.
* oln/core/apply.hh (apply1_type::impl_run)
(apply2_type::impl_run): Catch up with the new image_operator
definition.
* tests/core/tests/apply-unary, tests/core/tests/apply-binary: Fix
tests.
Conform to Olena coding standard.
2005-04-13 Roland Levillain <roland(a)lrde.epita.fr>
Index: olena/tests/core/tests/apply-unary
--- olena/tests/core/tests/apply-unary (revision 139)
+++ olena/tests/core/tests/apply-unary (working copy)
@@ -50,8 +50,8 @@
{
oln::image2d<int> ima;
ima = oln::apply(f_mult_3(), ima1);
- if (oln::level::is_equal(ima, ima2))
- return false;
+ if (!oln::level::is_equal(ima, ima2))
+ return true;
}
// oln::apply, with a mlc::unary_function built using the helper
@@ -59,8 +59,8 @@
{
oln::image2d<int> ima;
ima = oln::apply(mlc::make_unary_fun(mult_3), ima1);
- if (oln::level::is_equal(ima, ima2))
- return false;
+ if (!oln::level::is_equal(ima, ima2))
+ return true;
}
// oln::apply, with a mlc::unary_function built using the helper
@@ -68,8 +68,8 @@
{
oln::image2d<int> ima;
ima = oln::apply (mlc::make_unary_fun(std::negate<int>()), ima1);
- if (oln::level::is_equal(ima, ima3))
- return false;
+ if (!oln::level::is_equal(ima, ima3))
+ return true;
}
// oln::apply, with a (more complex) mlc::unary_function built using
@@ -79,9 +79,9 @@
ima =
oln::apply (mlc::make_unary_fun(std::bind2nd(std::multiplies<int>(), 3)),
ima1);
- if (oln::level::is_equal(ima, ima2))
- return false;
+ if (!oln::level::is_equal(ima, ima2))
+ return true;
}
- return true;
+ return false;
}
Index: olena/tests/core/tests/apply-binary
--- olena/tests/core/tests/apply-binary (revision 139)
+++ olena/tests/core/tests/apply-binary (working copy)
@@ -50,19 +50,17 @@
// oln::apply, with a hand-made mlc::abstract::binary_function.
{
oln::image2d<int> ima;
-
ima = oln::apply(f_mult(), ima1, ima2);
- if (oln::level::is_equal(ima, ima3))
- return false;
+ if (!oln::level::is_equal(ima, ima3))
+ return true;
}
-
// oln::apply, with a mlc::binary_function built using the helper
// function mlc::make_binary_fun on a classic function.
{
oln::image2d<int> ima;
ima = oln::apply(mlc::make_binary_fun(mult), ima1, ima2);
- if (oln::level::is_equal(ima, ima3))
- return false;
+ if (!oln::level::is_equal(ima, ima3))
+ return true;
}
// oln::apply, with a mlc::binary_function built using the helper
@@ -71,9 +69,9 @@
oln::image2d<int> ima;
ima =
oln::apply (mlc::make_binary_fun(std::multiplies<int>()), ima1, ima2);
- if (oln::level::is_equal(ima, ima3))
- return false;
+ if (!oln::level::is_equal(ima, ima3))
+ return true;
}
- return true;
+ return false;
}
Index: olena/oln/core/apply.hh
--- olena/oln/core/apply.hh (revision 139)
+++ olena/oln/core/apply.hh (working copy)
@@ -78,11 +78,11 @@
void impl_run()
{
- output_type output(input_.size());
+ output_type tmp(input_.size());
oln_type_of(I, fwd_piter) p(input_.size());
for_all(p)
- output[p] = f_(input_[p]);
- this->image_ = output;
+ tmp[p] = f_(input_[p]);
+ this->output = tmp;
}
};
@@ -152,11 +152,11 @@
void impl_run()
{
- output_type output(input1_.size());
+ output_type tmp(input1_.size());
oln_type_of(I1, fwd_piter) p(input1_.size());
for_all(p)
- output[p] = f_(input1_[p], input2_[p]);
- this->image_ = output;
+ tmp[p] = f_(input1_[p], input2_[p]);
+ this->output = tmp;
}
};