1 /*=============================================================================
2 Copyright (c) 2004 Angus Leeming
3 Copyright (c) 2017 Kohei Takahashi
5 Distributed under the Boost Software License, Version 1.0. (See accompanying
6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #if !defined(CONTAINER_TESTS_HPP)
9 #define CONTAINER_TESTS_HPP
11 #include <boost/detail/lightweight_test.hpp>
12 #include <boost/phoenix/core.hpp>
13 #include <boost/phoenix/stl/container/container.hpp>
23 #ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
24 #include <unordered_map>
26 #ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
27 #include <unordered_set>
31 #pragma warning(disable : 4800)
35 namespace phx = boost::phoenix;
37 template <typename T> inline T const build_assoc();
39 std::deque<int> const build_deque();
40 std::list<int> const build_list();
41 std::map<int, int> const build_map();
42 std::multimap<int, int> const build_multimap();
43 std::vector<int> const build_vector();
44 std::set<int> const build_set();
45 std::multiset<int> const build_multiset();
46 template <> inline std::map<int, int> const build_assoc() { return build_map(); }
47 template <> inline std::multimap<int, int> const build_assoc() { return build_multimap(); }
48 template <> inline std::set<int> const build_assoc() { return build_set(); }
49 template <> inline std::multiset<int> const build_assoc() { return build_multiset(); }
50 #ifndef BOOST_NO_CXX11_HDR_UNORDERED_MAP
51 std::unordered_map<int, int> const build_unordered_map();
52 std::unordered_multimap<int, int> const build_unordered_multimap();
53 template <> inline std::unordered_map<int, int> const build_assoc() { return build_unordered_map(); }
54 template <> inline std::unordered_multimap<int, int> const build_assoc() { return build_unordered_multimap(); }
56 #ifndef BOOST_NO_CXX11_HDR_UNORDERED_SET
57 std::unordered_set<int> const build_unordered_set();
58 std::unordered_multiset<int> const build_unordered_multiset();
59 template <> inline std::unordered_set<int> const build_assoc() { return build_unordered_set(); }
60 template <> inline std::unordered_multiset<int> const build_assoc() { return build_unordered_multiset(); }
70 template <typename Container>
71 void test_assign(Container c)
73 using phx::arg_names::arg1;
75 typename Container::size_type count = 2;
76 typename Container::const_iterator first = c.begin();
77 typename Container::const_iterator second = first;
78 typename Container::value_type value = *first;
80 phx::assign(arg1, count, value)(c);
82 // iterators may be invalidated!
86 std::advance(second, 1);
87 if (test(*first != *second)) {
88 cerr << "Failed " << typeid(Container).name() << " test_assign 1\n";
91 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
92 // Should not --- does not, Yay! --- compile.
93 Container const const_c = c;
94 phx::assign(const_c, count, value);
98 template <typename Container>
99 void test_assign2(Container c)
101 using phx::arg_names::arg1;
102 using phx::arg_names::arg2;
103 using phx::arg_names::arg3;
106 typename Container::const_iterator first = c2.begin();
107 typename Container::const_iterator last = c2.end();
108 typename Container::size_type size = c2.size();
111 phx::assign(arg1, arg2, arg3)(c, first, last);
112 if (test(c.size() != size)) {
113 cerr << "Failed " << typeid(Container).name()
114 << " test_assign2 1\n"
115 << "size == " << c.size() << '\n';
119 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
120 // Should not --- does not, Yay! --- compile.
121 Container const const_c = c;
122 phx::assign(const_c, first, second);
126 template <typename Container>
127 void test_at(Container c)
129 using phx::arg_names::arg1;
132 typename Container::reference r1 = at(arg1, 0)(c);
133 if (test(r1 != c.at(0))) {
134 cerr << "Failed " << typeid(Container).name() << " test_at 1\n";
138 typename Container::const_reference r2 = at(arg1, 0)(c);
139 if (test(r2 != c.at(0))) {
140 cerr << "Failed " << typeid(Container).name() << " test_at 2\n";
144 Container const const_c = c;
145 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
146 // Should not --- does not, Yay! --- compile.
147 typename Container::reference r3 = at(arg1, 0)(const_c);
150 typename Container::const_reference r4 = at(arg1, 0)(const_c);
151 if (test(r4 != c.at(0))) {
152 cerr << "Failed " << typeid(Container).name() << " test_at 4\n";
157 template <typename Container>
158 void test_back(Container c)
160 using phx::arg_names::arg1;
163 typename Container::reference r1 = back(arg1)(c);
164 if (test(r1 != c.back())) {
165 cerr << "Failed " << typeid(Container).name() << " test_back 1\n";
168 typename Container::const_reference r2 = back(arg1)(c);
169 if (test(r2 != c.back())) {
170 cerr << "Failed " << typeid(Container).name() << " test_back 2\n";
174 Container const const_c = c;
175 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
176 // Should not --- does not, Yay! --- compile.
177 typename Container::reference r3 = back(arg1)(const_c);
180 typename Container::const_reference r4 = back(arg1)(const_c);
181 if (test(r4 != c.back())) {
182 cerr << "Failed " << typeid(Container).name() << " test_back 4\n";
187 template <typename Container>
188 void test_begin(Container c)
190 using phx::arg_names::arg1;
193 typename Container::iterator it1 = begin(arg1)(c);
194 if (test(it1 != c.begin())) {
195 cerr << "Failed " << typeid(Container).name() << " test_begin 1\n";
198 typename Container::const_iterator it2 = begin(arg1)(c);
199 if (test(it2 != c.begin())) {
200 cerr << "Failed " << typeid(Container).name() << " test_begin 2\n";
204 Container const const_c = c;
205 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
206 // Should not --- does not, Yay! --- compile.
207 typename Container::iterator it3 = begin(arg1)(const_c);
210 typename Container::const_iterator it4 = begin(arg1)(const_c);
211 if (test(it4 != const_c.begin())) {
212 cerr << "Failed " << typeid(Container).name() << " test_begin 4\n";
217 template <typename Container>
218 void test_capacity(Container c)
220 using phx::arg_names::arg1;
223 typename Container::size_type s1 = capacity(arg1)(c);
224 if (test(s1 != c.capacity())) {
225 cerr << "Failed " << typeid(Container).name() << " test_capacity 1\n";
229 Container const const_c = c;
230 typename Container::size_type s2 = capacity(arg1)(const_c);
231 if (test(s2 != const_c.capacity())) {
232 cerr << "Failed " << typeid(Container).name() << " test_capacity 2\n";
237 template <typename Container>
238 void test_clear(Container c)
240 using phx::arg_names::arg1;
244 if (test(!c.empty())) {
245 cerr << "Failed " << typeid(Container).name() << " test_clear 1\n";
249 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
250 Container const const_c = c;
251 clear(arg1)(const_c);
255 template <typename Container>
256 void test_empty(Container c)
258 using phx::arg_names::arg1;
261 typename Container::size_type s1 = empty(arg1)(c);
262 if (test(bool(s1) != c.empty())) {
263 cerr << "Failed " << typeid(Container).name() << " test_empty 1\n";
267 Container const const_c = c;
268 typename Container::size_type s2 = empty(arg1)(const_c);
269 if (test(bool(s2) != const_c.empty())) {
270 cerr << "Failed " << typeid(Container).name() << " test_empty 2\n";
275 template <typename Container>
276 void test_end(Container c)
278 using phx::arg_names::arg1;
281 typename Container::iterator it1 = end(arg1)(c);
282 if (test(it1 != c.end())) {
283 cerr << "Failed " << typeid(Container).name() << " test_end 1\n";
286 typename Container::const_iterator it2 = end(arg1)(c);
287 if (test(it2 != c.end())) {
288 cerr << "Failed " << typeid(Container).name() << " test_end 2\n";
292 Container const const_c = c;
293 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
294 // Should not --- does not, Yay! --- compile.
295 typename Container::iterator it3 = end(arg1)(const_c);
298 typename Container::const_iterator it4 = end(arg1)(const_c);
299 if (test(it4 != const_c.end())) {
300 cerr << "Failed " << typeid(Container).name() << " test_end 4\n";
305 template <typename Container>
306 void test_erase(Container c)
308 using phx::arg_names::arg1;
309 using phx::arg_names::arg2;
310 using phx::arg_names::arg3;
313 Container const const_c = c;
315 typename Container::size_type size = c.size();
316 typename Container::iterator c_begin = c.begin();
317 erase(arg1, arg2)(c, c_begin);
318 if (test(c.size() + 1 != size)) {
319 cerr << "Failed " << typeid(Container).name() << " test_erase 1\n";
324 typename Container::iterator c_end = c.end();
325 erase(arg1, arg2, arg3)(c, c_begin, c_end);
326 if (test(!c.empty())) {
327 cerr << "Failed " << typeid(Container).name() << " test_erase 2\n";
331 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
332 erase(arg1, const_c.begin())(const_c);
333 erase(arg1, const_c.begin(), const_c.end())(const_c);
337 template <typename Container>
338 void test_map_erase(Container c)
341 if (boost::report_errors() != 0)
344 using phx::arg_names::arg1;
345 using phx::arg_names::arg2;
348 typename Container::value_type const value = *c.begin();
349 typename Container::key_type const key = value.first;
350 typename Container::size_type const removed =
351 erase(arg1, arg2)(c, key);
352 if (test(removed != 1)) {
353 cerr << "Failed " << typeid(Container).name() << " test_map_erase 1\n";
358 template <typename Container>
359 void test_set_erase(Container c)
362 if (boost::report_errors() != 0)
365 using phx::arg_names::arg1;
366 using phx::arg_names::arg2;
369 typename Container::value_type const value = *c.begin();
370 typename Container::key_type const key = value;
371 typename Container::size_type const removed =
372 erase(arg1, arg2)(c, key);
373 if (test(removed != 1)) {
374 cerr << "Failed " << typeid(Container).name() << " test_set_erase 1\n";
379 template <typename Container>
380 void test_front(Container c)
382 using phx::arg_names::arg1;
385 typename Container::reference r1 = front(arg1)(c);
386 if (test(r1 != c.front())) {
387 cerr << "Failed " << typeid(Container).name() << " test_front 1\n";
390 typename Container::const_reference r2 = front(arg1)(c);
391 if (test(r2 != c.front())) {
392 cerr << "Failed " << typeid(Container).name() << " test_front 2\n";
396 Container const const_c = c;
397 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
398 // Should not --- does not, Yay! --- compile.
399 typename Container::reference r3 = front(arg1)(const_c);
402 typename Container::const_reference r4 = front(arg1)(const_c);
403 if (test(r4 != c.front())) {
404 cerr << "Failed " << typeid(Container).name() << " test_front 4\n";
409 template <typename Container>
410 void test_get_allocator(Container c)
412 using phx::arg_names::arg1;
413 using phx::get_allocator;
415 Container const const_c = c;
417 typename Container::allocator_type a1 = get_allocator(arg1)(c);
418 if (test(a1 != c.get_allocator())) {
419 cerr << "Failed " << typeid(Container).name() << " test_get_allocator 1\n";
423 typename Container::allocator_type a2 = get_allocator(arg1)(const_c);
424 if (test(a2 != const_c.get_allocator())) {
425 cerr << "Failed " << typeid(Container).name() << " test_get_allocator 2\n";
430 template <typename Container>
431 void test_insert(Container c)
433 using phx::arg_names::arg1;
436 typename Container::value_type const value = *c.begin();
437 typename Container::iterator it = insert(arg1, c.begin(), value)(c);
438 if (test(it != c.begin() || *it != *(++it))) {
439 cerr << "Failed " << typeid(Container).name() << " test_insert 1\n";
443 typename Container::size_type size = c.size();
444 insert(arg1, c.begin(), 3, value)(c);
445 if (test(c.size() != size + 3)) {
446 cerr << "Failed " << typeid(Container).name() << " test_insert 2\n";
450 Container const const_c = c;
452 insert(arg1, c.begin(), const_c.begin(), const_c.end())(c);
453 if (test(c.size() != 2 * size)) {
454 cerr << "Failed " << typeid(Container).name() << " test_insert 3\n";
459 template <typename Map>
460 inline void test_map_insert(Map c)
462 using phx::arg_names::arg1;
463 using phx::arg_names::arg2;
464 using phx::arg_names::arg3;
466 typename Map::value_type const value = *c.begin();
467 typename Map::iterator c_begin = c.begin();
469 // iterator insert(iterator where, const value_type& val);
470 typename Map::iterator it =
471 phx::insert(arg1, arg2, arg3)(c, c_begin, value);
473 if (test(it != c.begin() /*|| *it != *(++it)*/)) {
474 cerr << "Failed " << typeid(Map).name() << " test_map_insert 1\n";
479 // pair<iterator, bool> insert(const value_type& val);
480 typename Map::value_type const value2(1400, 2200);
481 std::pair<typename Map::iterator, bool> result =
482 phx::insert(arg1, arg2)(c, value2);
483 if (test(!result.second)) {
484 cerr << "Failed " << typeid(Map).name() << " test_map_insert 2\n";
489 // template<class InIt>
490 // void insert(InIt first, InIt last);
491 Map const const_c = build_assoc<Map>();
492 typename Map::size_type size = c.size();
493 phx::insert(arg1, const_c.begin(), const_c.end())(c);
494 if (test(c.size() != size + const_c.size())) {
495 cerr << "Failed " << typeid(Map).name() << " test_map_insert 3\n";
500 template <typename Multimap>
501 inline void test_multimap_insert(Multimap c)
503 using phx::arg_names::arg1;
504 using phx::arg_names::arg2;
505 using phx::arg_names::arg3;
507 typename Multimap::value_type const value = *c.begin();
508 typename Multimap::iterator c_begin = c.begin();
509 std::size_t old_size = c.size();
511 // iterator insert(iterator where, const value_type& val);
512 typename Multimap::iterator it =
513 phx::insert(arg1, arg2, arg3)(c, c_begin, value);
515 if (test(*it != value || c.size() != old_size + 1)) {
516 cerr << "Failed " << typeid(Multimap).name()
517 << " test_multimap_insert 1\n";
522 // iterator insert(const value_type& val);
523 typename Multimap::value_type const value2(1400, 2200);
524 it = phx::insert(arg1, arg2)(c, value2);
525 if (test(it == c.end())) {
526 cerr << "Failed " << typeid(Multimap).name()
527 << " test_multimap_insert 2\n";
532 // template<class InIt>
533 // void insert(InIt first, InIt last);
534 Multimap const const_c = build_assoc<Multimap>();
535 typename Multimap::size_type size = c.size();
536 phx::insert(arg1, const_c.begin(), const_c.end())(c);
537 if (test(c.size() != size + const_c.size())) {
538 cerr << "Failed " << typeid(Multimap).name()
539 << " test_multimap_insert 3\n";
544 template <typename Set>
545 inline void test_set_insert(Set c)
547 using phx::arg_names::arg1;
548 using phx::arg_names::arg2;
549 using phx::arg_names::arg3;
551 typename Set::value_type const value = *c.begin();
552 typename Set::iterator c_begin = c.begin();
554 // iterator insert(iterator where, const value_type& val);
555 typename Set::iterator it =
556 phx::insert(arg1, arg2, arg3)(c, c_begin, value);
558 if (test(it != c.begin() /*|| *it != *(++it)*/)) {
559 cerr << "Failed " << typeid(Set).name() << " test_set_insert 1\n";
564 // pair<iterator, bool> insert(const value_type& val);
565 typename Set::value_type const value2(1400);
566 std::pair<typename Set::iterator, bool> result =
567 phx::insert(arg1, arg2)(c, value2);
568 if (test(!result.second)) {
569 cerr << "Failed " << typeid(Set).name() << " test_set_insert 2\n";
574 // template<class InIt>
575 // void insert(InIt first, InIt last);
576 Set const const_c = build_assoc<Set>();
577 typename Set::size_type size = c.size();
578 phx::insert(arg1, const_c.begin(), const_c.end())(c);
579 if (test(c.size() != size + const_c.size())) {
580 cerr << "Failed " << typeid(Set).name() << " test_set_insert 3\n";
585 template <typename Multiset>
586 inline void test_multiset_insert(Multiset c)
588 using phx::arg_names::arg1;
589 using phx::arg_names::arg2;
590 using phx::arg_names::arg3;
592 typename Multiset::value_type const value = *c.begin();
593 typename Multiset::iterator c_begin = c.begin();
594 std::size_t old_size = c.size();
596 // iterator insert(iterator where, const value_type& val);
597 typename Multiset::iterator it =
598 phx::insert(arg1, arg2, arg3)(c, c_begin, value);
600 if (test(*it != value || c.size() != old_size + 1)) {
601 cerr << "Failed " << typeid(Multiset).name()
602 << " test_multiset_insert 1\n";
607 // iterator insert(const value_type& val);
608 typename Multiset::value_type const value2(1400);
609 it = phx::insert(arg1, arg2)(c, value2);
610 if (test(it == c.end())) {
611 cerr << "Failed " << typeid(Multiset).name()
612 << " test_multiset_insert 2\n";
617 // template<class InIt>
618 // void insert(InIt first, InIt last);
619 Multiset const const_c = build_assoc<Multiset>();
620 typename Multiset::size_type size = c.size();
621 phx::insert(arg1, const_c.begin(), const_c.end())(c);
622 if (test(c.size() != size + const_c.size())) {
623 cerr << "Failed " << typeid(Multiset).name()
624 << " test_multiset_insert 3\n";
629 template <typename Container>
630 void test_key_comp(Container c)
632 using phx::arg_names::arg1;
635 typename Container::key_compare comp = key_comp(arg1)(c);
637 Container const const_c = c;
638 comp = key_comp(arg1)(const_c);
641 template <typename Container>
642 void test_max_size(Container c)
644 using phx::arg_names::arg1;
647 Container const const_c = c;
649 typename Container::size_type s1 = max_size(arg1)(c);
650 if (test(s1 != c.max_size())) {
651 cerr << "Failed " << typeid(Container).name() << " test_max_size 1\n";
655 typename Container::size_type s2 = max_size(arg1)(const_c);
656 if (test(s2 != const_c.max_size())) {
657 cerr << "Failed " << typeid(Container).name() << " test_max_size 2\n";
662 template <typename Container>
663 void test_pop_back(Container c)
665 using phx::arg_names::arg1;
668 Container const const_c = c;
670 typename Container::size_type size = c.size();
673 if (test(c.size() + 1 != size)) {
674 cerr << "Failed " << typeid(Container).name() << " test_pop_back 1\n";
678 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
679 pop_back(arg1)(const_c);
683 template <typename Container>
684 void test_pop_front(Container c)
686 using phx::arg_names::arg1;
687 using phx::pop_front;
689 Container const const_c = c;
691 typename Container::size_type size = c.size();
694 if (test(c.size() + 1 != size)) {
695 cerr << "Failed " << typeid(Container).name() << " test_pop_front 1\n";
698 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
699 pop_front(arg1)(const_c);
703 template <typename Container>
704 void test_push_back(Container c)
706 using phx::arg_names::arg1;
707 using phx::arg_names::arg2;
708 using phx::push_back;
710 Container const const_c = c;
712 typename Container::value_type data = *c.begin();
713 typename Container::size_type size = c.size();
714 push_back(arg1, arg2)(c, data);
715 if (test(c.size() != size + 1)) {
716 cerr << "Failed " << typeid(Container).name() << " test_push_back 1\n";
719 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
720 push_back(arg1, arg2)(const_c, data);
724 template <typename Container>
725 void test_push_front(Container c)
727 using phx::arg_names::arg1;
728 using phx::arg_names::arg2;
729 using phx::push_front;
731 Container const const_c = c;
733 typename Container::value_type data = *c.begin();
734 typename Container::size_type size = c.size();
735 push_front(arg1, arg2)(c, data);
736 if (test(c.size() != size + 1)) {
737 cerr << "Failed " << typeid(Container).name() << " test_push_front 1\n";
740 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
741 push_front(arg1, arg2)(const_c, data);
745 template <typename Container>
746 void test_rbegin(Container c)
748 using phx::arg_names::arg1;
751 typename Container::reverse_iterator it1 = rbegin(arg1)(c);
752 typename Container::reverse_iterator it1_test = c.rbegin();
753 if (test(it1 != it1_test)) {
754 cerr << "Failed " << typeid(Container).name() << " test_rbegin 1\n";
757 typename Container::const_reverse_iterator it2 = rbegin(arg1)(c);
758 typename Container::const_reverse_iterator it2_test = c.rbegin();
759 if (test(it2 != it2_test)) {
760 cerr << "Failed " << typeid(Container).name() << " test_rbegin 2\n";
764 Container const const_c = c;
765 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
766 // Should not --- does not, Yay! --- compile.
767 typename Container::reverse_iterator it3 = rbegin(arg1)(const_c);
770 typename Container::const_reverse_iterator it4 = rbegin(arg1)(const_c);
771 it2_test = const_c.rbegin();
772 if (test(it4 != it2_test)) {
773 cerr << "Failed " << typeid(Container).name() << " test_rbegin 4\n";
778 template <typename Container>
779 void test_rend(Container c)
781 using phx::arg_names::arg1;
784 typename Container::reverse_iterator it1 = rend(arg1)(c);
785 typename Container::reverse_iterator it1_test = c.rend();
786 if (test(it1 != it1_test)) {
787 cerr << "Failed " << typeid(Container).name() << " test_rend 1\n";
790 typename Container::const_reverse_iterator it2 = rend(arg1)(c);
791 typename Container::const_reverse_iterator it2_test = c.rend();
792 if (test(it2 != it2_test)) {
793 cerr << "Failed " << typeid(Container).name() << " test_rend 2\n";
797 Container const const_c = c;
798 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
799 // Should not --- does not, Yay! --- compile.
800 typename Container::reverse_iterator it3 = rend(arg1)(const_c);
803 typename Container::const_reverse_iterator it4 = rend(arg1)(const_c);
804 it2_test = const_c.rend();
805 if (test(it4 != it2_test)) {
806 cerr << "Failed " << typeid(Container).name() << " test_rend 4\n";
811 template <typename Container>
812 void test_reserve(Container c)
814 using phx::arg_names::arg1;
817 Container const const_c = c;
819 typename Container::size_type count = 2 * c.size();
820 reserve(arg1, count)(c);
821 if (test(c.capacity() < count)) {
822 cerr << "Failed " << typeid(Container).name() << " test_reserve 1\n";
825 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
826 reserve(arg1, count)(const_c)(const_c);
830 template <typename Container>
831 void test_resize(Container c)
833 using phx::arg_names::arg1;
836 Container const const_c = c;
838 typename Container::size_type new_size = 2 * c.size();
839 resize(arg1, new_size)(c);
840 if (test(c.size() != new_size)) {
841 cerr << "Failed " << typeid(Container).name() << " test_resize 1\n";
845 new_size = 2 * c.size();
846 typename Container::value_type value = *c.begin();
847 resize(arg1, new_size, value)(c);
848 if (test(c.size() != new_size)) {
849 cerr << "Failed " << typeid(Container).name() << " test_resize 2\n";
852 #if defined(BOOST_PHOENIX_COMPILE_FAIL_TEST)
853 new_size = 2 * const_c.size();
854 resize(arg1, new_size)(const_c);
856 new_size = 2 * const_c.size();
857 resize(arg1, new_size, value)(const_c);
861 template <typename Container>
862 void test_size(Container c)
864 using phx::arg_names::arg1;
867 Container const const_c = c;
869 typename Container::size_type s1 = size(arg1)(c);
870 if (test(s1 != c.size())) {
871 cerr << "Failed " << typeid(Container).name() << " test_size 1\n";
875 typename Container::size_type s2 = size(arg1)(const_c);
876 if (test(s2 != const_c.size())) {
877 cerr << "Failed " << typeid(Container).name() << " test_size 2\n";
882 template <typename Container>
883 void test_splice(Container c)
885 using phx::arg_names::arg1;
886 using phx::arg_names::arg2;
887 using phx::arg_names::arg3;
888 using phx::arg_names::arg4;
889 using phx::arg_names::arg5;
892 typename Container::iterator c_end;
893 typename Container::iterator c2_begin;
894 typename Container::iterator c2_end;
895 typename Container::size_type size = c.size();
897 Container const copy = c;
898 Container const copy2 = build_list();
899 Container c2 = copy2;
903 splice(arg1, arg2, arg3)(c, c_end, c2);
904 if (test(c.size() != 2 * size)) {
905 cerr << "Failed " << typeid(Container).name() << " test_splice 1\n";
912 c2_begin = c2.begin();
914 splice(arg1, arg2, arg3, arg4)(c, c_end, c2, c2_begin);
915 if (test(c.size() != size)) {
916 cerr << "Failed " << typeid(Container).name() << " test_splice 2\n";
923 c2_begin = c2.begin();
925 size = c.size() + c2.size();
927 splice(arg1, arg2, arg3, arg4, arg5)(c, c_end, c2, c2_begin, c2_end);
928 if (test(c.size() != size)) {
929 cerr << "Failed " << typeid(Container).name() << " test_splice 3\n";
935 template <typename Container>
936 void test_value_comp(Container c)
938 using phx::arg_names::arg1;
939 using phx::value_comp;
941 typename Container::value_compare comp = value_comp(arg1)(c);
943 Container const const_c = c;
944 comp = value_comp(arg1)(const_c);