Add post_move_tests

This commit is contained in:
Christian Mazakas
2022-10-14 13:19:37 -07:00
parent 1de8801c08
commit 9da61e9050
2 changed files with 52 additions and 12 deletions

View File

@ -114,6 +114,7 @@ build_foa equivalent_keys_tests ;
build_foa constructor_tests ; build_foa constructor_tests ;
build_foa copy_tests ; build_foa copy_tests ;
build_foa move_tests ; build_foa move_tests ;
build_foa post_move_tests ;
build_foa assign_tests ; build_foa assign_tests ;
build_foa insert_tests ; build_foa insert_tests ;
build_foa insert_hint_tests ; build_foa insert_hint_tests ;

View File

@ -3,13 +3,7 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying // Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or move at http://www.boost.org/LICENSE_1_0.txt) // file LICENSE_1_0.txt or move at http://www.boost.org/LICENSE_1_0.txt)
// clang-format off #include "../helpers/unordered.hpp"
#include "../helpers/prefix.hpp"
#include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>
#include "../helpers/postfix.hpp"
// clang-format on
#include "../helpers/test.hpp" #include "../helpers/test.hpp"
#include "../objects/test.hpp" #include "../objects/test.hpp"
#include "../objects/cxx11_allocator.hpp" #include "../objects/cxx11_allocator.hpp"
@ -438,11 +432,13 @@ namespace move_tests {
copy_assignment<T>, copy_assignment<T>,
move_assignment<T>, move_assignment<T>,
equal<T>, equal<T>,
#ifndef BOOST_UNORDERED_FOA_TESTS
extract<T>, extract<T>,
buckets<T>,
#endif
merge<T>, merge<T>,
erase_with_pred<T>, erase_with_pred<T>,
container_swap<T>, container_swap<T>,
buckets<T>,
double_move_construct<T>, double_move_construct<T>,
double_move_assign<T> double_move_assign<T>
}; };
@ -489,8 +485,13 @@ namespace move_tests {
T y(v.begin(), v.end(), 0, hf, eq, al1); T y(v.begin(), v.end(), 0, hf, eq, al1);
T x(boost::move(y), al2); T x(boost::move(y), al2);
#ifdef BOOST_UNORDERED_FOA_TESTS
BOOST_TEST(y.empty());
BOOST_TEST(y.begin() == y.end());
#else
BOOST_TEST_NOT(y.empty()); BOOST_TEST_NOT(y.empty());
BOOST_TEST(y.begin() != y.end()); BOOST_TEST(y.begin() != y.end());
#endif
fps[i](y, v); fps[i](y, v);
@ -558,8 +559,13 @@ namespace move_tests {
#endif #endif
} else { } else {
#ifdef BOOST_UNORDERED_FOA_TESTS
BOOST_TEST(y.empty());
BOOST_TEST(y.begin() == y.end());
#else
BOOST_TEST_NOT(y.empty()); BOOST_TEST_NOT(y.empty());
BOOST_TEST(y.begin() != y.end()); BOOST_TEST(y.begin() != y.end());
#endif
} }
fps[i](y, v); fps[i](y, v);
@ -569,6 +575,42 @@ namespace move_tests {
} }
} }
using test::default_generator;
using test::generate_collisions;
using test::limited_range;
#ifdef BOOST_UNORDERED_FOA_TESTS
boost::unordered_flat_map<test::object, test::object, test::hash,
test::equal_to,
std::allocator<std::pair<test::object const, test::object> > >*
test_map_std_alloc;
boost::unordered_flat_set<test::object, test::hash, test::equal_to,
test::allocator2<test::object> >* test_set;
boost::unordered_flat_map<test::object, test::object, test::hash,
test::equal_to,
test::allocator1<std::pair<test::object const, test::object> > >* test_map;
boost::unordered_flat_set<test::object, test::hash, test::equal_to,
test::cxx11_allocator<test::object, test::propagate_move> >*
test_set_prop_move;
boost::unordered_flat_map<test::object, test::object, test::hash,
test::equal_to,
test::cxx11_allocator<std::pair<test::object const, test::object>,
test::propagate_move> >* test_map_prop_move;
boost::unordered_flat_set<test::object, test::hash, test::equal_to,
test::cxx11_allocator<test::object, test::no_propagate_move> >*
test_set_no_prop_move;
boost::unordered_flat_map<test::object, test::object, test::hash,
test::equal_to,
test::cxx11_allocator<std::pair<test::object const, test::object>,
test::no_propagate_move> >* test_map_no_prop_move;
UNORDERED_TEST(post_move_tests,
((test_set)(test_map)(test_set_prop_move)(test_map_prop_move)(test_set_no_prop_move)(test_map_no_prop_move))(
(default_generator)(generate_collisions)(limited_range)))
#else
boost::unordered_map<test::object, test::object, test::hash, test::equal_to, boost::unordered_map<test::object, test::object, test::hash, test::equal_to,
std::allocator<std::pair<test::object const, test::object> > >* std::allocator<std::pair<test::object const, test::object> > >*
test_map_std_alloc; test_map_std_alloc;
@ -612,16 +654,13 @@ namespace move_tests {
test::cxx11_allocator<std::pair<test::object const, test::object>, test::cxx11_allocator<std::pair<test::object const, test::object>,
test::no_propagate_move> >* test_multimap_no_prop_move; test::no_propagate_move> >* test_multimap_no_prop_move;
using test::default_generator;
using test::generate_collisions;
using test::limited_range;
UNORDERED_TEST(post_move_tests, UNORDERED_TEST(post_move_tests,
((test_set)(test_multiset)(test_map)(test_multimap)(test_set_prop_move)( ((test_set)(test_multiset)(test_map)(test_multimap)(test_set_prop_move)(
test_multiset_prop_move)(test_map_prop_move)(test_multimap_prop_move)( test_multiset_prop_move)(test_map_prop_move)(test_multimap_prop_move)(
test_set_no_prop_move)(test_multiset_no_prop_move)(test_map_no_prop_move)( test_set_no_prop_move)(test_multiset_no_prop_move)(test_map_no_prop_move)(
test_multimap_no_prop_move))( test_multimap_no_prop_move))(
(default_generator)(generate_collisions)(limited_range))) (default_generator)(generate_collisions)(limited_range)))
#endif
} }
RUN_TESTS() RUN_TESTS()