https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix access to images in tests.
* tests/data.hh: New file.
* tests/io_pnm: Include it.
(main): Use rdata to compute the path to loaded images.
* tests/window2d.cc: Likewise.
Add copyright header.
* tests/Makefile.am (AM_CPPFLAGS): Add -I$(srcdir)/check and
-DOLN_IMG_DIR=\"$(top_srcdir)/olena/img\".
(noinst_HEADERS): New.
Add data.hh
* tests/check/Makefile.am (EXTRA_DIST): Add Makefile.flags.
Makefile.am | 7 ++++++-
check/Makefile.am | 8 ++++----
data.hh | 15 +++++++++++++++
io_pnm.cc | 7 +++++--
window2d.cc | 32 +++++++++++++++++++++++++++++++-
5 files changed, 61 insertions(+), 8 deletions(-)
Index: tests/window2d.cc
--- tests/window2d.cc (revision 630)
+++ tests/window2d.cc (working copy)
@@ -1,8 +1,38 @@
+// Copyright (C) 2006 EPITA Research and Development Laboratory
+//
+// 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.
+
+/// Test oln::window2d.
+
#include <oln/basics2d.hh>
#include <oln/debug/print.hh>
#include <oln/io/pnm.hh>
#include <oln/morpher/add_neighborhood.hh>
+#include "data.hh"
namespace test
{
@@ -29,7 +59,7 @@
{
using namespace oln;
- image2d<unsigned char> ima = io::load_pgm("../img/lena32.pgm");
+ image2d<unsigned char> ima = io::load_pgm(rdata("lena32.pgm"));
debug::println(ima);
window2d win;
Index: tests/io_pnm.cc
--- tests/io_pnm.cc (revision 630)
+++ tests/io_pnm.cc (working copy)
@@ -28,12 +28,15 @@
/// Test oln::io_pnm.cc.
#include <cassert>
+
#include <oln/basics2d.hh>
#include <oln/io/pnm.hh>
+#include "data.hh"
+
int
main()
{
- oln::image2d<bool> ima =
oln::io::load_pbm("../img/chien.pbm");
- oln::image2d<unsigned char> ima2 =
oln::io::load_pgm("../img/lena32.pgm");
+ oln::image2d<bool> ima =
oln::io::load_pbm(rdata("chien.pbm"));
+ oln::image2d<unsigned char> ima2 =
oln::io::load_pgm(rdata("lena32.pgm"));
}
Index: tests/data.hh
--- tests/data.hh (revision 0)
+++ tests/data.hh (revision 0)
@@ -0,0 +1,15 @@
+// FIXME: Should be compiled in libolncheck, as in Olena 0.10.
+// (This is temporary.)
+
+#ifndef OLN_TESTS_DATA_HH
+# define OLN_TESTS_DATA_HH
+
+#include <iostream>
+
+std::string
+rdata(const std::string& file)
+{
+ return OLN_IMG_DIR "/" + file;
+}
+
+#endif // ! OLN_TESTS_DATA_HH
Index: tests/Makefile.am
--- tests/Makefile.am (revision 630)
+++ tests/Makefile.am (working copy)
@@ -2,9 +2,13 @@
SUBDIRS = check sanity
+# FIXME: Revamp (see Olena 0.10's test suite).
+
AM_CPPFLAGS = \
+ -I$(srcdir)/check \
-I$(top_srcdir)/olena -I$(top_srcdir)/extended \
- -I$(top_srcdir)/static -I$(top_srcdir)/metalic
+ -I$(top_srcdir)/static -I$(top_srcdir)/metalic \
+ -DOLN_IMG_DIR=\"$(top_srcdir)/olena/img\"
# FIXME: Add
#
@@ -16,6 +20,7 @@
TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
CXXFLAGS += $(TESTS_CXXFLAGS)
+noinst_HEADERS = data.hh
check_PROGRAMS = \
dpoint2d \
Index: tests/check/Makefile.am
--- tests/check/Makefile.am (revision 630)
+++ tests/check/Makefile.am (working copy)
@@ -1,10 +1,11 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
-# FIXME: To be enabled when the test suite mechanism is available.
+## FIXME: To be (fully) enabled when the test suite mechanism is available.
# include Makefile.flags
-# AM_CPPFLAGS += -DCXX=\""$(CXX)"\" \
+# AM_CPPFLAGS +=
+# -DCXX=\""$(CXX)"\" \
# -DCPPFLAGS=\""$(CPPFLAGS)"\" \
# -DCXXFLAGS=\""$(CXXFLAGS)"\" \
# -DOLN_EXTRA_CPPFLAGS=\""$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
$(CPPFLAGS)"\" \
@@ -30,5 +31,4 @@
# data.cc \
# $(COMMON_CHECK_SOURCES)
-
-# EXTRA_DIST = Makefile.flags Makefile.check Makefile.runtests
+EXTRA_DIST = Makefile.flags # Makefile.check Makefile.runtests