test/sym_graph_test.cc
author ladanyi
Tue, 14 Jun 2005 10:26:37 +0000
changeset 1483 e427615afb48
parent 1359 1581f961cfaa
permissions -rw-r--r--
added support for generating rpms (completely untested though)
deba@937
     1
/* -*- C++ -*-
ladanyi@1435
     2
 * test/sym_graph_test.cc - Part of LEMON, a generic C++ optimization library
deba@937
     3
 *
alpar@1164
     4
 * Copyright (C) 2005 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@1359
     5
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
deba@937
     6
 *
deba@937
     7
 * Permission to use, modify and distribute this software is granted
deba@937
     8
 * provided that this copyright notice appears in all copies. For
deba@937
     9
 * precise terms see the accompanying LICENSE file.
deba@937
    10
 *
deba@937
    11
 * This software is provided "AS IS" with no warranty of any kind,
deba@937
    12
 * express or implied, and with no claim as to its suitability for any
deba@937
    13
 * purpose.
deba@937
    14
 *
deba@937
    15
 */
deba@937
    16
deba@937
    17
#include<iostream>
deba@937
    18
klao@959
    19
#include<lemon/concept/sym_graph.h>
deba@937
    20
deba@937
    21
#include<lemon/list_graph.h>
deba@937
    22
#include<lemon/smart_graph.h>
deba@937
    23
#include<lemon/full_graph.h>
deba@937
    24
deba@937
    25
#include"test_tools.h"
deba@937
    26
#include"graph_test.h"
deba@937
    27
#include"sym_graph_test.h"
deba@937
    28
deba@937
    29
/**
deba@937
    30
\file
deba@937
    31
This test makes consistency checks of list graph structures.
deba@937
    32
alpar@986
    33
G.addNode(), G.addEdge(), G.source(), G.target()
deba@937
    34
deba@937
    35
\todo Checks for empty graphs and isolated points.
deba@937
    36
conversion.
deba@937
    37
*/
deba@937
    38
deba@937
    39
using namespace lemon;
deba@937
    40
deba@937
    41
template<class Graph> void checkPetersen(Graph &G)
deba@937
    42
{
deba@937
    43
  typedef typename Graph::NodeIt NodeIt;
deba@937
    44
deba@937
    45
deba@937
    46
  checkGraphNodeList(G,10);
deba@937
    47
  checkGraphEdgeList(G,30);
deba@937
    48
  checkGraphSymEdgeList(G,15);
deba@937
    49
deba@937
    50
  for(NodeIt n(G);n!=INVALID;++n) {
deba@937
    51
    checkGraphInEdgeList(G,n,3);
deba@937
    52
    checkGraphOutEdgeList(G,n,3);
deba@937
    53
  }  
deba@937
    54
}
deba@937
    55
deba@937
    56
//Compile Graph
klao@959
    57
template void lemon::checkCompileStaticSymGraph<concept::StaticSymGraph>
klao@959
    58
(concept::StaticSymGraph &);
deba@937
    59
klao@959
    60
template void lemon::checkCompileSymGraph<concept::ExtendableSymGraph>
klao@959
    61
(concept::ExtendableSymGraph &);
deba@937
    62
klao@959
    63
template void lemon::checkCompileErasableSymGraph<concept::ErasableSymGraph>
klao@959
    64
(concept::ErasableSymGraph &);
deba@937
    65
deba@937
    66
deba@937
    67
//Compile SymSmartGraph
deba@937
    68
template void lemon::checkCompileSymGraph<SymSmartGraph>(SymSmartGraph &);
alpar@938
    69
template
klao@959
    70
void lemon::concept::checkCompileGraphFindEdge<SymSmartGraph>(SymSmartGraph &);
deba@937
    71
deba@937
    72
//Compile SymListGraph
deba@937
    73
template void lemon::checkCompileSymGraph<SymListGraph>(SymListGraph &);
deba@937
    74
template void lemon::checkCompileErasableSymGraph<SymListGraph>(SymListGraph &);
alpar@938
    75
template
klao@959
    76
void lemon::concept::checkCompileGraphFindEdge<SymListGraph>(SymListGraph &);
deba@937
    77
deba@937
    78
int main() 
deba@937
    79
{
deba@937
    80
  {
deba@937
    81
    SymSmartGraph G;
deba@937
    82
    addSymPetersen(G);
deba@937
    83
    checkPetersen(G);
deba@937
    84
  }
deba@937
    85
  {
deba@937
    86
    SymListGraph G;
deba@937
    87
    addSymPetersen(G);
deba@937
    88
    checkPetersen(G);
deba@937
    89
  }
deba@937
    90
deba@937
    91
  ///\file
deba@937
    92
  ///\todo map tests.
deba@937
    93
  ///\todo copy constr tests.
deba@937
    94
deba@937
    95
  std::cout << __FILE__ ": All tests passed.\n";
deba@937
    96
deba@937
    97
  return 0;
deba@937
    98
}