src/test/sym_graph_test.cc
changeset 937 d4e911acef3d
child 938 70e2886211d5
equal deleted inserted replaced
-1:000000000000 1:abd96f45493b
       
     1 /* -*- C++ -*-
       
     2  * src/test/sym_graph_test.cc - Part of LEMON, a generic C++ optimization library
       
     3  *
       
     4  * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
       
     5  * (Egervary Combinatorial Optimization Research Group, EGRES).
       
     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 
       
    17 #include<iostream>
       
    18 
       
    19 #include<lemon/skeletons/sym_graph.h>
       
    20 
       
    21 #include<lemon/list_graph.h>
       
    22 #include<lemon/smart_graph.h>
       
    23 #include<lemon/full_graph.h>
       
    24 
       
    25 #include"test_tools.h"
       
    26 #include"graph_test.h"
       
    27 #include"sym_graph_test.h"
       
    28 
       
    29 /**
       
    30 \file
       
    31 This test makes consistency checks of list graph structures.
       
    32 
       
    33 G.addNode(), G.addEdge(), G.tail(), G.head()
       
    34 
       
    35 \todo Checks for empty graphs and isolated points.
       
    36 conversion.
       
    37 */
       
    38 
       
    39 using namespace lemon;
       
    40 
       
    41 template<class Graph> void checkPetersen(Graph &G)
       
    42 {
       
    43   typedef typename Graph::NodeIt NodeIt;
       
    44 
       
    45 
       
    46   checkGraphNodeList(G,10);
       
    47   checkGraphEdgeList(G,30);
       
    48   checkGraphSymEdgeList(G,15);
       
    49 
       
    50   for(NodeIt n(G);n!=INVALID;++n) {
       
    51     checkGraphInEdgeList(G,n,3);
       
    52     checkGraphOutEdgeList(G,n,3);
       
    53   }  
       
    54 }
       
    55 
       
    56 //Compile Graph
       
    57 template void lemon::checkCompileStaticSymGraph<skeleton::StaticSymGraph>
       
    58 (skeleton::StaticSymGraph &);
       
    59 
       
    60 template void lemon::checkCompileSymGraph<skeleton::ExtendableSymGraph>
       
    61 (skeleton::ExtendableSymGraph &);
       
    62 
       
    63 template void lemon::checkCompileErasableSymGraph<skeleton::ErasableSymGraph>
       
    64 (skeleton::ErasableSymGraph &);
       
    65 
       
    66 
       
    67 //Compile SymSmartGraph
       
    68 template void lemon::checkCompileSymGraph<SymSmartGraph>(SymSmartGraph &);
       
    69 template void lemon::checkCompileGraphFindEdge<SymSmartGraph>(SymSmartGraph &);
       
    70 
       
    71 //Compile SymListGraph
       
    72 template void lemon::checkCompileSymGraph<SymListGraph>(SymListGraph &);
       
    73 template void lemon::checkCompileErasableSymGraph<SymListGraph>(SymListGraph &);
       
    74 template void lemon::checkCompileGraphFindEdge<SymListGraph>(SymListGraph &);
       
    75 
       
    76 int main() 
       
    77 {
       
    78   {
       
    79     SymSmartGraph G;
       
    80     addSymPetersen(G);
       
    81     checkPetersen(G);
       
    82   }
       
    83   {
       
    84     SymListGraph G;
       
    85     addSymPetersen(G);
       
    86     checkPetersen(G);
       
    87   }
       
    88 
       
    89   ///\file
       
    90   ///\todo map tests.
       
    91   ///\todo copy constr tests.
       
    92 
       
    93   std::cout << __FILE__ ": All tests passed.\n";
       
    94 
       
    95   return 0;
       
    96 }