* tests/binarization/Makefile.am: Change MOSTLYCLEANFILES to
EXTRA_DISt.
* tests/binarization/threshold-out.pbm: New. Reference output.
* tests/binarization/threshold.cc: Write a test.
---
milena/ChangeLog | 11 +++++++
milena/tests/binarization/Makefile.am | 7 ++---
milena/tests/binarization/threshold-out.pbm | Bin 0 -> 32884 bytes
milena/tests/binarization/threshold.cc | 39 +++++++++-----------------
4 files changed, 28 insertions(+), 29 deletions(-)
create mode 100644 milena/tests/binarization/threshold-out.pbm
diff --git a/milena/ChangeLog b/milena/ChangeLog
index edf3a65..141b0ba 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,14 @@
+2013-05-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Write binarization::threshold test.
+
+ * tests/binarization/Makefile.am: Change MOSTLYCLEANFILES to
+ EXTRA_DISt.
+
+ * tests/binarization/threshold-out.pbm: New. Reference output.
+
+ * tests/binarization/threshold.cc: Write a test.
+
2013-04-17 Guillaume Lazzara <z(a)lrde.epita.fr>
* doc/mln/convert.dox: Fix from_to_ module name.
diff --git a/milena/tests/binarization/Makefile.am
b/milena/tests/binarization/Makefile.am
index 27144e4..63e499d 100644
--- a/milena/tests/binarization/Makefile.am
+++ b/milena/tests/binarization/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2008, 2009, 2010 EPITA Research and Development
+# Copyright (C) 2008, 2009, 2010, 2013 EPITA Research and Development
# Laboratory (LRDE).
#
# This file is part of Olena.
@@ -23,6 +23,5 @@ check_PROGRAMS = \
TESTS = $(check_PROGRAMS)
-MOSTLYCLEANFILES = \
- threshold-out1.pgm \
- threshold-out2.pgm
+EXTRA_DIST = \
+ threshold-out.pbm
diff --git a/milena/tests/binarization/threshold-out.pbm
b/milena/tests/binarization/threshold-out.pbm
new file mode 100644
index 0000000..f84d76d
Binary files /dev/null and b/milena/tests/binarization/threshold-out.pbm differ
diff --git a/milena/tests/binarization/threshold.cc
b/milena/tests/binarization/threshold.cc
index 3a34f91..4d8fe70 100644
--- a/milena/tests/binarization/threshold.cc
+++ b/milena/tests/binarization/threshold.cc
@@ -1,5 +1,5 @@
-// Copyright (C) 2007, 2008, 2009, 2010 EPITA Research and Development
-// Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2010, 2013 EPITA Research and
+// Development Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -26,35 +26,24 @@
#include <mln/core/image/image2d.hh>
#include <mln/binarization/threshold.hh>
-#include <mln/data/all.hh>
-
+#include <mln/io/pbm/load.hh>
#include <mln/io/pgm/load.hh>
-#include <mln/io/ppm/load.hh>
-#include <mln/io/pbm/save.hh>
+#include <mln/data/compare.hh>
+#include <mln/value/int_u8.hh>
#include "tests/data.hh"
int main()
{
using namespace mln;
- using value::int_u8;
-
- {
- image2d<int_u8> lena;
- io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
-
- io::pbm::save(binarization::threshold(lena, 50), "threshold-out1.pgm");
- }
-
- {
- image2d<int_u8> l;
- io::pgm::load(l, MLN_IMG_DIR "/lena.pgm");
- image2d<int> lena(l.domain(), 0);
-
- data::paste(l, lena);
-
- io::pbm::save(binarization::threshold(lena, 50), "threshold-out2.pgm");
- }
-
+ image2d<value::int_u8> lena;
+ io::pgm::load(lena, MLN_IMG_DIR "/lena.pgm");
+
+ image2d<bool> bin = binarization::threshold(lena, 50);
+
+ image2d<bool> ref;
+ io::pbm::load(ref, MLN_TESTS_DIR "/binarization/threshold-out.pbm");
+
+ mln_assertion(ref == bin);
}
--
1.7.2.5