test/graph_adaptor_test.cc
author deba
Wed, 01 Mar 2006 10:25:30 +0000
changeset 1991 d7442141d9ef
parent 1980 a954b780e3ab
child 2111 ea1fa1bc3f6d
permissions -rw-r--r--
The graph adadptors can be alteration observed.
In most cases it uses the adapted graph alteration notifiers.
Only special case is now the UndirGraphAdaptor, where
we have to proxy the signals from the graph.

The SubBidirGraphAdaptor is removed, because it doest not
gives more feature than the EdgeSubGraphAdaptor<UndirGraphAdaptor<Graph>>.

The ResGraphAdaptor is based on this composition.
     1 /* -*- C++ -*-
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library
     4  *
     5  * Copyright (C) 2003-2006
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    11  * precise terms see the accompanying LICENSE file.
    12  *
    13  * This software is provided "AS IS" with no warranty of any kind,
    14  * express or implied, and with no claim as to its suitability for any
    15  * purpose.
    16  *
    17  */
    18 
    19 #include<iostream>
    20 #include<lemon/concept_check.h>
    21 
    22 #include<lemon/smart_graph.h>
    23 #include<lemon/concept/graph.h>
    24 #include<lemon/concept/ugraph.h>
    25 
    26 #include<lemon/list_graph.h>
    27 #include<lemon/full_graph.h>
    28 #include<lemon/graph_adaptor.h>
    29 #include<lemon/ugraph_adaptor.h>
    30 
    31 #include"test/test_tools.h"
    32 #include"test/graph_test.h"
    33 
    34 /**
    35 \file
    36 This test makes consistency checks of graph adaptors.
    37 
    38 \todo More extensive tests are needed 
    39 */
    40 
    41 using namespace lemon;
    42 using namespace lemon::concept;
    43 
    44 
    45 
    46 int main() 
    47 {
    48   {
    49     typedef StaticGraph Graph;
    50     checkConcept<StaticGraph, GraphAdaptor<Graph> >();
    51 
    52     checkConcept<StaticGraph, RevGraphAdaptor<Graph> >();
    53 
    54     checkConcept<StaticGraph, SubGraphAdaptor<Graph, 
    55       Graph::NodeMap<bool> , Graph::EdgeMap<bool> > >();
    56     checkConcept<StaticGraph, NodeSubGraphAdaptor<Graph, 
    57       Graph::NodeMap<bool> > >();
    58     checkConcept<StaticGraph, EdgeSubGraphAdaptor<Graph, 
    59       Graph::EdgeMap<bool> > >();
    60     
    61     checkConcept<StaticGraph, ResGraphAdaptor<Graph, int, 
    62       Graph::EdgeMap<int>, Graph::EdgeMap<int> > >();
    63 
    64     checkConcept<StaticGraph, ErasingFirstGraphAdaptor<Graph, 
    65       Graph::NodeMap<Graph::Edge> > >(); 
    66 
    67     checkConcept<UGraph, UndirGraphAdaptor<Graph> >();
    68 
    69     checkConcept<UGraph, SubUGraphAdaptor<UGraph, 
    70       UGraph::NodeMap<bool> , UGraph::UEdgeMap<bool> > >();
    71     checkConcept<UGraph, NodeSubUGraphAdaptor<UGraph, 
    72       UGraph::NodeMap<bool> > >();
    73     checkConcept<UGraph, EdgeSubUGraphAdaptor<UGraph, 
    74       UGraph::UEdgeMap<bool> > >();
    75 
    76     checkConcept<StaticGraph, DirUGraphAdaptor<UGraph, 
    77       UGraph::UEdgeMap<bool> > >();
    78   }
    79   std::cout << __FILE__ ": All tests passed.\n";
    80 
    81   return 0;
    82 }