|
1 | 1 | // Copyright (C) 2023 Christian Mazakas |
2 | | -// Copyright (C) 2023-2024 Joaquin M Lopez Munoz |
| 2 | +// Copyright (C) 2023-2026 Joaquin M Lopez Munoz |
3 | 3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
4 | 4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
5 | 5 |
|
@@ -148,12 +148,18 @@ namespace { |
148 | 148 | values2.push_back(raii_convertible(v)); |
149 | 149 | } |
150 | 150 |
|
151 | | - thread_runner(values2, [&x](boost::span<raii_convertible> s) { |
152 | | - BOOST_TEST_EQ(x.insert(s.begin(), s.end()), s.size()); |
| 151 | + auto sz = x.size(); |
| 152 | + std::atomic<std::uint64_t> num_inserts{0}; |
| 153 | + std::atomic<std::uint64_t> num_attempted_inserts{0}; |
| 154 | + thread_runner(values2, [&x, &num_inserts, &num_attempted_inserts](boost::span<raii_convertible> s) { |
| 155 | + num_inserts += x.insert(s.begin(), s.begin() + s.size() / 2); |
| 156 | + num_inserts += x.insert(s.begin(), s.end()); |
| 157 | + num_attempted_inserts += s.size() + s.size() / 2; |
153 | 158 | }); |
| 159 | + BOOST_TEST_EQ(x.size(), sz + num_inserts); |
154 | 160 |
|
155 | 161 | BOOST_TEST_EQ( |
156 | | - raii::default_constructor, value_type_cardinality * values2.size()); |
| 162 | + raii::default_constructor, value_type_cardinality * num_attempted_inserts); |
157 | 163 | #if BOOST_WORKAROUND(BOOST_GCC_VERSION, >= 50300) && \ |
158 | 164 | BOOST_WORKAROUND(BOOST_GCC_VERSION, < 50500) |
159 | 165 | // some versions of old gcc have trouble eliding copies here |
@@ -1010,9 +1016,11 @@ namespace { |
1010 | 1016 | { |
1011 | 1017 | X x; |
1012 | 1018 |
|
1013 | | - thread_runner(dummy, [&x, &init_list](boost::span<raii>) { |
1014 | | - BOOST_TEST_EQ(x.insert(init_list), init_list.size()); |
| 1019 | + std::atomic<std::uint64_t> num_inserts{0}; |
| 1020 | + thread_runner(dummy, [&x, &init_list, &num_inserts](boost::span<raii>) { |
| 1021 | + num_inserts += x.insert(init_list); |
1015 | 1022 | }); |
| 1023 | + BOOST_TEST_EQ(num_inserts, x.size()); |
1016 | 1024 |
|
1017 | 1025 | BOOST_TEST_EQ(x.size(), reference_cont.size()); |
1018 | 1026 |
|
|
0 commit comments