test/graph_test.cc
author deba
Wed, 06 Sep 2006 10:01:15 +0000
changeset 2200 2f2ac1b1ca1e
parent 2111 ea1fa1bc3f6d
child 2231 06faf3f06d67
permissions -rw-r--r--
An easy avoiding of a bug

The functional interfaces are removed.
Better solution could be a reference counted core of the io interfaces

Now it is huge work so just write that:

GraphReader<ListGraph>(std::cin, graph).

Instead of:

graphReader(std::cin, graph).
     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 <vector>
    21 
    22 #include <lemon/concept/graph.h>
    23 #include <lemon/list_graph.h>
    24 #include <lemon/smart_graph.h>
    25 #include <lemon/full_graph.h>
    26 #include <lemon/hypercube_graph.h>
    27 
    28 #include "test_tools.h"
    29 #include "graph_test.h"
    30 #include "map_test.h"
    31 
    32 
    33 using namespace lemon;
    34 using namespace lemon::concept;
    35 
    36 
    37 int main() {
    38   { // checking graph components
    39     checkConcept<BaseGraphComponent, BaseGraphComponent >();
    40 
    41     checkConcept<BaseIterableGraphComponent<>, 
    42       BaseIterableGraphComponent<> >();
    43 
    44     checkConcept<IDableGraphComponent<>, 
    45       IDableGraphComponent<> >();
    46 
    47     checkConcept<IterableGraphComponent<>, 
    48       IterableGraphComponent<> >();
    49 
    50     checkConcept<MappableGraphComponent<>, 
    51       MappableGraphComponent<> >();
    52 
    53   }
    54   { // checking skeleton graphs
    55     checkConcept<Graph, Graph>();
    56   }
    57   { // checking list graph
    58     checkConcept<Graph, ListGraph >();
    59     checkConcept<AlterableGraphComponent<>, ListGraph>();
    60     checkConcept<ExtendableGraphComponent<>, ListGraph>();
    61     checkConcept<ClearableGraphComponent<>, ListGraph>();
    62     checkConcept<ErasableGraphComponent<>, ListGraph>();
    63 
    64     checkGraph<ListGraph>();
    65     checkGraphNodeMap<ListGraph>();
    66     checkGraphEdgeMap<ListGraph>();
    67   }
    68   { // checking smart graph
    69     checkConcept<Graph, SmartGraph >();
    70 
    71     checkGraph<SmartGraph>();
    72     checkGraphNodeMap<SmartGraph>();
    73     checkGraphEdgeMap<SmartGraph>();
    74   }
    75   { // checking full graph
    76     checkConcept<Graph, FullGraph >();
    77   }
    78   { // checking full graph
    79     checkConcept<Graph, HyperCubeGraph >();
    80   }
    81 
    82   std::cout << __FILE__ ": All tests passed.\n";
    83 
    84   return 0;
    85 }