| [906] | 1 | /* -*- C++ -*- | 
|---|
| [1435] | 2 | * test/path_test.cc - Part of LEMON, a generic C++ optimization library | 
|---|
| [906] | 3 | * | 
|---|
| [1164] | 4 | * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport | 
|---|
| [1359] | 5 | * (Egervary Research Group on Combinatorial Optimization, EGRES). | 
|---|
| [906] | 6 | * | 
|---|
|  | 7 | * Permission to use, modify and distribute this software is granted | 
|---|
|  | 8 | * provided that this copyright notice appears in all copies. For | 
|---|
|  | 9 | * precise terms see the accompanying LICENSE file. | 
|---|
|  | 10 | * | 
|---|
|  | 11 | * This software is provided "AS IS" with no warranty of any kind, | 
|---|
|  | 12 | * express or implied, and with no claim as to its suitability for any | 
|---|
|  | 13 | * purpose. | 
|---|
|  | 14 | * | 
|---|
|  | 15 | */ | 
|---|
|  | 16 |  | 
|---|
| [820] | 17 | #include <string> | 
|---|
|  | 18 | #include <iostream> | 
|---|
| [959] | 19 | #include <lemon/concept/path.h> | 
|---|
| [921] | 20 | #include <lemon/path.h> | 
|---|
|  | 21 | #include <lemon/list_graph.h> | 
|---|
| [820] | 22 |  | 
|---|
|  | 23 | using namespace std; | 
|---|
| [921] | 24 | using namespace lemon; | 
|---|
| [959] | 25 | using namespace lemon::concept; | 
|---|
| [820] | 26 |  | 
|---|
| [831] | 27 | template<class Path> void checkCompilePath(Path &P) | 
|---|
|  | 28 | { | 
|---|
|  | 29 | typedef typename Path::EdgeIt EdgeIt; | 
|---|
|  | 30 | typedef typename Path::NodeIt NodeIt; | 
|---|
|  | 31 | typedef typename Path::GraphNode GraphNode; | 
|---|
|  | 32 | typedef typename Path::GraphEdge GraphEdge; | 
|---|
|  | 33 | //typedef typename Path::Builder Builder; | 
|---|
|  | 34 | //??? ha csinalok ilyet es siman Builderrel peldanyositok, akkor warningol. Talan friend miatt? De ki az? | 
|---|
| [820] | 35 |  | 
|---|
| [831] | 36 | EdgeIt ei; | 
|---|
|  | 37 | NodeIt ni; | 
|---|
|  | 38 | GraphNode gn; | 
|---|
|  | 39 | GraphEdge ge; | 
|---|
|  | 40 |  | 
|---|
|  | 41 | size_t st; | 
|---|
|  | 42 | bool b; | 
|---|
|  | 43 |  | 
|---|
|  | 44 | //Path(const Graph &_G) {}      //the constructor has been already called | 
|---|
|  | 45 |  | 
|---|
|  | 46 | st=P.length();                  //size_t length() const {return 0;} | 
|---|
|  | 47 | b=P.empty();                    //bool empty() const {} | 
|---|
|  | 48 | P.clear();                      //void clear() {} | 
|---|
|  | 49 |  | 
|---|
| [986] | 50 | gn=P.target();                    //GraphNode/*It*/ target() const {return INVALID;} | 
|---|
|  | 51 | gn=P.source();                    //GraphNode/*It*/ source() const {return INVALID;} | 
|---|
| [831] | 52 |  | 
|---|
|  | 53 | ei=P.first(ei);                 //It& first(It &i) const { return i=It(*this); } | 
|---|
|  | 54 |  | 
|---|
| [986] | 55 | ni=P.target(ei);                  //NodeIt target(const EdgeIt& e) const {} | 
|---|
|  | 56 | ni=P.source(ei);                  //NodeIt source(const EdgeIt& e) const {} | 
|---|
| [831] | 57 |  | 
|---|
|  | 58 |  | 
|---|
|  | 59 | ListGraph lg; | 
|---|
|  | 60 | Path p(lg); | 
|---|
|  | 61 |  | 
|---|
|  | 62 | EdgeIt i;                       //EdgeIt() {} | 
|---|
|  | 63 | EdgeIt j(INVALID);              //EdgeIt(Invalid) {} | 
|---|
|  | 64 | EdgeIt k(p);                    //EdgeIt(const Path &_p) {} | 
|---|
|  | 65 |  | 
|---|
|  | 66 | i=++j;                          //EdgeIt& operator++() {} | 
|---|
| [990] | 67 | ++k; | 
|---|
| [831] | 68 | b=(i==j);                       //bool operator==(const EdgeIt& e) const {return true;} | 
|---|
|  | 69 | b=(i!=j);                       //bool operator!=(const EdgeIt& e) const {return true;} | 
|---|
|  | 70 |  | 
|---|
|  | 71 |  | 
|---|
|  | 72 | NodeIt l;                       //NodeIt() {} | 
|---|
|  | 73 | NodeIt m(INVALID);              //NodeIt(Invalid) {} | 
|---|
|  | 74 | NodeIt n(p);                    //NodeIt(const Path &_p) {} | 
|---|
|  | 75 |  | 
|---|
|  | 76 | l=++m;                          //NodeIt& operator++() {} | 
|---|
|  | 77 | b=(m==n);                       //bool operator==(const NodeIt& e) const {} | 
|---|
|  | 78 | b=(m!=n);                       //bool operator!=(const NodeIt& e) const {} | 
|---|
|  | 79 |  | 
|---|
|  | 80 | typename Path::Builder builder(p);     //Builder(Path &_P) : P(_P) {} | 
|---|
|  | 81 | builder.setStartNode(gn);              //void setStartNode(const GraphNode &) {} | 
|---|
|  | 82 | builder.pushFront(ge);                 //void pushFront(const GraphEdge& e) {} | 
|---|
|  | 83 | builder.pushBack(ge);                  //void pushBack(const GraphEdge& e) {} | 
|---|
|  | 84 | builder.commit();                      //void commit() {} | 
|---|
|  | 85 | builder.reserveFront(st);              //void reserveFront(size_t r) {} | 
|---|
|  | 86 | builder.reserveBack(st);               //void reserveBack(size_t r) {} | 
|---|
|  | 87 |  | 
|---|
| [820] | 88 | } | 
|---|
|  | 89 |  | 
|---|
| [959] | 90 | template void checkCompilePath< concept::Path<ListGraph> >(concept::Path<ListGraph> &); | 
|---|
| [831] | 91 | template void checkCompilePath< DirPath<ListGraph> >(DirPath<ListGraph> &); | 
|---|
|  | 92 | template void checkCompilePath< UndirPath<ListGraph> >(UndirPath<ListGraph> &); | 
|---|
| [820] | 93 |  | 
|---|
| [831] | 94 | int main() | 
|---|
|  | 95 | { | 
|---|
| [820] | 96 | } | 
|---|