author | deba |
Fri, 04 Mar 2005 17:20:11 +0000 | |
changeset 1194 | 7bce0ef61d6b |
parent 990 | 407e4d47fdd3 |
child 1359 | 1581f961cfaa |
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@1164 | 4 |
* Copyright (C) 2005 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 |
|
alpar@986 | 50 |
gn=P.target(); //GraphNode/*It*/ target() const {return INVALID;} |
alpar@986 | 51 |
gn=P.source(); //GraphNode/*It*/ source() 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 |
|
alpar@986 | 55 |
ni=P.target(ei); //NodeIt target(const EdgeIt& e) const {} |
alpar@986 | 56 |
ni=P.source(ei); //NodeIt source(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++() {} |
alpar@990 | 67 |
++k; |
hegyi@831 | 68 |
b=(i==j); //bool operator==(const EdgeIt& e) const {return true;} |
hegyi@831 | 69 |
b=(i!=j); //bool operator!=(const EdgeIt& e) const {return true;} |
hegyi@831 | 70 |
|
hegyi@831 | 71 |
|
hegyi@831 | 72 |
NodeIt l; //NodeIt() {} |
hegyi@831 | 73 |
NodeIt m(INVALID); //NodeIt(Invalid) {} |
hegyi@831 | 74 |
NodeIt n(p); //NodeIt(const Path &_p) {} |
hegyi@831 | 75 |
|
hegyi@831 | 76 |
l=++m; //NodeIt& operator++() {} |
hegyi@831 | 77 |
b=(m==n); //bool operator==(const NodeIt& e) const {} |
hegyi@831 | 78 |
b=(m!=n); //bool operator!=(const NodeIt& e) const {} |
hegyi@831 | 79 |
|
hegyi@831 | 80 |
typename Path::Builder builder(p); //Builder(Path &_P) : P(_P) {} |
hegyi@831 | 81 |
builder.setStartNode(gn); //void setStartNode(const GraphNode &) {} |
hegyi@831 | 82 |
builder.pushFront(ge); //void pushFront(const GraphEdge& e) {} |
hegyi@831 | 83 |
builder.pushBack(ge); //void pushBack(const GraphEdge& e) {} |
hegyi@831 | 84 |
builder.commit(); //void commit() {} |
hegyi@831 | 85 |
builder.reserveFront(st); //void reserveFront(size_t r) {} |
hegyi@831 | 86 |
builder.reserveBack(st); //void reserveBack(size_t r) {} |
hegyi@831 | 87 |
|
hegyi@820 | 88 |
} |
hegyi@820 | 89 |
|
klao@959 | 90 |
template void checkCompilePath< concept::Path<ListGraph> >(concept::Path<ListGraph> &); |
hegyi@831 | 91 |
template void checkCompilePath< DirPath<ListGraph> >(DirPath<ListGraph> &); |
hegyi@831 | 92 |
template void checkCompilePath< UndirPath<ListGraph> >(UndirPath<ListGraph> &); |
hegyi@820 | 93 |
|
hegyi@831 | 94 |
int main() |
hegyi@831 | 95 |
{ |
hegyi@820 | 96 |
} |