1 // Boost.Container static_vector
4 // Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
5 // Copyright (c) 2012-2013 Andrew Hundt.
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10 #include <boost/container/detail/config_begin.hpp>
11 #include <boost/core/lightweight_test.hpp>
12 #include <boost/core/no_exceptions_support.hpp>
17 #include <boost/container/vector.hpp>
18 #include <boost/container/stable_vector.hpp>
20 #include "static_vector_test.hpp"
25 //Explicit instantiation to detect compilation errors
26 template class boost::container::static_vector<int, 10>;
31 template <typename T, size_t N>
34 static_vector<T, N> s;
35 BOOST_TEST_EQ(s.size() , 0u);
36 BOOST_TEST(s.capacity() == N);
37 BOOST_TEST_THROWS( s.at(0u), std::out_of_range );
40 template <typename T, size_t N>
41 void test_ctor_nc(size_t n)
43 static_vector<T, N> s(n);
44 BOOST_TEST(s.size() == n);
45 BOOST_TEST(s.capacity() == N);
46 BOOST_TEST_THROWS( s.at(n), std::out_of_range );
51 BOOST_TEST(T(10) == s[0]);
52 BOOST_TEST(T(10) == s.at(0));
55 BOOST_TEST(T(20) == s[1]);
56 BOOST_TEST(T(20) == s.at(1));
60 template <typename T, size_t N>
61 void test_ctor_nd(size_t n, T const& v)
63 static_vector<T, N> s(n, v);
64 BOOST_TEST(s.size() == n);
65 BOOST_TEST(s.capacity() == N);
66 BOOST_TEST_THROWS( s.at(n), std::out_of_range );
69 BOOST_TEST(v == s[0]);
70 BOOST_TEST(v == s.at(0));
71 BOOST_TEST(v == s[1]);
72 BOOST_TEST(v == s.at(1));
74 BOOST_TEST(T(10) == s[0]);
75 BOOST_TEST(T(10) == s.at(0));
77 BOOST_TEST(T(20) == s[1]);
78 BOOST_TEST(T(20) == s.at(1));
82 void test_support_for_initializer_list()
84 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
86 static_vector<int, 2> sv = {10, 8};
87 BOOST_TEST(10 == sv[0]);
88 BOOST_TEST(8 == sv[1]);
90 typedef static_vector<int, 1> sv_cap_1;
91 BOOST_TEST_THROWS(sv_cap_1({1, 1}), std::bad_alloc);
95 static_vector<int, 2> sv;
97 BOOST_TEST(1 == sv[0]);
98 BOOST_TEST(2 == sv[1]);
100 BOOST_TEST_THROWS(sv.assign({1, 2, 3}), std::bad_alloc);
102 static_vector<int, 3> greaterThanSv = {1, 2, 3};
103 BOOST_TEST_THROWS(sv = greaterThanSv, std::bad_alloc);
107 static_vector<int, 2> sv;
108 sv.insert(sv.begin(), {99, 95});
109 BOOST_TEST(99 == sv[0]);
110 BOOST_TEST(95 == sv[1]);
112 BOOST_TEST_THROWS(sv.insert(sv.begin(), {101, 102, 103}), std::bad_alloc);
117 template <typename T, size_t N>
118 void test_resize_nc(size_t n)
120 static_vector<T, N> s;
123 BOOST_TEST(s.size() == n);
124 BOOST_TEST(s.capacity() == N);
125 BOOST_TEST_THROWS( s.at(n), std::out_of_range );
130 BOOST_TEST(T(10) == s[0]);
131 BOOST_TEST(T(10) == s.at(0));
134 BOOST_TEST(T(20) == s[1]);
135 BOOST_TEST(T(20) == s.at(1));
139 template <typename T, size_t N>
140 void test_resize_nd(size_t n, T const& v)
142 static_vector<T, N> s;
145 BOOST_TEST(s.size() == n);
146 BOOST_TEST(s.capacity() == N);
147 BOOST_TEST_THROWS( s.at(n), std::out_of_range );
150 BOOST_TEST(v == s[0]);
151 BOOST_TEST(v == s.at(0));
152 BOOST_TEST(v == s[1]);
153 BOOST_TEST(v == s.at(1));
155 BOOST_TEST(T(10) == s[0]);
156 BOOST_TEST(T(10) == s.at(0));
158 BOOST_TEST(T(20) == s[1]);
159 BOOST_TEST(T(20) == s.at(1));
163 template <typename T, size_t N>
164 void test_push_back_nd()
166 static_vector<T, N> s;
168 BOOST_TEST(s.size() == 0);
169 BOOST_TEST_THROWS( s.at(0), std::out_of_range );
171 for ( size_t i = 0 ; i < N ; ++i )
175 BOOST_TEST(s.size() == i + 1);
176 BOOST_TEST_THROWS( s.at(i + 1), std::out_of_range );
177 BOOST_TEST(T(i) == s.at(i));
178 BOOST_TEST(T(i) == s[i]);
179 BOOST_TEST(T(i) == s.back());
180 BOOST_TEST(T(0) == s.front());
181 BOOST_TEST(T(i) == *(s.data() + i));
185 template <typename T, size_t N>
186 void test_pop_back_nd()
188 static_vector<T, N> s;
190 for ( size_t i = 0 ; i < N ; ++i )
196 for ( size_t i = N ; i > 1 ; --i )
199 BOOST_TEST(s.size() == i - 1);
200 BOOST_TEST_THROWS( s.at(i - 1), std::out_of_range );
201 BOOST_TEST(T(i - 2) == s.at(i - 2));
202 BOOST_TEST(T(i - 2) == s[i - 2]);
203 BOOST_TEST(T(i - 2) == s.back());
204 BOOST_TEST(T(0) == s.front());
208 template <typename It1, typename It2>
209 void test_compare_ranges(It1 first1, It1 last1, It2 first2, It2 last2)
211 BOOST_TEST(std::distance(first1, last1) == std::distance(first2, last2));
212 for ( ; first1 != last1 && first2 != last2 ; ++first1, ++first2 )
213 BOOST_TEST(*first1 == *first2);
216 template <typename T, size_t N, typename C>
217 void test_copy_and_assign(C const& c)
220 static_vector<T, N> s(c.begin(), c.end());
221 BOOST_TEST(s.size() == c.size());
222 test_compare_ranges(s.begin(), s.end(), c.begin(), c.end());
225 static_vector<T, N> s;
226 BOOST_TEST(0 == s.size());
227 s.assign(c.begin(), c.end());
228 BOOST_TEST(s.size() == c.size());
229 test_compare_ranges(s.begin(), s.end(), c.begin(), c.end());
233 template <typename T, size_t N>
234 void test_copy_and_assign_nd(T const& val)
236 static_vector<T, N> s;
240 for ( size_t i = 0 ; i < N ; ++i )
249 static_vector<T, N> s1(s);
250 BOOST_TEST(s.size() == s1.size());
251 test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
255 static_vector<T, N> s1;
256 BOOST_TEST(0 == s1.size());
258 BOOST_TEST(s.size() == s1.size());
259 test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
262 // ctor(Iter, Iter) and assign(Iter, Iter)
263 test_copy_and_assign<T, N>(s);
264 test_copy_and_assign<T, N>(v);
265 test_copy_and_assign<T, N>(l);
269 static_vector<T, N> s1(s);
270 test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
271 std::vector<T> a(N, val);
273 test_compare_ranges(a.begin(), a.end(), s1.begin(), s1.end());
276 stable_vector<T> bsv(s.begin(), s.end());
277 vector<T> bv(s.begin(), s.end());
278 test_copy_and_assign<T, N>(bsv);
279 test_copy_and_assign<T, N>(bv);
282 template <typename T, size_t N>
283 void test_iterators_nd()
285 static_vector<T, N> s;
288 for ( size_t i = 0 ; i < N ; ++i )
294 test_compare_ranges(s.begin(), s.end(), v.begin(), v.end());
295 test_compare_ranges(s.rbegin(), s.rend(), v.rbegin(), v.rend());
297 s.assign(v.rbegin(), v.rend());
299 test_compare_ranges(s.begin(), s.end(), v.rbegin(), v.rend());
300 test_compare_ranges(s.rbegin(), s.rend(), v.begin(), v.end());
303 template <typename T, size_t N>
306 static_vector<T, N> s;
307 typedef typename static_vector<T, N>::iterator It;
309 for ( size_t i = 0 ; i < N ; ++i )
314 for ( size_t i = 0 ; i < N ; ++i )
316 static_vector<T, N> s1(s);
317 It it = s1.erase(s1.begin() + i);
318 BOOST_TEST(s1.begin() + i == it);
319 BOOST_TEST(s1.size() == N - 1);
320 for ( size_t j = 0 ; j < i ; ++j )
321 BOOST_TEST(s1[j] == T(j));
322 for ( size_t j = i+1 ; j < N ; ++j )
323 BOOST_TEST(s1[j-1] == T(j));
326 // erase(first, last)
329 for ( size_t i = 0 ; i <= N ; ++i )
331 static_vector<T, N> s1(s);
332 size_t removed = i + n < N ? n : N - i;
333 It it = s1.erase(s1.begin() + i, s1.begin() + i + removed);
334 BOOST_TEST(s1.begin() + i == it);
335 BOOST_TEST(s1.size() == N - removed);
336 for ( size_t j = 0 ; j < i ; ++j )
337 BOOST_TEST(s1[j] == T(j));
338 for ( size_t j = i+n ; j < N ; ++j )
339 BOOST_TEST(s1[j-n] == T(j));
344 template <typename T, size_t N, typename SV, typename C>
345 void test_insert(SV const& s, C const& c)
348 size_t n = size_t(h/1.5f);
350 for ( size_t i = 0 ; i <= h ; ++i )
352 static_vector<T, N> s1(s);
354 typename C::const_iterator it = c.begin();
356 typename static_vector<T, N>::iterator
357 it1 = s1.insert(s1.begin() + i, c.begin(), it);
359 BOOST_TEST(s1.begin() + i == it1);
360 BOOST_TEST(s1.size() == h+n);
361 for ( size_t j = 0 ; j < i ; ++j )
362 BOOST_TEST(s1[j] == T(j));
363 for ( size_t j = 0 ; j < n ; ++j )
364 BOOST_TEST(s1[j+i] == T(100 + j));
365 for ( size_t j = 0 ; j < h-i ; ++j )
366 BOOST_TEST(s1[j+i+n] == T(j+i));
370 template <typename T, size_t N>
371 void test_insert_nd(T const& val)
375 static_vector<T, N> s, ss;
379 typedef typename static_vector<T, N>::iterator It;
381 for ( size_t i = 0 ; i < h ; ++i )
384 ss.push_back(T(100 + i));
385 v.push_back(T(100 + i));
386 l.push_back(T(100 + i));
391 for ( size_t i = 0 ; i <= h ; ++i )
393 static_vector<T, N> s1(s);
394 It it = s1.insert(s1.begin() + i, val);
395 BOOST_TEST(s1.begin() + i == it);
396 BOOST_TEST(s1.size() == h+1);
397 for ( size_t j = 0 ; j < i ; ++j )
398 BOOST_TEST(s1[j] == T(j));
399 BOOST_TEST(s1[i] == val);
400 for ( size_t j = 0 ; j < h-i ; ++j )
401 BOOST_TEST(s1[j+i+1] == T(j+i));
404 // insert(pos, n, val)
406 size_t n = size_t(h/1.5f);
407 for ( size_t i = 0 ; i <= h ; ++i )
409 static_vector<T, N> s1(s);
410 It it = s1.insert(s1.begin() + i, n, val);
411 BOOST_TEST(s1.begin() + i == it);
412 BOOST_TEST(s1.size() == h+n);
413 for ( size_t j = 0 ; j < i ; ++j )
414 BOOST_TEST(s1[j] == T(j));
415 for ( size_t j = 0 ; j < n ; ++j )
416 BOOST_TEST(s1[j+i] == val);
417 for ( size_t j = 0 ; j < h-i ; ++j )
418 BOOST_TEST(s1[j+i+n] == T(j+i));
421 // insert(pos, first, last)
422 test_insert<T, N>(s, ss);
423 test_insert<T, N>(s, v);
424 test_insert<T, N>(s, l);
426 stable_vector<T> bsv(ss.begin(), ss.end());
427 vector<T> bv(ss.begin(), ss.end());
428 test_insert<T, N>(s, bv);
429 test_insert<T, N>(s, bsv);
432 template <typename T>
433 void test_capacity_0_nd()
435 static_vector<T, 10> v(5u, T(0));
437 static_vector<T, 0 > s;
438 BOOST_TEST(s.size() == 0);
439 BOOST_TEST(s.capacity() == 0);
440 BOOST_TEST_THROWS(s.at(0), std::out_of_range);
441 BOOST_TEST_THROWS(s.resize(5u, T(0)), std::bad_alloc);
442 BOOST_TEST_THROWS(s.push_back(T(0)), std::bad_alloc);
443 BOOST_TEST_THROWS(s.insert(s.end(), T(0)), std::bad_alloc);
444 BOOST_TEST_THROWS(s.insert(s.end(), 5u, T(0)), std::bad_alloc);
445 BOOST_TEST_THROWS(s.insert(s.end(), v.begin(), v.end()), std::bad_alloc);
446 BOOST_TEST_THROWS(s.assign(v.begin(), v.end()), std::bad_alloc);
447 BOOST_TEST_THROWS(s.assign(5u, T(0)), std::bad_alloc);
448 BOOST_TEST_THROWS(s.assign(5u, T(0)), std::bad_alloc);
449 typedef static_vector<T, 0> static_vector_0_t;
450 BOOST_TEST_THROWS(static_vector_0_t s2(v.begin(), v.end()), std::bad_alloc);
451 BOOST_TEST_THROWS(static_vector_0_t s1(5u, T(0)), std::bad_alloc);
454 template <typename T, size_t N>
455 void test_exceptions_nd()
457 static_vector<T, N> v(N, T(0));
458 static_vector<T, N/2> s(N/2, T(0));
460 BOOST_TEST_THROWS(s.resize(N, T(0)), std::bad_alloc);
461 BOOST_TEST_THROWS(s.push_back(T(0)), std::bad_alloc);
462 BOOST_TEST_THROWS(s.insert(s.end(), T(0)), std::bad_alloc);
463 BOOST_TEST_THROWS(s.insert(s.end(), N, T(0)), std::bad_alloc);
464 BOOST_TEST_THROWS(s.insert(s.end(), v.begin(), v.end()), std::bad_alloc);
465 BOOST_TEST_THROWS(s.assign(v.begin(), v.end()), std::bad_alloc);
466 BOOST_TEST_THROWS(s.assign(N, T(0)), std::bad_alloc);
467 typedef static_vector<T, N/2> static_vector_n_half_t;
468 BOOST_TEST_THROWS(static_vector_n_half_t s2(v.begin(), v.end()), std::bad_alloc);
469 BOOST_TEST_THROWS(static_vector_n_half_t s1(N, T(0)), std::bad_alloc);
472 template <typename T, size_t N>
473 void test_swap_and_move_nd()
476 static_vector<T, N> v1, v2, v3, v4;
477 static_vector<T, N> s1, s2;
478 static_vector<T, N> s4;
480 for (size_t i = 0 ; i < N ; ++i )
487 for (size_t i = 0 ; i < N/2 ; ++i )
489 s1.push_back(T(100 + i));
490 s2.push_back(T(100 + i));
491 s4.push_back(T(100 + i));
495 s2 = boost::move(v2);
496 static_vector<T, N> s3(boost::move(v3));
499 BOOST_TEST(v1.size() == N/2);
500 BOOST_TEST(s1.size() == N);
501 //iG moving does not imply emptying source
502 //BOOST_TEST(v2.size() == 0);
503 BOOST_TEST(s2.size() == N);
504 //iG moving does not imply emptying source
505 //BOOST_TEST(v3.size() == 0);
506 BOOST_TEST(s3.size() == N);
507 BOOST_TEST(v4.size() == N/2);
508 BOOST_TEST(s4.size() == N);
509 for (size_t i = 0 ; i < N/2 ; ++i )
511 BOOST_TEST(v1[i] == T(100 + i));
512 BOOST_TEST(v4[i] == T(100 + i));
514 for (size_t i = 0 ; i < N ; ++i )
516 BOOST_TEST(s1[i] == T(i));
517 BOOST_TEST(s2[i] == T(i));
518 BOOST_TEST(s3[i] == T(i));
519 BOOST_TEST(s4[i] == T(i));
523 static_vector<T, N> v1, v2, v3;
524 static_vector<T, N/2> s1, s2, s3;
526 for (size_t i = 0 ; i < N/2 ; ++i )
532 for (size_t i = 0 ; i < N/3 ; ++i )
534 s1.push_back(T(100 + i));
535 s2.push_back(T(100 + i));
540 s2 = boost::move(v2);
541 static_vector<T, N/2> s4(boost::move(v3));
543 BOOST_TEST(v1.size() == N/3);
544 BOOST_TEST(s1.size() == N/2);
545 //iG moving does not imply emptying source
546 //BOOST_TEST(v2.size() == 0);
547 BOOST_TEST(s2.size() == N/2);
548 BOOST_TEST(s3.size() == N/2);
549 //iG moving does not imply emptying source
550 //BOOST_TEST(v3.size() == 0);
551 BOOST_TEST(s4.size() == N/2);
552 for (size_t i = 0 ; i < N/3 ; ++i )
553 BOOST_TEST(v1[i] == T(100 + i));
554 for (size_t i = 0 ; i < N/2 ; ++i )
556 BOOST_TEST(s1[i] == T(i));
557 BOOST_TEST(s2[i] == T(i));
558 BOOST_TEST(s3[i] == T(i));
559 BOOST_TEST(s4[i] == T(i));
563 typedef static_vector<T, N/2> small_vector_t;
564 static_vector<T, N> v(N, T(0));
565 small_vector_t s(N/2, T(1));
566 BOOST_TEST_THROWS(s.swap(v), std::bad_alloc);
568 BOOST_TEST_THROWS(s = boost::move(v), std::bad_alloc);
569 BOOST_TEST_THROWS(s = v, std::bad_alloc);
571 BOOST_TEST_THROWS(small_vector_t s2(boost::move(v)), std::bad_alloc);
575 template <typename T, size_t N>
576 void test_emplace_0p()
580 static_vector<T, N> v;
582 for (int i = 0 ; i < int(N) ; ++i )
584 BOOST_TEST(v.size() == N);
585 BOOST_TEST_THROWS(v.emplace_back(), std::bad_alloc);
589 template <typename T, size_t N>
590 void test_emplace_2p()
592 //emplace_back(pos, int, int)
594 static_vector<T, N> v;
596 for (int i = 0 ; i < int(N) ; ++i )
597 v.emplace_back(i, 100 + i);
598 BOOST_TEST(v.size() == N);
599 BOOST_TEST_THROWS(v.emplace_back(N, 100 + N), std::bad_alloc);
600 BOOST_TEST(v.size() == N);
601 for (int i = 0 ; i < int(N) ; ++i )
602 BOOST_TEST(v[i] == T(i, 100 + i));
605 // emplace(pos, int, int)
607 typedef typename static_vector<T, N>::iterator It;
611 static_vector<T, N> v;
612 for ( int i = 0 ; i < h ; ++i )
613 v.emplace_back(i, 100 + i);
615 for ( int i = 0 ; i <= h ; ++i )
617 static_vector<T, N> vv(v);
618 It it = vv.emplace(vv.begin() + i, i+100, i+200);
619 BOOST_TEST(vv.begin() + i == it);
620 BOOST_TEST(vv.size() == size_t(h+1));
621 for ( int j = 0 ; j < i ; ++j )
622 BOOST_TEST(vv[j] == T(j, j+100));
623 BOOST_TEST(vv[i] == T(i+100, i+200));
624 for ( int j = 0 ; j < h-i ; ++j )
625 BOOST_TEST(vv[j+i+1] == T(j+i, j+i+100));
630 template <typename T, size_t N>
631 void test_sv_elem(T const& t)
633 typedef static_vector<T, N> V;
635 static_vector<V, N> v;
637 v.push_back(V(N/2, t));
639 v.push_back(boost::move(vvv));
640 v.insert(v.begin(), V(N/2, t));
641 v.insert(v.end(), V(N/2, t));
642 v.emplace_back(N/2, t);
645 bool default_init_test()//Test for default initialization
647 typedef static_vector<int, 100> di_vector_t;
649 const std::size_t Capacity = 100;
655 for(std::size_t i = 0; i != Capacity; ++i, ++p){
656 *p = static_cast<int>(i);
659 //Destroy the vector, p stilll pointing to the storage
662 di_vector_t &rv = *::new(&v)di_vector_t(Capacity, default_init);
663 di_vector_t::iterator it = rv.begin();
665 for(std::size_t i = 0; i != Capacity; ++i, ++it){
666 if(*it != static_cast<int>(i))
676 for(std::size_t i = 0; i != Capacity; ++i, ++p){
677 *p = static_cast<int>(i+100);
680 v.resize(Capacity, default_init);
682 di_vector_t::iterator it = v.begin();
683 for(std::size_t i = 0; i != Capacity; ++i, ++it){
684 if(*it != static_cast<int>(i+100))
693 int main(int, char* [])
695 using boost::container::test::movable_and_copyable_int;
696 using boost::container::test::produce_movable_and_copyable_int;
697 BOOST_TEST(counting_value::count() == 0);
699 test_ctor_ndc<int, 10>();
700 test_ctor_ndc<value_ndc, 10>();
701 test_ctor_ndc<counting_value, 10>();
702 BOOST_TEST(counting_value::count() == 0);
703 test_ctor_ndc<shptr_value, 10>();
704 test_ctor_ndc<movable_and_copyable_int, 10>();
706 test_ctor_nc<int, 10>(5);
707 test_ctor_nc<value_nc, 10>(5);
708 test_ctor_nc<counting_value, 10>(5);
709 BOOST_TEST(counting_value::count() == 0);
710 test_ctor_nc<shptr_value, 10>(5);
711 test_ctor_nc<movable_and_copyable_int, 10>(5);
713 test_ctor_nd<int, 10>(5, 1);
714 test_ctor_nd<value_nd, 10>(5, value_nd(1));
715 test_ctor_nd<counting_value, 10>(5, counting_value(1));
716 BOOST_TEST(counting_value::count() == 0);
717 test_ctor_nd<shptr_value, 10>(5, shptr_value(1));
718 test_ctor_nd<movable_and_copyable_int, 10>(5, produce_movable_and_copyable_int());
720 test_resize_nc<int, 10>(5);
721 test_resize_nc<value_nc, 10>(5);
722 test_resize_nc<counting_value, 10>(5);
723 BOOST_TEST(counting_value::count() == 0);
724 test_resize_nc<shptr_value, 10>(5);
725 test_resize_nc<movable_and_copyable_int, 10>(5);
727 test_resize_nd<int, 10>(5, 1);
728 test_resize_nd<value_nd, 10>(5, value_nd(1));
729 test_resize_nd<counting_value, 10>(5, counting_value(1));
730 BOOST_TEST(counting_value::count() == 0);
731 test_resize_nd<shptr_value, 10>(5, shptr_value(1));
732 test_resize_nd<movable_and_copyable_int, 10>(5, produce_movable_and_copyable_int());
734 test_push_back_nd<int, 10>();
735 test_push_back_nd<value_nd, 10>();
736 test_push_back_nd<counting_value, 10>();
737 BOOST_TEST(counting_value::count() == 0);
738 test_push_back_nd<shptr_value, 10>();
739 test_push_back_nd<movable_and_copyable_int, 10>();
741 test_pop_back_nd<int, 10>();
742 test_pop_back_nd<value_nd, 10>();
743 test_pop_back_nd<counting_value, 10>();
744 BOOST_TEST(counting_value::count() == 0);
745 test_pop_back_nd<shptr_value, 10>();
746 test_pop_back_nd<movable_and_copyable_int, 10>();
748 test_copy_and_assign_nd<int, 10>(1);
749 test_copy_and_assign_nd<value_nd, 10>(value_nd(1));
750 test_copy_and_assign_nd<counting_value, 10>(counting_value(1));
751 BOOST_TEST(counting_value::count() == 0);
752 test_copy_and_assign_nd<shptr_value, 10>(shptr_value(1));
753 test_copy_and_assign_nd<movable_and_copyable_int, 10>(produce_movable_and_copyable_int());
755 test_iterators_nd<int, 10>();
756 test_iterators_nd<value_nd, 10>();
757 test_iterators_nd<counting_value, 10>();
758 BOOST_TEST(counting_value::count() == 0);
759 test_iterators_nd<shptr_value, 10>();
760 test_iterators_nd<movable_and_copyable_int, 10>();
762 test_erase_nd<int, 10>();
763 test_erase_nd<value_nd, 10>();
764 test_erase_nd<counting_value, 10>();
765 BOOST_TEST(counting_value::count() == 0);
766 test_erase_nd<shptr_value, 10>();
767 test_erase_nd<movable_and_copyable_int, 10>();
769 test_insert_nd<int, 10>(50);
770 test_insert_nd<value_nd, 10>(value_nd(50));
771 test_insert_nd<counting_value, 10>(counting_value(50));
772 BOOST_TEST(counting_value::count() == 0);
773 test_insert_nd<shptr_value, 10>(shptr_value(50));
774 test_insert_nd<movable_and_copyable_int, 10>(produce_movable_and_copyable_int());
776 test_capacity_0_nd<int>();
777 test_capacity_0_nd<value_nd>();
778 test_capacity_0_nd<counting_value>();
779 BOOST_TEST(counting_value::count() == 0);
780 test_capacity_0_nd<shptr_value>();
781 test_capacity_0_nd<movable_and_copyable_int>();
783 test_exceptions_nd<int, 10>();
784 test_exceptions_nd<value_nd, 10>();
785 test_exceptions_nd<counting_value, 10>();
786 BOOST_TEST(counting_value::count() == 0);
787 test_exceptions_nd<shptr_value, 10>();
788 test_exceptions_nd<movable_and_copyable_int, 10>();
790 test_swap_and_move_nd<int, 10>();
791 test_swap_and_move_nd<value_nd, 10>();
792 test_swap_and_move_nd<counting_value, 10>();
793 BOOST_TEST(counting_value::count() == 0);
794 test_swap_and_move_nd<shptr_value, 10>();
795 test_swap_and_move_nd<movable_and_copyable_int, 10>();
797 test_emplace_0p<counting_value, 10>();
798 BOOST_TEST(counting_value::count() == 0);
800 test_emplace_2p<counting_value, 10>();
801 BOOST_TEST(counting_value::count() == 0);
803 test_sv_elem<int, 10>(50);
804 test_sv_elem<value_nd, 10>(value_nd(50));
805 test_sv_elem<counting_value, 10>(counting_value(50));
806 BOOST_TEST(counting_value::count() == 0);
807 test_sv_elem<shptr_value, 10>(shptr_value(50));
808 test_sv_elem<movable_and_copyable_int, 10>(movable_and_copyable_int(50));
810 BOOST_TEST(default_init_test() == true);
812 test_support_for_initializer_list();
814 return boost::report_errors();
817 #include <boost/container/detail/config_end.hpp>