test/map_test.h
changeset 2389 df6a32249b46
parent 1956 a055123339d5
child 2391 14a343be7a5a
equal deleted inserted replaced
3:2b21c1f12b9d 4:8cdfff67143b
    43     for (int i = 0; i < num; ++i) {
    43     for (int i = 0; i < num; ++i) {
    44       nodes.push_back(graph.addNode());      
    44       nodes.push_back(graph.addNode());      
    45     }
    45     }
    46     typedef typename Graph::template NodeMap<int> IntNodeMap;
    46     typedef typename Graph::template NodeMap<int> IntNodeMap;
    47     IntNodeMap map(graph, 42);
    47     IntNodeMap map(graph, 42);
    48     for (int i = 0; i < (int)nodes.size(); ++i) {
    48     for (int i = 0; i < int(nodes.size()); ++i) {
    49       check(map[nodes[i]] == 42, "Wrong map constructor.");      
    49       check(map[nodes[i]] == 42, "Wrong map constructor.");      
    50     }
    50     }
    51     for (int i = 0; i < num; ++i) {
    51     for (int i = 0; i < num; ++i) {
    52       nodes.push_back(graph.addNode());
    52       nodes.push_back(graph.addNode());
    53       map[nodes.back()] = 23;
    53       map[nodes.back()] = 23;
    54     }
    54     }
    55     map = constMap<Node>(12);
    55     map = constMap<Node>(12);
    56     for (int i = 0; i < (int)nodes.size(); ++i) {
    56     for (int i = 0; i < int(nodes.size()); ++i) {
    57       check(map[nodes[i]] == 12, "Wrong map constructor.");      
    57       check(map[nodes[i]] == 12, "Wrong map constructor.");      
    58     }    
    58     }    
    59     graph.clear();
    59     graph.clear();
    60     nodes.clear();
    60     nodes.clear();
    61   }
    61   }
    81     }
    81     }
    82     
    82     
    83     typedef typename Graph::template EdgeMap<int> IntEdgeMap;
    83     typedef typename Graph::template EdgeMap<int> IntEdgeMap;
    84     IntEdgeMap map(graph, 42);
    84     IntEdgeMap map(graph, 42);
    85     
    85     
    86     for (int i = 0; i < (int)edges.size(); ++i) {
    86     for (int i = 0; i < int(edges.size()); ++i) {
    87       check(map[edges[i]] == 42, "Wrong map constructor.");      
    87       check(map[edges[i]] == 42, "Wrong map constructor.");      
    88     }
    88     }
    89     
    89     
    90     for (int i = 0; i < num; ++i) {
    90     for (int i = 0; i < num; ++i) {
    91       for (int j = i + 1; j < num; ++j) {
    91       for (int j = i + 1; j < num; ++j) {
    92 	edges.push_back(graph.addEdge(nodes[i], nodes[j]));
    92 	edges.push_back(graph.addEdge(nodes[i], nodes[j]));
    93 	map[edges.back()] = 23;
    93 	map[edges.back()] = 23;
    94       }
    94       }
    95     }
    95     }
    96     map = constMap<Edge>(12);
    96     map = constMap<Edge>(12);
    97     for (int i = 0; i < (int)edges.size(); ++i) {
    97     for (int i = 0; i < int(edges.size()); ++i) {
    98       check(map[edges[i]] == 12, "Wrong map constructor.");      
    98       check(map[edges[i]] == 12, "Wrong map constructor.");      
    99     }    
    99     }    
   100     graph.clear();
   100     graph.clear();
   101     edges.clear();    
   101     edges.clear();    
   102   }
   102   }