* tests/test/positive.cc: Here.
---
milena/ChangeLog | 6 +++++
milena/tests/test/positive.cc | 49 +++++++++++++++++++++--------------------
2 files changed, 31 insertions(+), 24 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 568fad9..7897b5e 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,11 @@
2014-04-02 Roland Levillain <roland(a)lrde.epita.fr>
+ Milena: Streamline mln/test/positive.cc.
+
+ * tests/test/positive.cc: Here.
+
+2014-04-02 Roland Levillain <roland(a)lrde.epita.fr>
+
Milena: Improve the documentation of mln::test::positive.
* mln/test/positive.hh: Here.
diff --git a/milena/tests/test/positive.cc b/milena/tests/test/positive.cc
index 2dc4ac3..b5a8e40 100644
--- a/milena/tests/test/positive.cc
+++ b/milena/tests/test/positive.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2014 EPITA Research and Development
+// Laboratory (LRDE).
//
// This file is part of Olena.
//
@@ -23,36 +24,36 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
+/// \brief Exercise mln::test::positive.
+
#include <mln/core/image/image2d.hh>
-#include <mln/data/fill.hh>
#include <mln/test/positive.hh>
-
-// both test routines can be called with a p2b function
-
-template <typename F>
-void test_p2v(const mln::Function_v2v<F>&)
-{
-}
-
-template <typename F>
-void test_v2b(const mln::Function_v2b<F>&)
-{
-}
-
-
+#include <mln/data/fill.hh>
+#include <mln/debug/iota.hh>
int main()
{
using namespace mln;
typedef image2d<int> I;
- I ima(1,1);
- data::fill(ima, 0);
-
- 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);
+ /* Null values.
+
+ Note that mln::test::positive actually checks whether all the
+ values of an image are non-negative, thus considering 0 as a
+ valid value (which is usually not the case of the term
+ ``positive'' in English). */
+ I zeros(3,3);
+ data::fill(zeros, 0);
+ mln_assertion(test::positive(zeros));
+
+ /* Positive (non-null) natural numbers. */
+ I naturals(3,3);
+ debug::iota(naturals);
+ mln_assertion(test::positive(naturals));
+
+ /* Negative (non-null) numbers. */
+ I negatives(3,3);
+ data::fill(negatives, -42);
+ mln_assertion(!test::positive(negatives));
}
--
1.7.10.4
Show replies by date