Changeset 209:765619b7cbb2 in lemon1.2 for test/kruskal_test.cc
 Timestamp:
 07/13/08 20:51:02 (15 years ago)
 Branch:
 default
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

test/kruskal_test.cc
r171 r209 1 /* * C++*1 /* * mode: C++; indenttabsmode: 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 5 * Copyright (C) 20032008 … … 74 74 Node v4=G.addNode(); 75 75 Node t=G.addNode(); 76 76 77 77 Edge e1 = G.addEdge(s, v1); 78 78 Edge e2 = G.addEdge(s, v2); … … 91 91 ECostMap edge_cost_map(G, 2); 92 92 EBoolMap tree_map(G); 93 93 94 94 95 95 //Test with const map. 96 96 check(kruskal(G, ConstMap<ListGraph::Edge,int>(2), tree_map)==10, 97 97 "Total cost should be 10"); 98 98 //Test with an edge map (filled with uniform costs). 99 99 check(kruskal(G, edge_cost_map, tree_map)==10, 100 100 "Total cost should be 10"); 101 101 102 102 edge_cost_map.set(e1, 10); … … 115 115 //Test with a edge map and inserter. 116 116 check(kruskal(G, edge_cost_map, 117 118 119 120 117 tree_edge_vec.begin()) 118 ==31, 119 "Total cost should be 31."); 120 121 121 tree_edge_vec.clear(); 122 122 123 123 check(kruskal(G, edge_cost_map, 124 125 126 127 124 back_inserter(tree_edge_vec)) 125 ==31, 126 "Total cost should be 31."); 127 128 128 // tree_edge_vec.clear(); 129 129 130 130 // //The above test could also be coded like this: 131 131 // check(kruskal(G, 132 // 133 // 134 // 135 // 132 // makeKruskalMapInput(G, edge_cost_map), 133 // makeKruskalSequenceOutput(back_inserter(tree_edge_vec))) 134 // ==31, 135 // "Total cost should be 31."); 136 136 137 137 check(tree_edge_vec.size()==5,"The tree should have 5 edges."); 138 138 139 139 check(tree_edge_vec[0]==e1 && 140 141 142 143 144 140 tree_edge_vec[1]==e2 && 141 tree_edge_vec[2]==e5 && 142 tree_edge_vec[3]==e7 && 143 tree_edge_vec[4]==e9, 144 "Wrong tree."); 145 145 146 146 return 0;
Note: See TracChangeset
for help on using the changeset viewer.