URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-23 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Clean util subdirectory tests.
* tests/util/Makefile.am: Update tests file.
* tests/util/branch_iter_ind.cc: New.
* tests/util/eat.cc: New.
* tests/util/graph.cc: New.
* tests/util/ordpair.cc: New.
* tests/util/tree_delete_node.cc: Remove.
* tests/util/util_ordpair.cc: Remove.
---
Makefile.am | 16 +++++++++-
branch_iter_ind.cc | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++
eat.cc | 46 +++++++++++++++++++++++++++++
graph.cc | 58 +++++++++++++++++++++++++++++++++++++
ordpair.cc | 48 ++++++++++++++++++++++++++++++
5 files changed, 250 insertions(+), 1 deletion(-)
Index: trunk/milena/tests/util/util_ordpair.cc (deleted)
===================================================================
Index: trunk/milena/tests/util/tree_delete_node.cc (deleted)
===================================================================
Index: trunk/milena/tests/util/ordpair.cc
===================================================================
--- trunk/milena/tests/util/ordpair.cc (revision 0)
+++ trunk/milena/tests/util/ordpair.cc (revision 1530)
@@ -0,0 +1,48 @@
+// Copyright (C) 2007 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.
+
+/*! \file util/ordpair.cc
+ *
+ * \brief Tests on mln::util::ordpair.
+ */
+
+#include <mln/core/point2d.hh>
+#include <mln/util/ordpair.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ point2d p1(5,6), p2(5,7), p3(4,2);
+
+ mln_assertion(util::ordpair (p2, p1) == util::ordpair (p1, p2));
+ mln_assertion(util::ordpair (p1, p3) < util::ordpair (p1, p2));
+ mln_assertion(util::ordpair (p1, p2) <= util::ordpair (p1, p2));
+ mln_assertion(util::ordpair (p1, p3) <= util::ordpair (p1, p2));
+}
Index: trunk/milena/tests/util/graph.cc
===================================================================
--- trunk/milena/tests/util/graph.cc (revision 0)
+++ trunk/milena/tests/util/graph.cc (revision 1530)
@@ -0,0 +1,58 @@
+// Copyright (C) 2007 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.
+
+/*!
+ * \file tests/util/graph.cc
+ *
+ * \brief test of mln::util::graph
+ *
+ */
+
+#include <mln/util/graph.hh>
+
+int main ()
+{
+ using namespace mln;
+
+ util::graph<void> g;
+
+ g.add_node (); // 0
+ g.add_node (); // 1
+ g.add_node (); // 2
+ g.add_node (); // 3
+ g.add_node (); // 4
+ g.add_node (); // 5
+ g.add_edge (0, 1);
+ g.add_edge (0, 2);
+ g.add_edge (3, 4);
+ g.add_edge (4, 5);
+ g.add_edge (5, 4);
+ g.add_edge (1, 0);
+ g.add_edge (5, 3);
+ g.add_edge (2, 1);
+ g.consistency ();
+}
Index: trunk/milena/tests/util/Makefile.am
===================================================================
--- trunk/milena/tests/util/Makefile.am (revision 1529)
+++ trunk/milena/tests/util/Makefile.am (revision 1530)
@@ -1,12 +1,26 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
check_PROGRAMS = \
branch_iter \
branch_iter_ind \
-graph
+eat \
+graph \
+ordpair \
+tree \
+tree_fast \
+tree_fast_to_image \
+tree_to_image
+
branch_iter_SOURCES = branch_iter.cc
branch_iter_ind_SOURCES = branch_iter_ind.cc
+eat_SOURCES = eat.cc
graph_SOURCES = graph.cc
+ordpair_SOURCES = ordpair.cc
+tree_SOURCES = tree.cc
+tree_fast_SOURCES = tree_fast.cc
+tree_fast_to_image_SOURCES = tree_to_image.cc
+tree_to_image_SOURCES = tree_to_image.cc
TESTS = $(check_PROGRAMS)
Index: trunk/milena/tests/util/eat.cc
===================================================================
--- trunk/milena/tests/util/eat.cc (revision 0)
+++ trunk/milena/tests/util/eat.cc (revision 1530)
@@ -0,0 +1,46 @@
+// Copyright (C) 2007 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.
+
+/*!
+ * \file tests/util/eat.cc
+ *
+ * \brief test of mln::util::eat
+ *
+ */
+
+#include <mln/util/eat.hh>
+
+int main ()
+{
+ using namespace mln;
+
+ int a = 42;
+ util::eat e(a);
+
+// // FIXME
+// mln_assertion(false);
+}
Index: trunk/milena/tests/util/branch_iter_ind.cc
===================================================================
--- trunk/milena/tests/util/branch_iter_ind.cc (revision 0)
+++ trunk/milena/tests/util/branch_iter_ind.cc (revision 1530)
@@ -0,0 +1,83 @@
+// Copyright (C) 2007 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.
+
+/*!
+ * \file tests/util/branch_iter_ind.cc
+ *
+ * \brief test of mln::util::branch_iter_ind
+ *
+ */
+
+#include <mln/core/image2d.hh>
+#include <mln/util/tree.hh>
+#include <mln/util/branch_iter_ind.hh>
+
+int main()
+{
+ using namespace mln;
+
+ util::node<int> n(11);
+ util::tree<int> t(&n);
+ util::node<int>* f = n.add_child(21);
+ util::node<int>* g = f->add_child(31);
+
+ f->add_child(32);
+
g->add_child(41)->add_child(51)->add_child(61)->add_child(71)->add_child(81)->add_child(91);
+ g->add_child(42);
+ f->add_child(33);
+ f->add_child(34);
+ n.add_child(22);
+
+ util::branch<int> b(t, n);
+
+ std::vector< util::node<int>* >::iterator it;
+ util::branch_iter_ind<int> p(b);
+
+ int prev;
+ int current;
+ for(p.start(), prev = util::node<int>(p).elt(), p.next();
+ p.is_valid();
+ prev = util::node<int>(p).elt(), p.next())
+ {
+ current = util::node<int>(p).elt ();
+
+ // children
+ if (prev + 10 == current)
+ continue;
+
+ // brother
+ if (prev + 1 == current)
+ continue;
+
+ // parent
+ if (prev > current)
+ continue;
+
+ mln_assertion (false);
+ }
+
+}