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