1.1 --- a/test/graph_utils_test.cc Thu Jun 09 09:49:48 2005 +0000
1.2 +++ b/test/graph_utils_test.cc Thu Jun 09 09:49:56 2005 +0000
1.3 @@ -15,6 +15,36 @@
1.4
1.5 using namespace lemon;
1.6
1.7 +template<class Graph>
1.8 +void checkSnapDeg()
1.9 +{
1.10 + Graph g;
1.11 + typename Graph::Node n1=g.addNode();
1.12 + typename Graph::Node n2=g.addNode();
1.13 +
1.14 + InDegMap<Graph> ind(g);
1.15 +
1.16 + g.addEdge(n1,n2);
1.17 +
1.18 + typename Graph::SnapShot snap(g);
1.19 +
1.20 + OutDegMap<Graph> outd(g);
1.21 +
1.22 + check(ind[n1]==0 && ind[n2]==1, "Wrong InDegMap value.");
1.23 + check(outd[n1]==1 && outd[n2]==0, "Wrong OutDegMap value.");
1.24 +
1.25 + g.addEdge(n1,n2);
1.26 + g.addEdge(n2,n1);
1.27 +
1.28 + check(ind[n1]==1 && ind[n2]==2, "Wrong InDegMap value.");
1.29 + check(outd[n1]==2 && outd[n2]==1, "Wrong OutDegMap value.");
1.30 +
1.31 + snap.restore();
1.32 +
1.33 + check(ind[n1]==0 && ind[n2]==1, "Wrong InDegMap value.");
1.34 + check(outd[n1]==1 && outd[n2]==0, "Wrong OutDegMap value.");
1.35 +
1.36 +}
1.37
1.38 int main() {
1.39 ///\file
1.40 @@ -31,6 +61,13 @@
1.41 check(countEdges(fg) == num*num, "FullGraph: wrong edge number.");
1.42 }
1.43
1.44 + //check In/OutDegMap (and SnapShot feature)
1.45 +
1.46 + checkSnapDeg<ListGraph>();
1.47 + checkSnapDeg<SmartGraph>();
1.48 +
1.49 +
1.50 + ///Everything is OK
1.51 std::cout << __FILE__ ": All tests passed.\n";
1.52
1.53 return 0;