diff --git a/test/unordered/insert_tests.cpp b/test/unordered/insert_tests.cpp index 1c24394c..ab322ee2 100644 --- a/test/unordered/insert_tests.cpp +++ b/test/unordered/insert_tests.cpp @@ -1077,18 +1077,27 @@ namespace insert_tests { #endif #endif - UNORDERED_AUTO_TEST (insert_initializer_list_map) { -#ifdef BOOST_UNORDERED_FOA_TESTS - boost::unordered_flat_map map; -#else - boost::unordered_map map; - #endif - // map.insert({}); + template static void insert_initializer_list_map_impl() + { + Map map; + BOOST_TEST(map.empty()); map.insert({{"a", "b"}, {"a", "b"}, {"d", ""}}); BOOST_TEST_EQ(map.size(), 2u); } + UNORDERED_AUTO_TEST (insert_initializer_list_map) { +#ifdef BOOST_UNORDERED_FOA_TESTS + insert_initializer_list_map_impl< + boost::unordered_flat_map >(); + insert_initializer_list_map_impl< + boost::unordered_node_map >(); +#else + insert_initializer_list_map_implboost::unordered_map(); +#endif + } + #ifndef BOOST_UNORDERED_FOA_TESTS UNORDERED_AUTO_TEST (insert_initializer_list_multimap) { boost::unordered_multimap multimap; @@ -1127,34 +1136,47 @@ namespace insert_tests { } }; + template static void map_emplace_test_impl() + { + Map x; +#if !BOOST_UNORDERED_SUN_WORKAROUNDS1 + x.emplace(); + BOOST_TEST( + x.find(0) != x.end() && x.find(0)->second == overloaded_constructor()); +#endif + + x.emplace(2, 3); + BOOST_TEST( + x.find(2) != x.end() && x.find(2)->second == overloaded_constructor(3)); + + x.try_emplace(5); + BOOST_TEST( + x.find(5) != x.end() && x.find(5)->second == overloaded_constructor()); + } + UNORDERED_AUTO_TEST (map_emplace_test) { { #ifdef BOOST_UNORDERED_FOA_TESTS - boost::unordered_flat_map > > - x; + flat_map; + + typedef boost::unordered_node_map > > + node_map; + + map_emplace_test_impl(); + map_emplace_test_impl(); #else - - boost::unordered_map > > - x; + map; + + map_emplace_test_impl(); #endif - -#if !BOOST_UNORDERED_SUN_WORKAROUNDS1 - x.emplace(); - BOOST_TEST( - x.find(0) != x.end() && x.find(0)->second == overloaded_constructor()); -#endif - - x.emplace(2, 3); - BOOST_TEST( - x.find(2) != x.end() && x.find(2)->second == overloaded_constructor(3)); - - x.try_emplace(5); - BOOST_TEST( - x.find(5) != x.end() && x.find(5)->second == overloaded_constructor()); } #ifndef BOOST_UNORDERED_FOA_TESTS @@ -1405,27 +1427,14 @@ RUN_TESTS_QUIET() #else // PIECEWISE_TEST_NAME -UNORDERED_AUTO_TEST (PIECEWISE_TEST_NAME) { + template + static void piecewise_test_impl() + { #if EMULATING_PIECEWISE_CONSTRUCTION test::detail::disable_construction_tracking _scoped; #endif - { -#if defined(BOOST_UNORDERED_FOA_TESTS) - boost::unordered_flat_map, - std::equal_to, - test::allocator1< - std::pair > > - x; -#else - boost::unordered_map, - std::equal_to, - test::allocator1< - std::pair > > - x; -#endif + Map x; x.emplace(PIECEWISE_NAMESPACE::piecewise_construct, TUPLE_NAMESPACE::make_tuple(), TUPLE_NAMESPACE::make_tuple()); @@ -1469,6 +1478,41 @@ UNORDERED_AUTO_TEST (PIECEWISE_TEST_NAME) { x.find(overloaded_constructor(2, 3))->second == overloaded_constructor(4, 5, 6)); } + +UNORDERED_AUTO_TEST (PIECEWISE_TEST_NAME) { +#if EMULATING_PIECEWISE_CONSTRUCTION + test::detail::disable_construction_tracking _scoped; +#endif + + { +#if defined(BOOST_UNORDERED_FOA_TESTS) + typedef boost::unordered_flat_map, + std::equal_to, + test::allocator1< + std::pair > > + flat_map; + + typedef boost::unordered_node_map, + std::equal_to, + test::allocator1< + std::pair > > + node_map; + + piecewise_test_impl(); + piecewise_test_impl(); +#else + typedef boost::unordered_map, + std::equal_to, + test::allocator1< + std::pair > > + map; + + piecewise_test_impl(); +#endif + } #ifndef BOOST_UNORDERED_FOA_TESTS { boost::unordered_multimap