URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-13 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
A better test for io::pbm.
* tests/io_pbm.cc: Take a pgm, binarise it, save it, read it, and
check we we get the same pbm.
---
io_pbm.cc | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
Index: trunk/milena/tests/io_pbm.cc
===================================================================
--- trunk/milena/tests/io_pbm.cc (revision 1478)
+++ trunk/milena/tests/io_pbm.cc (revision 1479)
@@ -32,18 +32,44 @@
#include <mln/core/image2d.hh>
+#include <mln/value/int_u8.hh>
+#include <mln/pw/all.hh>
+
+#include <mln/io/pgm/load.hh>
#include <mln/io/pbm/load.hh>
#include <mln/io/pbm/save.hh>
+#include <mln/level/compare.hh>
+#include <mln/level/fill.hh>
+
+#include <mln/border/thickness.hh>
+
int main()
{
using namespace mln;
+ using typename value::int_u8;
+
+ border::thickness = 0;
+ image2d< int_u8 >
+ lena = io::pgm::load("../img/lena.pgm");
+
- image2d< bool >
- lena = io::pbm::load("../img/lena.pbm");
image2d<bool> out(lena.domain());
+ level::fill(out, pw::value(lena) > pw::cst(127));
+ io::pbm::save(out, "out.pbm");
- //level::transform(lena, binarise(), out);
+ {
+ image2d< bool >
+ lena = io::pbm::load("out.pbm");
+ image2d<bool> out(lena.domain());
io::pbm::save(lena, "out.pbm");
+
+ image2d< bool >
+ lena2 = io::pbm::load("out.pbm");
+
+ io::pbm::save(lena2, "out2.pbm");
+
+ mln_assertion(lena == lena2);
+ }
}