1
Fork 0

A couple test cases.

main
Davi Reis 2012-06-15 18:09:54 -03:00
parent b8c5b54c9a
commit 4f3c9003d5
3 changed files with 19 additions and 2 deletions

View File

@ -11,6 +11,8 @@ using namespace cxxmph;
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(large_insert, Tester::large_insert);
CXXMPH_CXX_TEST_CASE(small_search, Tester::small_search);

View File

@ -17,6 +17,21 @@ using namespace std;
template <template<typename...> class map_type>
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() {
map_type<int64_t, int64_t> m;
// Start counting from 1 to not touch default constructed value bugs

View File

@ -11,7 +11,8 @@ using namespace cxxmph;
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(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);