src/test/path_test.cc
author alpar
Mon, 13 Sep 2004 11:24:35 +0000
changeset 835 eb9587f09b42
parent 831 b6ae3446098a
child 906 17f31d280385
permissions -rw-r--r--
Remove one remaining range checking.
     1 #include <string>
     2 #include <iostream>
     3 #include <hugo/skeletons/path.h>
     4 #include <hugo/path.h>
     5 #include <hugo/list_graph.h>
     6 
     7 using namespace std;
     8 using namespace hugo;
     9 using namespace skeleton;
    10 
    11 template<class Path> void checkCompilePath(Path &P) 
    12 {
    13   typedef typename Path::EdgeIt EdgeIt;
    14   typedef typename Path::NodeIt NodeIt;
    15   typedef typename Path::GraphNode GraphNode;
    16   typedef typename Path::GraphEdge GraphEdge;
    17   //typedef typename Path::Builder Builder;
    18   //??? ha csinalok ilyet es siman Builderrel peldanyositok, akkor warningol. Talan friend miatt? De ki az?
    19 
    20   EdgeIt ei;
    21   NodeIt ni;
    22   GraphNode gn;
    23   GraphEdge ge;
    24 
    25   size_t st;
    26   bool b;
    27 
    28   //Path(const Graph &_G) {}      //the constructor has been already called
    29 
    30   st=P.length();                  //size_t length() const {return 0;}
    31   b=P.empty();                    //bool empty() const {}
    32   P.clear();                      //void clear() {}
    33 
    34   gn=P.head();                    //GraphNode/*It*/ head() const {return INVALID;}
    35   gn=P.tail();                    //GraphNode/*It*/ tail() const {return INVALID;}
    36 
    37   ei=P.first(ei);                 //It& first(It &i) const { return i=It(*this); }
    38 
    39   ni=P.head(ei);                  //NodeIt head(const EdgeIt& e) const {}
    40   ni=P.tail(ei);                  //NodeIt tail(const EdgeIt& e) const {}
    41 
    42 
    43   ListGraph lg;
    44   Path p(lg);
    45 
    46   EdgeIt i;	                  //EdgeIt() {}
    47   EdgeIt j(INVALID);	          //EdgeIt(Invalid) {}
    48   EdgeIt k(p);	                  //EdgeIt(const Path &_p) {}
    49 
    50   i=++j;	                  //EdgeIt& operator++() {}
    51   b=(i==j);	                  //bool operator==(const EdgeIt& e) const {return true;}
    52   b=(i!=j);	                  //bool operator!=(const EdgeIt& e) const {return true;}
    53 
    54 
    55   NodeIt l;                       //NodeIt() {}
    56   NodeIt m(INVALID);	          //NodeIt(Invalid) {}
    57   NodeIt n(p);	                  //NodeIt(const Path &_p) {}
    58 
    59   l=++m;                          //NodeIt& operator++() {}
    60   b=(m==n);                       //bool operator==(const NodeIt& e) const {}
    61   b=(m!=n);                   	  //bool operator!=(const NodeIt& e) const {}
    62 
    63   typename Path::Builder builder(p);     //Builder(Path &_P) : P(_P) {}
    64   builder.setStartNode(gn);     	 //void setStartNode(const GraphNode &) {}
    65   builder.pushFront(ge);	         //void pushFront(const GraphEdge& e) {}
    66   builder.pushBack(ge);	                 //void pushBack(const GraphEdge& e) {}
    67   builder.commit();	                 //void commit() {}
    68   builder.reserveFront(st);	         //void reserveFront(size_t r) {}
    69   builder.reserveBack(st);	         //void reserveBack(size_t r) {}
    70 
    71 }
    72 
    73 template void checkCompilePath< skeleton::Path<ListGraph> >(skeleton::Path<ListGraph> &);
    74 template void checkCompilePath< DirPath<ListGraph> >(DirPath<ListGraph> &);
    75 template void checkCompilePath< UndirPath<ListGraph> >(UndirPath<ListGraph> &);
    76 
    77 int main() 
    78 {
    79 }