diff -r 7439dc5fe1b9 -r fb93895f84d9 test/maps_test.cc --- a/test/maps_test.cc Thu Aug 20 22:52:03 2009 +0200 +++ b/test/maps_test.cc Thu Aug 20 22:52:16 2009 +0200 @@ -22,6 +22,7 @@ #include #include #include +#include #include "test_tools.h" @@ -348,6 +349,40 @@ it != map2.end(); ++it ) check(v1[i++] == *it, "Something is wrong with LoggerBoolMap"); } + + // CrossRefMap + { + typedef ListDigraph Graph; + DIGRAPH_TYPEDEFS(Graph); + + checkConcept, + CrossRefMap >(); + + Graph gr; + typedef CrossRefMap CRMap; + typedef CRMap::ValueIterator ValueIt; + CRMap map(gr); + + Node n0 = gr.addNode(); + Node n1 = gr.addNode(); + Node n2 = gr.addNode(); + + map.set(n0, 'A'); + map.set(n1, 'B'); + map.set(n2, 'C'); + map.set(n2, 'A'); + map.set(n0, 'C'); + + check(map[n0] == 'C' && map[n1] == 'B' && map[n2] == 'A', + "Wrong CrossRefMap"); + check(map('A') == n2 && map.inverse()['A'] == n2, "Wrong CrossRefMap"); + check(map('B') == n1 && map.inverse()['B'] == n1, "Wrong CrossRefMap"); + check(map('C') == n0 && map.inverse()['C'] == n0, "Wrong CrossRefMap"); + + ValueIt it = map.beginValue(); + check(*it++ == 'A' && *it++ == 'B' && *it++ == 'C' && + it == map.endValue(), "Wrong value iterator"); + } return 0; }