test/arc_look_up_test.cc
changeset 1118 e00d7b681d8e
parent 993 157427808b40
child 1124 f747a0ddbbf6
equal deleted inserted replaced
0:c9430fa587f2 1:c032ee2d6629
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library.
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2009
     5  * Copyright (C) 2003-2013
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
     9  * Permission to use, modify and distribute this software is granted
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    10  * provided that this copyright notice appears in all copies. For
    66 
    66 
    67 int main() {
    67 int main() {
    68   ListDigraph graph;
    68   ListDigraph graph;
    69   std::istringstream lgfs(lgf);
    69   std::istringstream lgfs(lgf);
    70   DigraphReader<ListDigraph>(graph, lgfs).run();
    70   DigraphReader<ListDigraph>(graph, lgfs).run();
    71   
    71 
    72   AllArcLookUp<ListDigraph> lookup(graph);
    72   AllArcLookUp<ListDigraph> lookup(graph);
    73 	
    73 
    74   int numArcs = countArcs(graph);
    74   int numArcs = countArcs(graph);
    75 	
    75 
    76   int arcCnt = 0;
    76   int arcCnt = 0;
    77   for(ListDigraph::NodeIt n1(graph); n1 != INVALID; ++n1)
    77   for(ListDigraph::NodeIt n1(graph); n1 != INVALID; ++n1)
    78     for(ListDigraph::NodeIt n2(graph); n2 != INVALID; ++n2)
    78     for(ListDigraph::NodeIt n2(graph); n2 != INVALID; ++n2)
    79       for(ListDigraph::Arc a = lookup(n1, n2); a != INVALID;
    79       for(ListDigraph::Arc a = lookup(n1, n2); a != INVALID;
    80 	  a = lookup(n1, n2, a))
    80           a = lookup(n1, n2, a))
    81 	++arcCnt;
    81         ++arcCnt;
    82   check(arcCnt==numArcs, "Wrong total number of arcs");
    82   check(arcCnt==numArcs, "Wrong total number of arcs");
    83 
    83 
    84   return 0;
    84   return 0;
    85 }
    85 }