* tests/io/Makefile.am (SUBDIRS): Add io.
* tests/io/off/: New directory.
* tests/io/off/load_bin.cc: New.
* tests/io/off/Makefile.am: New.
---
milena/ChangeLog | 9 +++++
milena/tests/io/Makefile.am | 1 +
milena/tests/io/{ => off}/Makefile.am | 13 +++----
milena/tests/io/off/load_bin.cc | 64 +++++++++++++++++++++++++++++++++
4 files changed, 80 insertions(+), 7 deletions(-)
copy milena/tests/io/{ => off}/Makefile.am (56%)
create mode 100644 milena/tests/io/off/load_bin.cc
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 546bec0..d8b0307 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,14 @@
2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+ Exercise mln::io::load on OFF file (with no color data).
+
+ * tests/io/Makefile.am (SUBDIRS): Add io.
+ * tests/io/off/: New directory.
+ * tests/io/off/load_bin.cc: New.
+ * tests/io/off/Makefile.am: New.
+
+2008-10-16 Roland Levillain <roland(a)lrde.epita.fr>
+
Add a routine to create a complex-based image from an OFF file.
* mln/io/off/load.hh: New.
diff --git a/milena/tests/io/Makefile.am b/milena/tests/io/Makefile.am
index 89cfa56..36d7797 100644
--- a/milena/tests/io/Makefile.am
+++ b/milena/tests/io/Makefile.am
@@ -4,6 +4,7 @@ include $(top_srcdir)/milena/tests/tests.mk
SUBDIRS = \
fits \
+ off \
pbm \
pfm \
pgm \
diff --git a/milena/tests/io/Makefile.am b/milena/tests/io/off/Makefile.am
similarity index 56%
copy from milena/tests/io/Makefile.am
copy to milena/tests/io/off/Makefile.am
index 89cfa56..4b592ce 100644
--- a/milena/tests/io/Makefile.am
+++ b/milena/tests/io/off/Makefile.am
@@ -2,10 +2,9 @@
include $(top_srcdir)/milena/tests/tests.mk
-SUBDIRS = \
- fits \
- pbm \
- pfm \
- pgm \
- pnm \
- ppm
+check_PROGRAMS = \
+ load_bin
+
+load_bin_SOURCES = load_bin.cc
+
+TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/io/off/load_bin.cc b/milena/tests/io/off/load_bin.cc
new file mode 100644
index 0000000..e171704
--- /dev/null
+++ b/milena/tests/io/off/load_bin.cc
@@ -0,0 +1,64 @@
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file tests/io/off/load_bin.cc
+/// \brief Test mln::io::off::load with an
+/// mln::complex_image<3, geom::complex_data<3, point3df>, bool>.
+
+#include <algorithm>
+#include <iterator>
+#include <iostream>
+
+#include <mln/io/off/load.hh>
+
+#include "tests/data.hh"
+
+
+int main()
+{
+ using namespace mln;
+
+ /* FIXME: Create an alias in milena/mln/core/alias/ for this
+ particular image type? */
+ typedef mln::complex_image<2, geom::complex_geometry<2,point3df>, bool>
ima_t;
+ ima_t ima;
+ io::off::load(ima, MLN_MESH_DIR "/tetrahedron.off");
+
+ std::cout << ima.domain().cplx() << std::endl;
+
+ mln_piter_(ima_t) p(ima.domain());
+ for_all(p)
+ {
+ std::cout << "ima(" << p << ") = " <<
ima(p) << " ( ";
+ // Print site(s).
+ typedef mln_site_(ima_t) site_t;
+ site_t s(p);
+ std::copy (s.sites.begin(), s.sites.end(),
+ std::ostream_iterator<site_t::location>(std::cout, " "));
+ std::cout << ")" << std::endl;
+ }
+}
--
1.6.0.1
Show replies by date