Changeset 684:7b1a6e963018 in lemon1.2 for test/maps_test.cc
 Timestamp:
 07/23/09 18:09:41 (12 years ago)
 Branch:
 default
 Children:
 685:a27356ceb5bd, 720:6e8c27ee9079
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

test/maps_test.cc
r507 r684 23 23 #include <lemon/concepts/maps.h> 24 24 #include <lemon/maps.h> 25 #include <lemon/list_graph.h> 25 26 26 27 #include "test_tools.h" … … 349 350 check(v1[i++] == *it, "Something is wrong with LoggerBoolMap"); 350 351 } 352 353 // CrossRefMap 354 { 355 typedef ListDigraph Graph; 356 DIGRAPH_TYPEDEFS(Graph); 357 358 checkConcept<ReadWriteMap<Node, int>, 359 CrossRefMap<Graph, Node, int> >(); 360 361 Graph gr; 362 typedef CrossRefMap<Graph, Node, char> CRMap; 363 typedef CRMap::ValueIterator ValueIt; 364 CRMap map(gr); 365 366 Node n0 = gr.addNode(); 367 Node n1 = gr.addNode(); 368 Node n2 = gr.addNode(); 369 370 map.set(n0, 'A'); 371 map.set(n1, 'B'); 372 map.set(n2, 'C'); 373 map.set(n2, 'A'); 374 map.set(n0, 'C'); 375 376 check(map[n0] == 'C' && map[n1] == 'B' && map[n2] == 'A', 377 "Wrong CrossRefMap"); 378 check(map('A') == n2 && map.inverse()['A'] == n2, "Wrong CrossRefMap"); 379 check(map('B') == n1 && map.inverse()['B'] == n1, "Wrong CrossRefMap"); 380 check(map('C') == n0 && map.inverse()['C'] == n0, "Wrong CrossRefMap"); 381 382 ValueIt it = map.beginValue(); 383 check(*it++ == 'A' && *it++ == 'B' && *it++ == 'C' && 384 it == map.endValue(), "Wrong value iterator"); 385 } 351 386 352 387 return 0;
Note: See TracChangeset
for help on using the changeset viewer.