equal
  deleted
  inserted
  replaced
  
    
    
    13 #include "graph_utils_test.h"  | 
    13 #include "graph_utils_test.h"  | 
    14   | 
    14   | 
    15   | 
    15   | 
    16 using namespace lemon;  | 
    16 using namespace lemon;  | 
    17   | 
    17   | 
         | 
    18 template<class Graph>  | 
         | 
    19 void checkSnapDeg()   | 
         | 
    20 { | 
         | 
    21   Graph g;  | 
         | 
    22   typename Graph::Node n1=g.addNode();  | 
         | 
    23   typename Graph::Node n2=g.addNode();  | 
         | 
    24      | 
         | 
    25   InDegMap<Graph> ind(g);  | 
         | 
    26    | 
         | 
    27   g.addEdge(n1,n2);  | 
         | 
    28     | 
         | 
    29   typename Graph::SnapShot snap(g);  | 
         | 
    30     | 
         | 
    31   OutDegMap<Graph> outd(g);  | 
         | 
    32     | 
         | 
    33   check(ind[n1]==0 && ind[n2]==1, "Wrong InDegMap value.");  | 
         | 
    34   check(outd[n1]==1 && outd[n2]==0, "Wrong OutDegMap value.");  | 
         | 
    35   | 
         | 
    36   g.addEdge(n1,n2);  | 
         | 
    37   g.addEdge(n2,n1);  | 
         | 
    38    | 
         | 
    39   check(ind[n1]==1 && ind[n2]==2, "Wrong InDegMap value.");  | 
         | 
    40   check(outd[n1]==2 && outd[n2]==1, "Wrong OutDegMap value.");  | 
         | 
    41   | 
         | 
    42   snap.restore();  | 
         | 
    43   | 
         | 
    44   check(ind[n1]==0 && ind[n2]==1, "Wrong InDegMap value.");  | 
         | 
    45   check(outd[n1]==1 && outd[n2]==0, "Wrong OutDegMap value.");  | 
         | 
    46     | 
         | 
    47 }  | 
    18   | 
    48   | 
    19 int main() { | 
    49 int main() { | 
    20   ///\file  | 
    50   ///\file  | 
    21   { // checking list graph | 
    51   { // checking list graph | 
    22     checkGraphCounters<ListGraph>();  | 
    52     checkGraphCounters<ListGraph>();  | 
    29     FullGraph fg(num);  | 
    59     FullGraph fg(num);  | 
    30     check(countNodes(fg) == num, "FullGraph: wrong node number.");  | 
    60     check(countNodes(fg) == num, "FullGraph: wrong node number.");  | 
    31     check(countEdges(fg) == num*num, "FullGraph: wrong edge number.");      | 
    61     check(countEdges(fg) == num*num, "FullGraph: wrong edge number.");      | 
    32   }  | 
    62   }  | 
    33   | 
    63   | 
         | 
    64   //check In/OutDegMap (and SnapShot feature)  | 
         | 
    65   | 
         | 
    66   checkSnapDeg<ListGraph>();  | 
         | 
    67   checkSnapDeg<SmartGraph>();  | 
         | 
    68     | 
         | 
    69   | 
         | 
    70   ///Everything is OK  | 
    34   std::cout << __FILE__ ": All tests passed.\n";  | 
    71   std::cout << __FILE__ ": All tests passed.\n";  | 
    35   | 
    72   | 
    36   return 0;  | 
    73   return 0;  | 
    37 }  | 
    74 }  |