test/maps_test.cc
changeset 171 02f4d5d9bfd7
parent 159 c7d30f7810e5
child 209 765619b7cbb2
equal deleted inserted replaced
7:57f5f99f3aee 8:2221836cb8bb
   303           "Something is wrong with LessMap");
   303           "Something is wrong with LessMap");
   304     check(!equalMap(id,cm)[1] && equalMap(id,cm)[2] && !equalMap(id,cm)[3],
   304     check(!equalMap(id,cm)[1] && equalMap(id,cm)[2] && !equalMap(id,cm)[3],
   305           "Something is wrong with EqualMap");
   305           "Something is wrong with EqualMap");
   306   }
   306   }
   307   
   307   
   308   // StoreBoolMap
   308   // LoggerBoolMap
   309   {
   309   {
   310     typedef std::vector<int> vec;
   310     typedef std::vector<int> vec;
   311     vec v1;
   311     vec v1;
   312     vec v2(10);
   312     vec v2(10);
   313     StoreBoolMap<std::back_insert_iterator<vec> > map1(std::back_inserter(v1));
   313     LoggerBoolMap<std::back_insert_iterator<vec> > map1(std::back_inserter(v1));
   314     StoreBoolMap<vec::iterator> map2(v2.begin());
   314     LoggerBoolMap<vec::iterator> map2(v2.begin());
   315     map1.set(10, false);
   315     map1.set(10, false);
   316     map1.set(20, true);   map2.set(20, true);
   316     map1.set(20, true);   map2.set(20, true);
   317     map1.set(30, false);  map2.set(40, false);
   317     map1.set(30, false);  map2.set(40, false);
   318     map1.set(50, true);   map2.set(50, true);
   318     map1.set(50, true);   map2.set(50, true);
   319     map1.set(60, true);   map2.set(60, true);
   319     map1.set(60, true);   map2.set(60, true);
   320     check(v1.size() == 3 && v2.size() == 10 &&
   320     check(v1.size() == 3 && v2.size() == 10 &&
   321           v1[0]==20 && v1[1]==50 && v1[2]==60 && v2[0]==20 && v2[1]==50 && v2[2]==60,
   321           v1[0]==20 && v1[1]==50 && v1[2]==60 && v2[0]==20 && v2[1]==50 && v2[2]==60,
   322           "Something is wrong with StoreBoolMap");
   322           "Something is wrong with LoggerBoolMap");
   323           
   323           
   324     int i = 0;
   324     int i = 0;
   325     for ( StoreBoolMap<vec::iterator>::Iterator it = map2.begin();
   325     for ( LoggerBoolMap<vec::iterator>::Iterator it = map2.begin();
   326           it != map2.end(); ++it )
   326           it != map2.end(); ++it )
   327       check(v1[i++] == *it, "Something is wrong with StoreBoolMap");
   327       check(v1[i++] == *it, "Something is wrong with LoggerBoolMap");
   328   }
   328   }
   329 
   329 
   330   return 0;
   330   return 0;
   331 }
   331 }