A couple test cases.
This commit is contained in:
parent
2cf5c15cf6
commit
e4d6e18de0
@ -11,6 +11,8 @@ using namespace cxxmph;
|
|||||||
|
|
||||||
typedef MapTester<dense_hash_map> Tester;
|
typedef MapTester<dense_hash_map> 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(small_insert, Tester::small_insert);
|
||||||
CXXMPH_CXX_TEST_CASE(large_insert, Tester::large_insert);
|
CXXMPH_CXX_TEST_CASE(large_insert, Tester::large_insert);
|
||||||
CXXMPH_CXX_TEST_CASE(small_search, Tester::small_search);
|
CXXMPH_CXX_TEST_CASE(small_search, Tester::small_search);
|
||||||
|
@ -17,6 +17,21 @@ using namespace std;
|
|||||||
|
|
||||||
template <template<typename...> class map_type>
|
template <template<typename...> class map_type>
|
||||||
struct MapTester {
|
struct MapTester {
|
||||||
|
static bool empty_find() {
|
||||||
|
map_type<int64_t, int64_t> m;
|
||||||
|
for (int i = 0; i < 1000; ++i) {
|
||||||
|
if (m.find(i) != m.end()) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
static bool empty_erase() {
|
||||||
|
map_type<int64_t, int64_t> m;
|
||||||
|
for (int i = 0; i < 1000; ++i) {
|
||||||
|
m.erase(i);
|
||||||
|
if (m.size()) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
static bool small_insert() {
|
static bool small_insert() {
|
||||||
map_type<int64_t, int64_t> m;
|
map_type<int64_t, int64_t> m;
|
||||||
// Start counting from 1 to not touch default constructed value bugs
|
// Start counting from 1 to not touch default constructed value bugs
|
||||||
|
@ -11,7 +11,8 @@ using namespace cxxmph;
|
|||||||
|
|
||||||
typedef MapTester<mph_map> Tester;
|
typedef MapTester<mph_map> 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(small_insert, Tester::small_insert);
|
||||||
CXXMPH_CXX_TEST_CASE(large_insert, Tester::large_insert);
|
CXXMPH_CXX_TEST_CASE(large_insert, Tester::large_insert);
|
||||||
CXXMPH_CXX_TEST_CASE(small_search, Tester::small_search);
|
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_zero, Tester::rehash_zero);
|
||||||
CXXMPH_CXX_TEST_CASE(rehash_size, Tester::rehash_size);
|
CXXMPH_CXX_TEST_CASE(rehash_size, Tester::rehash_size);
|
||||||
CXXMPH_CXX_TEST_CASE(erase_value, Tester::erase_value);
|
CXXMPH_CXX_TEST_CASE(erase_value, Tester::erase_value);
|
||||||
*/
|
|
||||||
CXXMPH_CXX_TEST_CASE(erase_iterator, Tester::erase_iterator);
|
CXXMPH_CXX_TEST_CASE(erase_iterator, Tester::erase_iterator);
|
||||||
|
Loading…
Reference in New Issue
Block a user