diff --git a/cxxmph/dense_hash_map_test.cc b/cxxmph/dense_hash_map_test.cc index 0c69b78..5f35e27 100644 --- a/cxxmph/dense_hash_map_test.cc +++ b/cxxmph/dense_hash_map_test.cc @@ -11,6 +11,8 @@ using namespace cxxmph; typedef MapTester Tester; +CXXMPH_CXX_TEST_CASE(empty_find, Tester::empty_find); +CXXMPH_CXX_TEST_CASE(empty_erase, Tester::empty_erase); CXXMPH_CXX_TEST_CASE(small_insert, Tester::small_insert); CXXMPH_CXX_TEST_CASE(large_insert, Tester::large_insert); CXXMPH_CXX_TEST_CASE(small_search, Tester::small_search); diff --git a/cxxmph/map_tester.h b/cxxmph/map_tester.h index 10d4357..e71ad6a 100644 --- a/cxxmph/map_tester.h +++ b/cxxmph/map_tester.h @@ -17,6 +17,21 @@ using namespace std; template class map_type> struct MapTester { + static bool empty_find() { + map_type m; + for (int i = 0; i < 1000; ++i) { + if (m.find(i) != m.end()) return false; + } + return true; + } + static bool empty_erase() { + map_type m; + for (int i = 0; i < 1000; ++i) { + m.erase(i); + if (m.size()) return false; + } + return true; + } static bool small_insert() { map_type m; // Start counting from 1 to not touch default constructed value bugs diff --git a/cxxmph/mph_map_test.cc b/cxxmph/mph_map_test.cc index 5fb73ea..26f70e1 100644 --- a/cxxmph/mph_map_test.cc +++ b/cxxmph/mph_map_test.cc @@ -11,7 +11,8 @@ using namespace cxxmph; typedef MapTester Tester; -/* +CXXMPH_CXX_TEST_CASE(empty_find, Tester::empty_find); +CXXMPH_CXX_TEST_CASE(empty_erase, Tester::empty_erase); CXXMPH_CXX_TEST_CASE(small_insert, Tester::small_insert); CXXMPH_CXX_TEST_CASE(large_insert, Tester::large_insert); CXXMPH_CXX_TEST_CASE(small_search, Tester::small_search); @@ -21,5 +22,4 @@ CXXMPH_CXX_TEST_CASE(string_search, Tester::string_search); CXXMPH_CXX_TEST_CASE(rehash_zero, Tester::rehash_zero); CXXMPH_CXX_TEST_CASE(rehash_size, Tester::rehash_size); CXXMPH_CXX_TEST_CASE(erase_value, Tester::erase_value); -*/ CXXMPH_CXX_TEST_CASE(erase_iterator, Tester::erase_iterator);