Browse Source

map: adding test for an unidentified bug to fix

undefined
Guillaume Bittoun Sam Hocevar <sam@hocevar.net> 9 years ago
parent
commit
f4c72644c7
1 changed files with 22 additions and 0 deletions
  1. +22
    -0
      src/t/base/map.cpp

+ 22
- 0
src/t/base/map.cpp View File

@@ -71,7 +71,29 @@ lolunit_declare_fixture(MapTest)
m[i] = i; m[i] = i;
a.Shuffle(); a.Shuffle();
for (int i = 0; i < a.Count(); i++) for (int i = 0; i < a.Count(); i++)
{
std::cout << m[a[i]] << " " << a[i] << std::endl;
m.remove(a[i]); m.remove(a[i]);
}
}

lolunit_declare_test(MapRemoveBug)
{
map<uint64_t, uint64_t> m;
array<uint64_t> a;

for (int i = 0; i < a.Count(); i++)
m[i] = i;

m.remove(12);
m.remove(0);
m.remove(17);
m.remove(2);
m.remove(9);
m.remove(4);
m.remove(15);
m.remove(10);
lolunit_assert_equal(m[8], 8);
} }


lolunit_declare_test(StringMap) lolunit_declare_test(StringMap)


Loading…
Cancel
Save