src/test/undir_graph_test.cc
changeset 1435 8e85e6bbefdf
parent 1434 d8475431bbbb
child 1436 e0beb94d08bf
     1.1 --- a/src/test/undir_graph_test.cc	Sat May 21 21:04:57 2005 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,120 +0,0 @@
     1.4 -// -*- C++ -*-
     1.5 -
     1.6 -#include <lemon/bits/undir_graph_extender.h>
     1.7 -#include <lemon/concept/undir_graph.h>
     1.8 -#include <lemon/list_graph.h>
     1.9 -#include <lemon/smart_graph.h>
    1.10 -#include <lemon/full_graph.h>
    1.11 -
    1.12 -#include <lemon/graph_utils.h>
    1.13 -
    1.14 -#include "test_tools.h"
    1.15 -
    1.16 -
    1.17 -using namespace lemon;
    1.18 -using namespace lemon::concept;
    1.19 -
    1.20 -void check_concepts() {
    1.21 -  typedef UndirGraphExtender<ListGraphBase> UndirListGraphBase;
    1.22 -
    1.23 -  typedef IterableUndirGraphExtender<
    1.24 -    AlterableUndirGraphExtender<UndirListGraphBase> > IterableUndirListGraph;
    1.25 -
    1.26 -  typedef MappableUndirGraphExtender<IterableUndirListGraph>
    1.27 -    MappableUndirListGraph;
    1.28 -
    1.29 -  typedef ErasableUndirGraphExtender<
    1.30 -    ClearableUndirGraphExtender<
    1.31 -    ExtendableUndirGraphExtender<MappableUndirListGraph> > > Graph;
    1.32 -
    1.33 -  checkConcept<BaseIterableUndirGraphConcept, Graph>();
    1.34 -  checkConcept<IterableUndirGraphConcept, Graph>();
    1.35 -  checkConcept<MappableUndirGraphConcept, Graph>();
    1.36 -
    1.37 -  checkConcept<UndirGraph, Graph>();
    1.38 -  checkConcept<ErasableUndirGraph, Graph>();
    1.39 -
    1.40 -  checkConcept<UndirGraph, UndirListGraph>();
    1.41 -  checkConcept<ErasableUndirGraph, UndirListGraph>();
    1.42 -
    1.43 -  checkConcept<UndirGraph, UndirSmartGraph>();
    1.44 -  checkConcept<ExtendableUndirGraph, UndirSmartGraph>();
    1.45 -
    1.46 -  checkConcept<UndirGraph, UndirGraph>();
    1.47 -}
    1.48 -
    1.49 -template <typename Graph>
    1.50 -void check_item_counts(Graph &g, int n, int e) {
    1.51 -  check(countNodes(g)==n, "Wrong node number.");
    1.52 -  check(countEdges(g)==2*e, "Wrong edge number.");
    1.53 -}
    1.54 -
    1.55 -template <typename Graph>
    1.56 -void print_items(Graph &g) {
    1.57 -
    1.58 -  typedef typename Graph::NodeIt NodeIt;
    1.59 -  typedef typename Graph::UndirEdgeIt UEdgeIt;
    1.60 -  typedef typename Graph::EdgeIt EdgeIt;
    1.61 -
    1.62 -  std::cout << "Nodes" << std::endl;
    1.63 -  int i=0;
    1.64 -  for(NodeIt it(g); it!=INVALID; ++it, ++i) {
    1.65 -    std::cout << "  " << i << ": " << g.id(it) << std::endl;
    1.66 -  }
    1.67 -
    1.68 -  std::cout << "UndirEdge" << std::endl;
    1.69 -  i=0;
    1.70 -  for(UEdgeIt it(g); it!=INVALID; ++it, ++i) {
    1.71 -    std::cout << "  " << i << ": " << g.id(it) 
    1.72 -	 << " (" << g.id(g.source(it)) << ", " << g.id(g.target(it)) 
    1.73 -	 << ")" << std::endl;
    1.74 -  }
    1.75 -
    1.76 -  std::cout << "Edge" << std::endl;
    1.77 -  i=0;
    1.78 -  for(EdgeIt it(g); it!=INVALID; ++it, ++i) {
    1.79 -    std::cout << "  " << i << ": " << g.id(it)
    1.80 -	 << " (" << g.id(g.source(it)) << ", " << g.id(g.target(it)) 
    1.81 -	 << ")" << std::endl;
    1.82 -  }
    1.83 -
    1.84 -}
    1.85 -
    1.86 -template <typename Graph>
    1.87 -void check_graph() {
    1.88 -
    1.89 -  typedef typename Graph::Node Node;
    1.90 -  typedef typename Graph::UndirEdge UEdge;
    1.91 -  typedef typename Graph::Edge Edge;
    1.92 -  typedef typename Graph::NodeIt NodeIt;
    1.93 -  typedef typename Graph::UndirEdgeIt UEdgeIt;
    1.94 -  typedef typename Graph::EdgeIt EdgeIt;
    1.95 -
    1.96 -  Graph g;
    1.97 -
    1.98 -  check_item_counts(g,0,0);
    1.99 -
   1.100 -  Node
   1.101 -    n1 = g.addNode(),
   1.102 -    n2 = g.addNode(),
   1.103 -    n3 = g.addNode();
   1.104 -
   1.105 -  UEdge
   1.106 -    e1 = g.addEdge(n1, n2),
   1.107 -    e2 = g.addEdge(n2, n3);
   1.108 -
   1.109 -  // print_items(g);
   1.110 -
   1.111 -  check_item_counts(g,3,2);
   1.112 -
   1.113 -
   1.114 -}
   1.115 -
   1.116 -int main() {
   1.117 -  check_concepts();
   1.118 -
   1.119 -  check_graph<UndirListGraph>();
   1.120 -  check_graph<UndirSmartGraph>();
   1.121 -
   1.122 -  return 0;
   1.123 -}