test/graph_test.cc
changeset 829 ceb2756dea2a
parent 784 9d6c3e8b2421
child 956 141f9c0db4a3
     1.1 --- a/test/graph_test.cc	Mon Sep 28 15:53:20 2009 +0200
     1.2 +++ b/test/graph_test.cc	Thu Nov 05 10:27:17 2009 +0100
     1.3 @@ -38,6 +38,9 @@
     1.4    checkGraphEdgeList(G, 0);
     1.5    checkGraphArcList(G, 0);
     1.6  
     1.7 +  G.reserveNode(3);
     1.8 +  G.reserveEdge(3);
     1.9 +
    1.10    Node
    1.11      n1 = G.addNode(),
    1.12      n2 = G.addNode(),
    1.13 @@ -256,6 +259,15 @@
    1.14    G.addEdge(G.addNode(), G.addNode());
    1.15  
    1.16    snapshot.restore();
    1.17 +  snapshot.save(G);
    1.18 +
    1.19 +  checkGraphNodeList(G, 4);
    1.20 +  checkGraphEdgeList(G, 3);
    1.21 +  checkGraphArcList(G, 6);
    1.22 +  
    1.23 +  G.addEdge(G.addNode(), G.addNode());
    1.24 +
    1.25 +  snapshot.restore();
    1.26  
    1.27    checkGraphNodeList(G, 4);
    1.28    checkGraphEdgeList(G, 3);
    1.29 @@ -267,6 +279,13 @@
    1.30    GRAPH_TYPEDEFS(Graph);
    1.31  
    1.32    Graph G(num);
    1.33 +  check(G.nodeNum() == num && G.edgeNum() == num * (num - 1) / 2,
    1.34 +        "Wrong size");
    1.35 +
    1.36 +  G.resize(num);
    1.37 +  check(G.nodeNum() == num && G.edgeNum() == num * (num - 1) / 2,
    1.38 +        "Wrong size");
    1.39 +
    1.40    checkGraphNodeList(G, num);
    1.41    checkGraphEdgeList(G, num * (num - 1) / 2);
    1.42  
    1.43 @@ -411,6 +430,10 @@
    1.44    check(G.width() == width, "Wrong column number");
    1.45    check(G.height() == height, "Wrong row number");
    1.46  
    1.47 +  G.resize(width, height);
    1.48 +  check(G.width() == width, "Wrong column number");
    1.49 +  check(G.height() == height, "Wrong row number");
    1.50 +
    1.51    for (int i = 0; i < width; ++i) {
    1.52      for (int j = 0; j < height; ++j) {
    1.53        check(G.col(G(i, j)) == i, "Wrong column");
    1.54 @@ -486,6 +509,11 @@
    1.55    GRAPH_TYPEDEFS(HypercubeGraph);
    1.56  
    1.57    HypercubeGraph G(dim);
    1.58 +  check(G.dimension() == dim, "Wrong dimension");
    1.59 +
    1.60 +  G.resize(dim);
    1.61 +  check(G.dimension() == dim, "Wrong dimension");
    1.62 +  
    1.63    checkGraphNodeList(G, 1 << dim);
    1.64    checkGraphEdgeList(G, dim * (1 << (dim-1)));
    1.65    checkGraphArcList(G, dim * (1 << dim));