From ba439437bf133acdc285877189f893e61bb93ebd Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 14 Feb 2023 08:55:53 -0800 Subject: [PATCH 01/63] Add osx 12 to gha ci matrix --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f45f844d..03a8f51c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,8 @@ jobs: compiler: clang-14, cxxstd: '17,20,2b', os: ubuntu-22.04, ccache_key: "san2" } # OSX, clang - - { compiler: clang, cxxstd: '03,11,14,17,2a', os: macos-11, sanitize: yes } + - { compiler: clang, cxxstd: '03,11,14,17,2a', os: macos-11, } + - { compiler: clang, cxxstd: '03,11,14,17,2a', os: macos-12, sanitize: yes } timeout-minutes: 120 runs-on: ${{matrix.os}} From 5b0fe7f65591a924379f342eb3c7f7e0bf3be3d4 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 14 Feb 2023 08:56:59 -0800 Subject: [PATCH 02/63] Update test::compare_range to use BOOST_TEST_ALL_WITH --- test/helpers/tracker.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/helpers/tracker.hpp b/test/helpers/tracker.hpp index bc3d4b47..9c877459 100644 --- a/test/helpers/tracker.hpp +++ b/test/helpers/tracker.hpp @@ -42,9 +42,8 @@ namespace test { value_list values2(x2.begin(), x2.end()); values1.sort(); values2.sort(); - BOOST_TEST(values1.size() == values2.size() && - test::equal(values1.begin(), values1.end(), values2.begin(), - test::equivalent)); + BOOST_TEST_ALL_WITH(values1.begin(), values1.end(), values2.begin(), + values2.end(), test::equivalent); } template From e8fe550d6c016ff6280bf6dc03b3aaad45e7b051 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 14 Feb 2023 09:06:39 -0800 Subject: [PATCH 03/63] Add less_tests to track bug in test::exception::less::operator() impl --- test/Jamfile.v2 | 1 + test/exception/less_tests.cpp | 50 +++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 test/exception/less_tests.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 9a702bc6..129ea214 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -94,6 +94,7 @@ run exception/erase_exception_tests.cpp ; run exception/rehash_exception_tests.cpp ; run exception/swap_exception_tests.cpp : : : BOOST_UNORDERED_SWAP_METHOD=2 ; run exception/merge_exception_tests.cpp ; +run exception/less_tests.cpp ; run unordered/narrow_cast_tests.cpp ; run quick.cpp ; diff --git a/test/exception/less_tests.cpp b/test/exception/less_tests.cpp new file mode 100644 index 00000000..37a95ce2 --- /dev/null +++ b/test/exception/less_tests.cpp @@ -0,0 +1,50 @@ + +// Copyright 2023 Christian Mazakas +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include "./containers.hpp" + +#include "../helpers/helpers.hpp" +#include "../helpers/invariants.hpp" +#include "../helpers/random_values.hpp" +#include "../helpers/strong.hpp" +#include "../helpers/tracker.hpp" + +#include + +UNORDERED_AUTO_TEST (less_osx_regression) { + DISABLE_EXCEPTIONS; + typedef test_pair_set::value_type value_type; + typedef test::exception::object object; + + std::vector v; + v.push_back(value_type(object(12, 98), object(88, 13))); + v.push_back(value_type(object(24, 71), object(62, 84))); + v.push_back(value_type(object(30, 0), object(5, 73))); + v.push_back(value_type(object(34, 64), object(79, 58))); + v.push_back(value_type(object(36, 95), object(64, 23))); + v.push_back(value_type(object(42, 89), object(68, 44))); + v.push_back(value_type(object(42, 26), object(93, 64))); + v.push_back(value_type(object(86, 86), object(16, 62))); + v.push_back(value_type(object(86, 86), object(75, 23))); + v.push_back(value_type(object(92, 37), object(41, 90))); + + BOOST_TEST_EQ(v.size(), 10u); + + std::set s; + s.insert(v.begin(), v.end()); + BOOST_TEST_EQ(s.size(), v.size()); + + test::ordered tracker; + test_pair_set x; + for (std::vector::iterator it = v.begin(); it != v.end(); + ++it) { + x.insert(*it); + } + + tracker.insert(v.begin(), v.end()); + tracker.compare(x); +} + +RUN_TESTS() From 1ee91d494d15739b2d0da6aa43bc58261ca51923 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 14 Feb 2023 09:07:05 -0800 Subject: [PATCH 04/63] Fix bug in impl of test::exception::less::operator() --- test/objects/exception.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/objects/exception.hpp b/test/objects/exception.hpp index 68595eab..61a4be10 100644 --- a/test/objects/exception.hpp +++ b/test/objects/exception.hpp @@ -262,7 +262,7 @@ namespace test { if (less_impl(x1.first, x2.first)) { return true; } - if (!less_impl(x1.first, x2.first)) { + if (less_impl(x2.first, x1.first)) { return false; } return less_impl(x1.second, x2.second); From 83410fcabe7278ea5f7e494464746f015c866696 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 14 Feb 2023 09:08:38 -0800 Subject: [PATCH 05/63] Add -Wunused-template to tests run with the clang-14 toolset --- test/Jamfile.v2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 129ea214..91b926b2 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -1,6 +1,6 @@ # Copyright 2006-2008 Daniel James. -# Copyright 2022 Christian Mazakas +# Copyright 2022-2023 Christian Mazakas # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -26,6 +26,7 @@ project gcc-4.4:-Wno-strict-aliasing gcc-4.4:-fno-deduce-init-list + clang-14:-Wunused-template gcc:on clang:on From f7f5466ed22b01e39f8dfc40edb96d2e7804521e Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 14 Feb 2023 09:19:50 -0800 Subject: [PATCH 06/63] Add necessary #include's and typedefs for test suite to use foa-based node containers --- test/exception/containers.hpp | 20 ++++++++++++++++++-- test/helpers/unordered.hpp | 2 ++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/test/exception/containers.hpp b/test/exception/containers.hpp index e6eb267b..390207a8 100644 --- a/test/exception/containers.hpp +++ b/test/exception/containers.hpp @@ -25,8 +25,24 @@ typedef boost::unordered_flat_set< test::exception::allocator > test_pair_set; -#define CONTAINER_SEQ (test_set)(test_map) -#define CONTAINER_PAIR_SEQ (test_pair_set)(test_map) +typedef boost::unordered_node_set > + test_node_set; + +typedef boost::unordered_node_map > + test_node_map; + +typedef boost::unordered_node_set< + std::pair, + test::exception::hash, test::exception::equal_to, + test::exception::allocator > + test_pair_node_set; + +#define CONTAINER_SEQ (test_set)(test_map)(test_node_set)(test_node_map) +#define CONTAINER_PAIR_SEQ (test_pair_set)(test_map)(test_pair_node_set)(test_node_map) #else typedef boost::unordered_set #include +#include +#include #include #else #include From 66ffbdb881313035e932324a6e6b6fd2847d1ffc Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 14 Feb 2023 09:21:52 -0800 Subject: [PATCH 07/63] Add foa-based node containers to assign_tests --- test/unordered/assign_tests.cpp | 53 +++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/test/unordered/assign_tests.cpp b/test/unordered/assign_tests.cpp index b000e42f..b45efa01 100644 --- a/test/unordered/assign_tests.cpp +++ b/test/unordered/assign_tests.cpp @@ -1,6 +1,6 @@ // Copyright 2006-2009 Daniel James. -// Copyright 2022 Christian Mazakas. +// Copyright 2022-2023 Christian Mazakas. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -209,40 +209,75 @@ namespace assign_tests { #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_map >* test_map_std_alloc; + boost::unordered_node_map >* test_node_map_std_alloc; boost::unordered_flat_set >* test_set; + boost::unordered_node_set >* test_node_set; boost::unordered_flat_map >* test_map; + boost::unordered_node_map >* test_node_map; boost::unordered_flat_set >* test_set_prop_assign; + boost::unordered_node_set >* + test_node_set_prop_assign; boost::unordered_flat_map >* test_map_prop_assign; + boost::unordered_node_map >* + test_node_map_prop_assign; boost::unordered_flat_set >* test_set_no_prop_assign; + boost::unordered_node_set >* + test_node_set_no_prop_assign; boost::unordered_flat_map >* test_map_no_prop_assign; + boost::unordered_node_map >* + test_node_map_no_prop_assign; UNORDERED_AUTO_TEST (check_traits) { BOOST_TEST(!is_propagate(test_set)); BOOST_TEST(is_propagate(test_set_prop_assign)); BOOST_TEST(!is_propagate(test_set_no_prop_assign)); + + BOOST_TEST(!is_propagate(test_node_set)); + BOOST_TEST(is_propagate(test_node_set_prop_assign)); + BOOST_TEST(!is_propagate(test_node_set_no_prop_assign)); } UNORDERED_TEST(assign_tests1, - ((test_map_std_alloc)(test_set)(test_map)(test_set_prop_assign)(test_map_prop_assign)(test_set_no_prop_assign)(test_map_no_prop_assign))( + ((test_map_std_alloc)(test_node_map_std_alloc) + (test_set)(test_node_set) + (test_map)(test_node_map) + (test_set_prop_assign)(test_node_set_prop_assign) + (test_map_prop_assign)(test_node_map_prop_assign) + (test_set_no_prop_assign)(test_node_set_no_prop_assign) + (test_map_no_prop_assign)(test_node_map_no_prop_assign))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(assign_tests2, - ((test_set)(test_map)(test_set_prop_assign)(test_map_prop_assign)(test_set_no_prop_assign)(test_map_no_prop_assign))( + ((test_set)(test_node_set) + (test_map)(test_node_map) + (test_set_prop_assign)(test_node_set_prop_assign) + (test_map_prop_assign)(test_node_map_prop_assign) + (test_set_no_prop_assign)(test_node_set_no_prop_assign) + (test_map_no_prop_assign)(test_node_map_no_prop_assign))( (default_generator)(generate_collisions)(limited_range))) #else boost::unordered_map > init; #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_map x1; + boost::unordered_node_map x2; + x2[25] = 3; + x2[16] = 10; + BOOST_TEST(!x2.empty()); + x2 = init; + BOOST_TEST(x2.empty()); #else boost::unordered_map x1; #endif @@ -333,6 +374,12 @@ namespace assign_tests { #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_set x; + boost::unordered_node_set y; + y.insert(10); + y.insert(20); + y = {1, 2, -10}; + BOOST_TEST(y.find(10) == y.end()); + BOOST_TEST(y.find(-10) != y.end()); #else boost::unordered_set x; #endif From f1e1733c065a97d68fac68096dc6b8749d5c0687 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 14 Feb 2023 09:22:11 -0800 Subject: [PATCH 08/63] Add foa-based node containers to at_tests --- test/unordered/at_tests.cpp | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/test/unordered/at_tests.cpp b/test/unordered/at_tests.cpp index b06dfddb..eddf1789 100644 --- a/test/unordered/at_tests.cpp +++ b/test/unordered/at_tests.cpp @@ -1,6 +1,6 @@ // Copyright 2007-2009 Daniel James. -// Copyright 2022 Christian Mazakas. +// Copyright 2022-2023 Christian Mazakas. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -11,16 +11,12 @@ namespace at_tests { - UNORDERED_AUTO_TEST (at_tests) { + template static void at_tests(X*) + { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Create Map" << std::endl; -#ifdef BOOST_UNORDERED_FOA_TESTS - boost::unordered_flat_map x; - boost::unordered_flat_map const& x_const(x); -#else - boost::unordered_map x; - boost::unordered_map const& x_const(x); -#endif + X x; + X const& x_const(x); BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Check empty container" << std::endl; @@ -64,6 +60,21 @@ namespace at_tests { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Finished" << std::endl; } -} + +#ifdef BOOST_UNORDERED_FOA_TESTS + static boost::unordered_flat_map* test_map; + static boost::unordered_node_map* test_node_map; + + // clang-format off + UNORDERED_TEST(at_tests, ((test_map)(test_node_map))) + // clang-format on +#else + static boost::unordered_map* test_map; + + // clang-format off + UNORDERED_TEST(at_tests, ((test_map))) + // clang-format on +#endif +} // namespace at_tests RUN_TESTS() From d3b264345d69b1c1aecc275c450dd56e9f180cad Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Tue, 14 Feb 2023 09:38:08 -0800 Subject: [PATCH 09/63] Add foa-based node containers to compile_map tests --- test/unordered/compile_map.cpp | 280 +++++++++++++++++---------------- 1 file changed, 144 insertions(+), 136 deletions(-) diff --git a/test/unordered/compile_map.cpp b/test/unordered/compile_map.cpp index c4c8d7ce..b929ced8 100644 --- a/test/unordered/compile_map.cpp +++ b/test/unordered/compile_map.cpp @@ -1,6 +1,6 @@ // Copyright 2006-2009 Daniel James. -// Copyright 2022 Christian Mazakas. +// Copyright 2022-2023 Christian Mazakas. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -35,6 +35,22 @@ template class instantiate_flat_map, test::minimal::allocator >; +template +class instantiate_node_map +{ + typedef boost::unordered_node_map container; + container x; +}; + +template class instantiate_node_map, + std::equal_to, test::minimal::allocator >; + +template class instantiate_node_map, + test::minimal::equal_to, + test::minimal::allocator >; + #else #define INSTANTIATE(type) \ template class boost::unordered::detail::instantiate_##type @@ -55,149 +71,101 @@ INSTANTIATE(multimap) >; #endif -UNORDERED_AUTO_TEST (test0) { +template