[Lemon-commits] [lemon_svn] hegyi: r1129 - in hugo/trunk/src: hugo hugo/skeletons test

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:43:25 CET 2006


Author: hegyi
Date: Sun Sep 12 23:46:26 2004
New Revision: 1129

Added:
   hugo/trunk/src/test/old_path_test.cc
Modified:
   hugo/trunk/src/hugo/path.h
   hugo/trunk/src/hugo/skeletons/path.h
   hugo/trunk/src/test/path_test.cc

Log:
The first version of new path test program. The old became old_path_test.

Modified: hugo/trunk/src/hugo/path.h
==============================================================================
--- hugo/trunk/src/hugo/path.h	(original)
+++ hugo/trunk/src/hugo/path.h	Sun Sep 12 23:46:26 2004
@@ -29,7 +29,7 @@
 
 #include <hugo/invalid.h>
 #include <hugo/error.h>
-#include <hugo/debug.h>
+//#include <hugo/debug.h>
 
 namespace hugo {
 
@@ -48,7 +48,7 @@
   //! and \c Edge of the original graph.
   //!
   //! \todo Thoroughfully check all the range and consistency tests.
-  template<typename Graph, typename DM = DefaultDebugMode>
+  template<typename Graph>
   class DirPath {
   public:
     /// Edge type of the underlying graph.
@@ -74,7 +74,7 @@
     /// Subpath defined by two nodes.
     /// \warning It is an error if the two edges are not in order!
     DirPath(const DirPath &P, const NodeIt &a, const NodeIt &b) {
-      if( DM::range_check && (!a.valid() || !b.valid) ) {
+      if(!a.valid() || !b.valid) {
 	// FIXME: this check should be more elaborate...
 	fault("DirPath, subpath ctor: invalid bounding nodes");
       }
@@ -87,7 +87,7 @@
     /// Subpath defined by two edges. Contains edges in [a,b)
     /// \warning It is an error if the two edges are not in order!
     DirPath(const DirPath &P, const EdgeIt &a, const EdgeIt &b) {
-      if( DM::range_check && (!a.valid() || !b.valid) ) {
+      if (!a.valid() || !b.valid) {
 	// FIXME: this check should be more elaborate...
 	fault("DirPath, subpath ctor: invalid bounding nodes");
       }
@@ -107,14 +107,14 @@
     ///
     /// Starting point of the path.
     /// Returns INVALID if the path is empty.
-    GraphNode from() const {
+    GraphNode tail() const {
       return empty() ? INVALID : gr->tail(edges[0]);
     }
     /// \brief End point of the path.
     ///
     /// End point of the path.
     /// Returns INVALID if the path is empty.
-    GraphNode to() const {
+    GraphNode head() const {
       return empty() ? INVALID : gr->head(edges[length()-1]);
     }
 
@@ -127,14 +127,14 @@
 
     /// \brief Initializes node iterator to point to the node of a given index.
     NodeIt& nth(NodeIt &i, int n) const {
-      if( DM::range_check && (n<0 || n>int(length())) )
+      if(n<0 || n>int(length())) 
 	fault("DirPath::nth: index out of range");
       return i=NodeIt(*this, n);
     }
 
     /// \brief Initializes edge iterator to point to the edge of a given index.
     EdgeIt& nth(EdgeIt &i, int n) const {
-      if( DM::range_check && (n<0 || n>=int(length())) )
+      if(n<0 || n>=int(length())) 
 	fault("DirPath::nth: index out of range");
       return i=EdgeIt(*this, n);
     }
@@ -148,7 +148,7 @@
     template<typename It>
     static
     It& next(It &e) {
-      if( DM::range_check && !e.valid() )
+      if( !e.valid() )
 	fault("DirPath::next() on invalid iterator");
       return ++e;
     }
@@ -156,7 +156,7 @@
     /// \brief Returns node iterator pointing to the head node of the
     /// given edge iterator.
     NodeIt head(const EdgeIt& e) const {
-      if( DM::range_check && !e.valid() )
+      if( !e.valid() )
 	fault("DirPath::head() on invalid iterator");
       return NodeIt(*this, e.idx+1);
     }
@@ -164,7 +164,7 @@
     /// \brief Returns node iterator pointing to the tail node of the
     /// given edge iterator.
     NodeIt tail(const EdgeIt& e) const {
-      if( DM::range_check && !e.valid() )
+      if( !e.valid() )
 	fault("DirPath::tail() on invalid iterator");
       return NodeIt(*this, e.idx);
     }
@@ -252,7 +252,7 @@
       ///Conversion to Graph::Node
       operator const GraphNode& () const {
 	if(idx >= p->length())
-	  return p->to();
+	  return p->head();
 	else if(idx >= 0)
 	  return p->gr->tail(p->edges[idx]);
 	else
@@ -312,7 +312,7 @@
       ///Push a new edge to the front of the path.
       ///\sa setStartNode
       void pushFront(const GraphEdge& e) {
-	if( DM::consistensy_check && !empty() && P.gr->head(e)!=from() ) {
+	if( !empty() && P.gr->head(e)!=tail() ) {
 	  fault("DirPath::Builder::pushFront: nonincident edge");
 	}
 	front.push_back(e);
@@ -323,7 +323,7 @@
       ///Push a new edge to the back of the path.
       ///\sa setStartNode
       void pushBack(const GraphEdge& e) {
-	if( DM::consistensy_check && !empty() && P.gr->tail(e)!=to() ) {
+	if( !empty() && P.gr->tail(e)!=head() ) {
 	  fault("DirPath::Builder::pushBack: nonincident edge");
 	}
 	back.push_back(e);
@@ -355,12 +355,15 @@
 	back.reserve(r);
       }
 
+      void reserveFront(size_t r) {}
+      void reserveBack(size_t r) {}
+
     private:
       bool empty() {
 	return front.empty() && back.empty() && P.empty();
       }
 
-      GraphNode from() const {
+      GraphNode tail() const {
 	if( ! front.empty() )
 	  return P.gr->tail(front[front.size()-1]);
 	else if( ! P.empty() )
@@ -370,7 +373,7 @@
 	else
 	  return INVALID;
       }
-      GraphNode to() const {
+      GraphNode head() const {
 	if( ! back.empty() )
 	  return P.gr->head(back[back.size()-1]);
 	else if( ! P.empty() )
@@ -411,7 +414,7 @@
   //! and \c Edge of the original graph.
   //!
   //! \todo Thoroughfully check all the range and consistency tests.
-  template<typename Graph, typename DM = DefaultDebugMode>
+  template<typename Graph>
   class UndirPath {
   public:
     /// Edge type of the underlying graph.
@@ -437,7 +440,7 @@
     /// Subpath defined by two nodes.
     /// \warning It is an error if the two edges are not in order!
     UndirPath(const UndirPath &P, const NodeIt &a, const NodeIt &b) {
-      if( DM::range_check && (!a.valid() || !b.valid) ) {
+      if(!a.valid() || !b.valid) {
 	// FIXME: this check should be more elaborate...
 	fault("UndirPath, subpath ctor: invalid bounding nodes");
       }
@@ -450,7 +453,7 @@
     /// Subpath defined by two edges. Contains edges in [a,b)
     /// \warning It is an error if the two edges are not in order!
     UndirPath(const UndirPath &P, const EdgeIt &a, const EdgeIt &b) {
-      if( DM::range_check && (!a.valid() || !b.valid) ) {
+      if(!a.valid() || !b.valid) {
 	// FIXME: this check should be more elaborate...
 	fault("UndirPath, subpath ctor: invalid bounding nodes");
       }
@@ -470,14 +473,14 @@
     ///
     /// Starting point of the path.
     /// Returns INVALID if the path is empty.
-    GraphNode from() const {
+    GraphNode tail() const {
       return empty() ? INVALID : gr->tail(edges[0]);
     }
     /// \brief End point of the path.
     ///
     /// End point of the path.
     /// Returns INVALID if the path is empty.
-    GraphNode to() const {
+    GraphNode head() const {
       return empty() ? INVALID : gr->head(edges[length()-1]);
     }
 
@@ -490,14 +493,14 @@
 
     /// \brief Initializes node iterator to point to the node of a given index.
     NodeIt& nth(NodeIt &i, int n) const {
-      if( DM::range_check && (n<0 || n>int(length())) )
+      if(n<0 || n>int(length()))
 	fault("UndirPath::nth: index out of range");
       return i=NodeIt(*this, n);
     }
 
     /// \brief Initializes edge iterator to point to the edge of a given index.
     EdgeIt& nth(EdgeIt &i, int n) const {
-      if( DM::range_check && (n<0 || n>=int(length())) )
+      if(n<0 || n>=int(length()))
 	fault("UndirPath::nth: index out of range");
       return i=EdgeIt(*this, n);
     }
@@ -511,7 +514,7 @@
     template<typename It>
     static
     It& next(It &e) {
-      if( DM::range_check && !e.valid() )
+      if( !e.valid() )
 	fault("UndirPath::next() on invalid iterator");
       return ++e;
     }
@@ -519,7 +522,7 @@
     /// \brief Returns node iterator pointing to the head node of the
     /// given edge iterator.
     NodeIt head(const EdgeIt& e) const {
-      if( DM::range_check && !e.valid() )
+      if( !e.valid() )
 	fault("UndirPath::head() on invalid iterator");
       return NodeIt(*this, e.idx+1);
     }
@@ -527,7 +530,7 @@
     /// \brief Returns node iterator pointing to the tail node of the
     /// given edge iterator.
     NodeIt tail(const EdgeIt& e) const {
-      if( DM::range_check && !e.valid() )
+      if( !e.valid() )
 	fault("UndirPath::tail() on invalid iterator");
       return NodeIt(*this, e.idx);
     }
@@ -613,7 +616,7 @@
       ///Conversion to Graph::Node
       operator const GraphNode& () const {
 	if(idx >= p->length())
-	  return p->to();
+	  return p->head();
 	else if(idx >= 0)
 	  return p->gr->tail(p->edges[idx]);
 	else
@@ -673,7 +676,7 @@
       ///Push a new edge to the front of the path.
       ///\sa setStartNode
       void pushFront(const GraphEdge& e) {
-	if( DM::consistensy_check && !empty() && P.gr->head(e)!=from() ) {
+	if( !empty() && P.gr->head(e)!=tail() ) {
 	  fault("UndirPath::Builder::pushFront: nonincident edge");
 	}
 	front.push_back(e);
@@ -684,7 +687,7 @@
       ///Push a new edge to the back of the path.
       ///\sa setStartNode
       void pushBack(const GraphEdge& e) {
-	if( DM::consistensy_check && !empty() && P.gr->tail(e)!=to() ) {
+	if( !empty() && P.gr->tail(e)!=head() ) {
 	  fault("UndirPath::Builder::pushBack: nonincident edge");
 	}
 	back.push_back(e);
@@ -716,12 +719,15 @@
 	back.reserve(r);
       }
 
+      void reserveFront(size_t r) {}
+      void reserveBack(size_t r) {}
+
     private:
       bool empty() {
 	return front.empty() && back.empty() && P.empty();
       }
 
-      GraphNode from() const {
+      GraphNode tail() const {
 	if( ! front.empty() )
 	  return P.gr->tail(front[front.size()-1]);
 	else if( ! P.empty() )
@@ -731,7 +737,7 @@
 	else
 	  return INVALID;
       }
-      GraphNode to() const {
+      GraphNode head() const {
 	if( ! back.empty() )
 	  return P.gr->head(back[back.size()-1]);
 	else if( ! P.empty() )
@@ -791,8 +797,8 @@
     DynamicPath(const DynamicPath &P, const EdgeIt &a, const EdgeIt &b);
     
     size_t length() const { return edges.size(); }
-    GraphNode from() const { return _first; }
-    GraphNode to() const { return _last; }
+    GraphNode tail() const { return _first; }
+    GraphNode head() const { return _last; }
 
     NodeIt& first(NodeIt &n) const { return nth(n, 0); }
     EdgeIt& first(EdgeIt &e) const { return nth(e, 0); }

Modified: hugo/trunk/src/hugo/skeletons/path.h
==============================================================================
--- hugo/trunk/src/hugo/skeletons/path.h	(original)
+++ hugo/trunk/src/hugo/skeletons/path.h	Sun Sep 12 23:46:26 2004
@@ -1,12 +1,11 @@
-#define SKELETON
 // -*- c++ -*- //
 
 ///\ingroup skeletons
 ///\file
 ///\brief Classes for representing paths in graphs.
 
-#ifndef HUGO_PATH_H
-#define HUGO_PATH_H
+#ifndef HUGO_SKELETON_PATH_H
+#define HUGO_SKELETON_PATH_H
 
 #include <hugo/invalid.h>
 
@@ -14,38 +13,38 @@
   namespace skeleton {
     /// \addtogroup skeletons
     /// @{
-    
-    
+
+
     //! \brief A skeletom structure for representing directed paths in a graph.
     //!
     //! A skeleton structure for representing directed paths in a graph.
     //! \param GR The graph type in which the path is.
-    //! 
+    //!
     //! In a sense, the path can be treated as a graph, for is has \c NodeIt
     //! and \c EdgeIt with the same usage. These types converts to the \c Node
     //! and \c Edge of the original graph.
     template<typename GR>
     class Path {
     public:
-      
+
       /// Type of the underlying graph.
       typedef /*typename*/ GR Graph;
       /// Edge type of the underlying graph.
-      typedef typename Graph::Edge GraphEdge; 
+      typedef typename Graph::Edge GraphEdge;
       /// Node type of the underlying graph.
      typedef typename Graph::Node GraphNode;
       class NodeIt;
       class EdgeIt;
-      
+
       /// \param _G The graph in which the path is.
       ///
       Path(const Graph &_G) {}
-      
+
       /// Length of the path.
       size_t length() const {return 0;}
       /// Returns whether the path is empty.
-      bool empty() const {}
-      
+      bool empty() const { return true;}
+
       /// Resets the path to an empty path.
       void clear() {}
 
@@ -71,25 +70,25 @@
       ///
       /// Returns node iterator pointing to the head node of the
       /// given edge iterator.
-      NodeIt head(const EdgeIt& e) const {}
+      NodeIt head(const EdgeIt& e) const {return INVALID;}
 
       /// \brief The tail of an edge.
       ///
       /// Returns node iterator pointing to the tail node of the
       /// given edge iterator.
-      NodeIt tail(const EdgeIt& e) const {}
+      NodeIt tail(const EdgeIt& e) const {return INVALID;}
 
 
       /* Iterator classes */
 
       /**
        * \brief Iterator class to iterate on the edges of the paths
-       * 
+       *
        * \ingroup skeletons
        * This class is used to iterate on the edges of the paths
        *
        * Of course it converts to Graph::Edge
-       * 
+       *
        */
       class EdgeIt {
       public:
@@ -103,7 +102,7 @@
 	operator GraphEdge () const {}
 
 	/// Next edge
-	EdgeIt& operator++() {}
+	EdgeIt& operator++() {return *this;}
 
 	/// Comparison operator
 	bool operator==(const EdgeIt& e) const {return true;}
@@ -117,12 +116,12 @@
 
       /**
        * \brief Iterator class to iterate on the nodes of the paths
-       * 
+       *
        * \ingroup skeletons
        * This class is used to iterate on the nodes of the paths
        *
        * Of course it converts to Graph::Node.
-       * 
+       *
        */
       class NodeIt {
       public:
@@ -136,23 +135,23 @@
 	///Conversion to Graph::Node
 	operator const GraphNode& () const {}
 	/// Next node
-	NodeIt& operator++() {}
+	NodeIt& operator++() {return *this;}
 
 	/// Comparison operator
-	bool operator==(const NodeIt& e) const {}
+	bool operator==(const NodeIt& e) const {return true;}
 	/// Comparison operator
-	bool operator!=(const NodeIt& e) const {}
+	bool operator!=(const NodeIt& e) const {return true;}
 // 	/// Comparison operator
 //      /// \todo It is not clear what is the "natural" ordering.
 // 	bool operator<(const NodeIt& e) const {}
 
       };
 
-      friend class Builder;    
+      friend class Builder;
 
       /**
        * \brief Class to build paths
-       * 
+       *
        * \ingroup skeletons
        * This class is used to fill a path with edges.
        *
@@ -174,7 +173,7 @@
 	Builder(Path &_P) : P(_P) {}
 
 	/// Sets the starting node of the path.
-      
+
 	/// Sets the starting node of the path. Edge added to the path
 	/// afterwards have to be incident to this node.
 	/// You \em must start building an empry path with this functions.
@@ -217,7 +216,7 @@
 
   ///@}
   }
-  
+
 } // namespace hugo
 
-#endif // HUGO_PATH_H
+#endif // HUGO_SKELETON_PATH_H

Added: hugo/trunk/src/test/old_path_test.cc
==============================================================================
--- (empty file)
+++ hugo/trunk/src/test/old_path_test.cc	Sun Sep 12 23:46:26 2004
@@ -0,0 +1,175 @@
+#include <string>
+#include <iostream>
+//#include <hugo/skeletons/path.h>
+#include <hugo/path.h>
+#include <hugo/list_graph.h>
+
+using namespace std;
+using namespace hugo;
+#ifdef HUGO_SKELETON_PATH_H
+using namespace skeleton;
+#endif
+
+bool passed = true;
+
+void check(bool rc) {
+  passed = passed && rc;
+  if(!rc) {
+    cout << "Test failed!" << endl;
+  }
+}
+
+#ifdef DEBUG
+const bool debug = true;
+#else
+const bool debug = false;
+#endif
+
+
+int main() {
+
+  try {
+
+    typedef ListGraph::Node Node;
+    typedef ListGraph::Edge Edge;
+
+    ListGraph G;
+
+    Node s=G.addNode();
+    Node v1=G.addNode();
+    Node v2=G.addNode();
+    Node v3=G.addNode();
+    Node v4=G.addNode();
+    Node t=G.addNode();
+  
+    Edge e1 = G.addEdge(s, v1);
+    Edge e2 = G.addEdge(s, v2);
+    Edge e3 = G.addEdge(v1, v2);
+    Edge e4 = G.addEdge(v2, v1);
+    Edge e5 = G.addEdge(v1, v3);
+    Edge e6 = G.addEdge(v3, v2);
+    Edge e7 = G.addEdge(v2, v4);
+    Edge e8 = G.addEdge(v4, v3);
+    Edge e9 = G.addEdge(v3, t);
+    Edge e10 = G.addEdge(v4, t);
+
+#ifdef DEBUG
+    bool rc;
+#endif
+
+    {
+      cout << "\n\n\nDirPath tesztelese...\n";
+
+
+      cout << "Ures path letrehozasa" << endl;
+
+#ifndef HUGO_SKELETON_PATH_H
+      typedef DirPath<ListGraph> DPath;
+#else
+      typedef Path<ListGraph> DPath;
+#endif
+
+      DPath P(G);
+
+      cout << "P.length() == " << P.length() << endl;
+      check(P.length() == 0);
+
+      cout << "P.tail() valid? " << (P.tail()!=INVALID) << endl;
+      check(! (P.tail()!=INVALID));
+      {
+	cout << "Builder objektum letrehozasa" << endl;
+	DPath::Builder B(P);
+
+	cout << "Hozzaadunk az elejehez ket elet..." << endl;
+	B.pushFront(e6);
+	B.pushFront(e5);
+	cout << "P.length() == " << P.length() << endl;
+	check(P.length() == 0);
+      
+	cout << "Commitolunk..." << endl;
+	B.commit();
+
+	cout << "P.length() == " << P.length() << endl;
+	check(P.length() == 2);
+
+	cout << "P.tail() valid? " << (P.tail()!=INVALID) << endl;
+	check(P.tail()!=INVALID);
+	cout << "P.tail()==v1 ? " << (P.tail()==v1) << endl;
+	check(P.tail() == v1);
+
+	// Na ja, ez igy nem igazi, mindket esetet le kene tesztelni,
+	// de legalabb valami:
+#ifdef DEBUG
+	cout << "Hozzaadunk az elejehez egy nem illeszkedo elet..." << endl;
+	rc = false;
+	try {
+	  B.pushFront(e3);
+	}
+	catch(const Exception &e) {
+	  cout << "E: " << e.what() << endl;
+	  rc = true;
+	}
+	check(rc);
+#endif
+
+	cout << "Hozzaadunk a vegehez ket elet..." << endl;
+	B.pushBack(e7);
+	B.pushBack(e8);
+	cout << "P.length() == " << P.length() << endl;
+	check(P.length() == 2);
+      
+	cout << "Es commitolunk...\n";
+	B.commit();
+      }
+      cout << "P.length() == " << P.length() << endl;
+      check(P.length() == 4);
+
+      cout << "P.head()==v3 ? " << (P.head()==v3) << endl;
+      check(P.head() == v3);
+
+#ifndef HUGO_SKELETON_PATH_H
+      cout << "Vegigiteralunk az eleken." << endl;
+      typedef DPath::NodeIt NodeIt;
+      typedef DPath::EdgeIt EdgeIt;
+      EdgeIt e;
+      int i=1;
+      for(P.first(e); e!=INVALID; ++e, ++i) {
+	cout << i << ". el: " <</* e << */endl;
+      }
+#endif
+
+      // Na ja, ez igy nem igazi, mindket esetet le kene tesztelni,
+      // de legalabb valami:
+
+#ifdef DEBUG
+      rc = false;
+      try {
+	cout << "Setting an edgeiter to a nonexistant edge." << endl;
+	//P.nth(e,134);
+	rc = !debug;
+      }
+      catch(const Exception &e) {
+	cout << "E: " << e.what() << endl;
+	rc = debug;
+      }
+      check(rc);
+#endif
+    }
+
+  }
+  catch(const std::exception &e) {
+    cout << "Uncaught exception: " << e.what() << endl;
+    return 1;
+  }
+  catch(...) {
+    cout << "Something horrible happened: an exception which isn't "
+	 << "std::exception" << endl;
+    return 2;
+  }
+
+
+  cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
+       << endl;
+
+  return passed ? 0 : 1;
+}

Modified: hugo/trunk/src/test/path_test.cc
==============================================================================
--- hugo/trunk/src/test/path_test.cc	(original)
+++ hugo/trunk/src/test/path_test.cc	Sun Sep 12 23:46:26 2004
@@ -1,190 +1,84 @@
 #include <string>
 #include <iostream>
-//#include <hugo/path.h>
 #include <hugo/skeletons/path.h>
+#include <hugo/path.h>
 #include <hugo/list_graph.h>
 
 using namespace std;
 using namespace hugo;
-#ifdef SKELETON
 using namespace skeleton;
-#endif
 
-bool passed = true;
+template<class Path> void checkCompilePath(Path &P) 
+{
+  typedef typename Path::EdgeIt EdgeIt;
+  typedef typename Path::NodeIt NodeIt;
+  typedef typename Path::GraphNode GraphNode;
+  typedef typename Path::GraphEdge GraphEdge;
+  //typedef typename Path::Builder Builder;
+  //??? ha csinalok ilyet es siman Builderrel peldanyositok, akkor warningol. Talan friend miatt? De ki az?
 
-void check(bool rc) {
-  passed = passed && rc;
-  if(!rc) {
-    cout << "Test failed!" << endl;
-  }
-}
+  EdgeIt ei;
+  NodeIt ni;
+  GraphNode gn;
+  GraphEdge ge;
+
+  size_t st;
+  bool b;
+
+  //Path(const Graph &_G) {}      //the constructor has been already called
+
+  st=P.length();                  //size_t length() const {return 0;}
+  b=P.empty();                    //bool empty() const {}
+  P.clear();                      //void clear() {}
+
+  gn=P.head();                    //GraphNode/*It*/ head() const {return INVALID;}
+  gn=P.tail();                    //GraphNode/*It*/ tail() const {return INVALID;}
+
+  ei=P.first(ei);                 //It& first(It &i) const { return i=It(*this); }
+
+  ni=P.head(ei);                  //NodeIt head(const EdgeIt& e) const {}
+  ni=P.tail(ei);                  //NodeIt tail(const EdgeIt& e) const {}
+
+
+  ListGraph lg;
+  Path p(lg);
 
-#ifdef DEBUG
-const bool debug = true;
-#else
-const bool debug = false;
-#endif
-
-
-int main() {
-
-  try {
-
-    typedef ListGraph::Node Node;
-    typedef ListGraph::Edge Edge;
-
-    ListGraph G;
-
-    Node s=G.addNode();
-    Node v1=G.addNode();
-    Node v2=G.addNode();
-    Node v3=G.addNode();
-    Node v4=G.addNode();
-    Node t=G.addNode();
-  
-    Edge e1 = G.addEdge(s, v1);
-    Edge e2 = G.addEdge(s, v2);
-    Edge e3 = G.addEdge(v1, v2);
-    Edge e4 = G.addEdge(v2, v1);
-    Edge e5 = G.addEdge(v1, v3);
-    Edge e6 = G.addEdge(v3, v2);
-    Edge e7 = G.addEdge(v2, v4);
-    Edge e8 = G.addEdge(v4, v3);
-    Edge e9 = G.addEdge(v3, t);
-    Edge e10 = G.addEdge(v4, t);
-
-#ifdef DEBUG
-    bool rc;
-#endif
-
-    {
-      cout << "\n\n\nDirPath tesztelese...\n";
-
-
-      cout << "Ures path letrehozasa" << endl;
-#ifdef SKELETON
-      typedef Path <ListGraph> DPath;
-#else
-      typedef DirPath<ListGraph> DPath;
-#endif
-      DPath P(G);
-
-      cout << "P.length() == " << P.length() << endl;
-      check(P.length() == 0);
-
-#ifdef SKELETON
-      cout << "P.tail() valid? " << (P.tail()!=INVALID) << endl;
-      check(! (P.tail()!=INVALID));
-#else
-      cout << "P.tail() valid? " << (P.from()!=INVALID) << endl;
-      check(! (P.to()!=INVALID));
-#endif
-      {
-	cout << "Builder objektum letrehozasa" << endl;
-	DPath::Builder B(P);
-
-	cout << "Hozzaadunk az elejehez ket elet..." << endl;
-	B.pushFront(e6);
-	B.pushFront(e5);
-	cout << "P.length() == " << P.length() << endl;
-	check(P.length() == 0);
-      
-	cout << "Commitolunk..." << endl;
-	B.commit();
-
-	cout << "P.length() == " << P.length() << endl;
-	check(P.length() == 2);
-
-#ifdef SKELETON
-	cout << "P.tail() valid? " << (P.tail()!=INVALID) << endl;
-	check(P.tail()!=INVALID);
-	cout << "P.tail()==v1 ? " << (P.tail()==v1) << endl;
-	check(P.tail() == v1);
-#else
-	cout << "P.tail() valid? " << (P.from()!=INVALID) << endl;
-	check(P.from()!=INVALID);
-	cout << "P.tail()==v1 ? " << (P.from()==v1) << endl;
-	check(P.from() == v1);
-#endif
-
-	// Na ja, ez igy nem igazi, mindket esetet le kene tesztelni,
-	// de legalabb valami:
-#ifdef DEBUG
-	cout << "Hozzaadunk az elejehez egy nem illeszkedo elet..." << endl;
-	rc = false;
-	try {
-	  B.pushFront(e3);
-	}
-	catch(const Exception &e) {
-	  cout << "E: " << e.what() << endl;
-	  rc = true;
-	}
-	check(rc);
-#endif
-
-	cout << "Hozzaadunk a vegehez ket elet..." << endl;
-	B.pushBack(e7);
-	B.pushBack(e8);
-	cout << "P.length() == " << P.length() << endl;
-	check(P.length() == 2);
-      
-	cout << "Es commitolunk...\n";
-	B.commit();
-      }
-      cout << "P.length() == " << P.length() << endl;
-      check(P.length() == 4);
-
-#ifdef SKELETON
-      cout << "P.head()==v3 ? " << (P.head()==v3) << endl;
-      check(P.head() == v3);
-#else
-      cout << "P.head()==v3 ? " << (P.to()==v3) << endl;
-      check(P.to() == v3);
-#endif
-
-#ifndef SKELETON
-      cout << "Vegigiteralunk az eleken." << endl;
-      typedef DPath::NodeIt NodeIt;
-      typedef DPath::EdgeIt EdgeIt;
-      EdgeIt e;
-      int i=1;
-      for(P.first(e); e!=INVALID; ++e, ++i) {
-	cout << i << ". el: " <</* e << */endl;
-      }
-#endif
-
-      // Na ja, ez igy nem igazi, mindket esetet le kene tesztelni,
-      // de legalabb valami:
-
-#ifdef DEBUG
-      rc = false;
-      try {
-	cout << "Setting an edgeiter to a nonexistant edge." << endl;
-	//P.nth(e,134);
-	rc = !debug;
-      }
-      catch(const Exception &e) {
-	cout << "E: " << e.what() << endl;
-	rc = debug;
-      }
-      check(rc);
-#endif
-    }
-
-  }
-  catch(const std::exception &e) {
-    cout << "Uncaught exception: " << e.what() << endl;
-    return 1;
-  }
-  catch(...) {
-    cout << "Something horrible happened: an exception which isn't "
-	 << "std::exception" << endl;
-    return 2;
-  }
+  EdgeIt i;	                  //EdgeIt() {}
+  EdgeIt j(INVALID);	          //EdgeIt(Invalid) {}
+  EdgeIt k(p);	                  //EdgeIt(const Path &_p) {}
 
+  //??? operator GraphEdge () const {}
+
+  //INVALIDra megy a ++????
+  i=++j;	                  //EdgeIt& operator++() {}
+  b=(i==j);	                  //bool operator==(const EdgeIt& e) const {return true;}
+  b=(i!=j);	                  //bool operator!=(const EdgeIt& e) const {return true;}
+
+
+  NodeIt l;                       //NodeIt() {}
+  NodeIt m(INVALID);	          //NodeIt(Invalid) {}
+  NodeIt n(p);	                  //NodeIt(const Path &_p) {}
+
+  //operator const GraphNode& () const {}
+
+  l=++m;                          //NodeIt& operator++() {}
+  b=(m==n);                       //bool operator==(const NodeIt& e) const {}
+  b=(m!=n);                   	  //bool operator!=(const NodeIt& e) const {}
+
+  typename Path::Builder builder(p);     //Builder(Path &_P) : P(_P) {}
+  builder.setStartNode(gn);     	 //void setStartNode(const GraphNode &) {}
+  builder.pushFront(ge);	         //void pushFront(const GraphEdge& e) {}
+  builder.pushBack(ge);	                 //void pushBack(const GraphEdge& e) {}
+  builder.commit();	                 //void commit() {}
+  builder.reserveFront(st);	         //void reserveFront(size_t r) {}
+  builder.reserveBack(st);	         //void reserveBack(size_t r) {}
+
+}
 
-  cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
-       << endl;
+template void checkCompilePath< skeleton::Path<ListGraph> >(skeleton::Path<ListGraph> &);
+template void checkCompilePath< DirPath<ListGraph> >(DirPath<ListGraph> &);
+template void checkCompilePath< UndirPath<ListGraph> >(UndirPath<ListGraph> &);
 
-  return passed ? 0 : 1;
+int main() 
+{
 }



More information about the Lemon-commits mailing list