diff --git a/test/deque_test.cpp b/test/deque_test.cpp index 6d5ed74..a90ef51 100644 --- a/test/deque_test.cpp +++ b/test/deque_test.cpp @@ -98,6 +98,10 @@ class recursive_deque { public: + recursive_deque (const recursive_deque &x) + : deque_(x.deque_) + {} + recursive_deque & operator=(const recursive_deque &x) { this->deque_ = x.deque_; return *this; } @@ -418,24 +422,20 @@ int main () typedef boost::container::deque cont; typedef cont::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; - if (boost::has_trivial_destructor_after_move::value != - boost::has_trivial_destructor_after_move::value && - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(default allocator) test failed" << std::endl; - return 1; - } + BOOST_STATIC_ASSERT_MSG(!(boost::has_trivial_destructor_after_move::value != + boost::has_trivial_destructor_after_move::value && + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(std::allocator) test failed"); } // std::allocator { typedef boost::container::deque > cont; typedef cont::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; - if (boost::has_trivial_destructor_after_move::value != - boost::has_trivial_destructor_after_move::value && - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(std::allocator) test failed" << std::endl; - return 1; - } + BOOST_STATIC_ASSERT_MSG(!(boost::has_trivial_destructor_after_move::value != + boost::has_trivial_destructor_after_move::value && + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(std::allocator) test failed"); } return 0; diff --git a/test/list_test.cpp b/test/list_test.cpp index 821f7b0..c4ec219 100644 --- a/test/list_test.cpp +++ b/test/list_test.cpp @@ -54,6 +54,10 @@ public: list::reverse_iterator rit_; list::const_reverse_iterator crit_; + recursive_list(const recursive_list &o) + : list_(o.list_) + {} + recursive_list &operator=(const recursive_list &o) { list_ = o.list_; return *this; } }; @@ -259,24 +263,22 @@ int main () typedef boost::container::list cont; typedef cont::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; - if (boost::has_trivial_destructor_after_move::value != + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != boost::has_trivial_destructor_after_move::value && - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(default allocator) test failed" << std::endl; - return 1; - } + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(default allocator) test failed"); } // std::allocator { typedef boost::container::list > cont; typedef cont::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; - if (boost::has_trivial_destructor_after_move::value != + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != boost::has_trivial_destructor_after_move::value && - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(std::allocator) test failed" << std::endl; - return 1; - } + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(std::allocator) test failed"); } return 0; diff --git a/test/map_test.cpp b/test/map_test.cpp index c36581b..67f893c 100644 --- a/test/map_test.cpp +++ b/test/map_test.cpp @@ -27,6 +27,13 @@ typedef std::pair cont; typedef boost::container::dtl::tree, void, void> tree; - if (boost::has_trivial_destructor_after_move::value != - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(map, default allocator) test failed" << std::endl; - return 1; - } + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(map, default allocator) test failed"); } // std::allocator { typedef boost::container::map, std::allocator > cont; typedef boost::container::dtl::tree, std::allocator, void> tree; - if (boost::has_trivial_destructor_after_move::value != - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(map, std::allocator) test failed" << std::endl; - return 1; - } + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(map, std::allocator) test failed"); } // // multimap @@ -668,21 +680,19 @@ int main () // default allocator typedef boost::container::multimap cont; typedef boost::container::dtl::tree, void, void> tree; - if (boost::has_trivial_destructor_after_move::value != - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(multimap, default allocator) test failed" << std::endl; - return 1; - } + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(multimap, default allocator) test failed"); } // std::allocator { typedef boost::container::multimap, std::allocator > cont; typedef boost::container::dtl::tree, std::allocator, void> tree; - if (boost::has_trivial_destructor_after_move::value != - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(multimap, std::allocator) test failed" << std::endl; - return 1; - } + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(multimap, std::allocator) test failed"); } } diff --git a/test/set_test.cpp b/test/set_test.cpp index a6d1f58..a9c9815 100644 --- a/test/set_test.cpp +++ b/test/set_test.cpp @@ -25,6 +25,13 @@ using namespace boost::container; class recursive_set { public: + recursive_set() + {} + + recursive_set(const recursive_set &x) + : set_(x.set_) + {} + recursive_set & operator=(const recursive_set &x) { id_ = x.id_; set_ = x.set_; return *this; } @@ -43,6 +50,13 @@ public: class recursive_multiset { public: + recursive_multiset() + {} + + recursive_multiset(const recursive_multiset &x) + : multiset_(x.multiset_) + {} + recursive_multiset & operator=(const recursive_multiset &x) { id_ = x.id_; multiset_ = x.multiset_; return *this; } @@ -611,41 +625,37 @@ int main () { typedef boost::container::set cont; typedef boost::container::dtl::tree, void, void> tree; - if (boost::has_trivial_destructor_after_move::value != - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(set, default allocator) test failed" << std::endl; - return 1; - } + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(set, default allocator) test failed"); } // set, std::allocator { typedef boost::container::set, std::allocator > cont; typedef boost::container::dtl::tree, std::allocator, void> tree; - if (boost::has_trivial_destructor_after_move::value != - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(set, std::allocator) test failed" << std::endl; - return 1; - } + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(set, std::allocator) test failed"); } // multiset, default allocator { typedef boost::container::multiset cont; typedef boost::container::dtl::tree, void, void> tree; - if (boost::has_trivial_destructor_after_move::value != - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(multiset, default allocator) test failed" << std::endl; - return 1; - } + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(multiset, default allocator) test failed"); } // multiset, std::allocator { typedef boost::container::multiset, std::allocator > cont; typedef boost::container::dtl::tree, std::allocator, void> tree; - if (boost::has_trivial_destructor_after_move::value != - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(multiset, std::allocator) test failed" << std::endl; - return 1; - } + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(multiset, std::allocator) test failed"); } return 0; diff --git a/test/slist_test.cpp b/test/slist_test.cpp index 8cc64bd..16fd8a0 100644 --- a/test/slist_test.cpp +++ b/test/slist_test.cpp @@ -30,6 +30,10 @@ public: recursive_slist &operator=(const recursive_slist &o) { slist_ = o.slist_; return *this; } + + recursive_slist (const recursive_slist &o) + : slist_(o.slist_) + {} }; void recursive_slist_test()//Test for recursive types @@ -262,24 +266,22 @@ int main () typedef boost::container::slist cont; typedef cont::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; - if (boost::has_trivial_destructor_after_move::value != + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != boost::has_trivial_destructor_after_move::value && - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(default allocator) test failed" << std::endl; - return 1; - } + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(default allocator) test failed"); } // std::allocator { typedef boost::container::slist > cont; typedef cont::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; - if (boost::has_trivial_destructor_after_move::value != + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != boost::has_trivial_destructor_after_move::value && - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(std::allocator) test failed" << std::endl; - return 1; - } + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(std::allocator) test failed"); } return 0; diff --git a/test/stable_vector_test.cpp b/test/stable_vector_test.cpp index 77a4aac..93b6ce7 100644 --- a/test/stable_vector_test.cpp +++ b/test/stable_vector_test.cpp @@ -35,6 +35,10 @@ class recursive_vector stable_vector::reverse_iterator rit_; stable_vector::const_reverse_iterator crit_; + recursive_vector (const recursive_vector &o) + : vector_(o.vector_) + {} + recursive_vector &operator=(const recursive_vector &o) { vector_ = o.vector_; return *this; } }; @@ -200,24 +204,22 @@ int main() typedef boost::container::stable_vector cont; typedef cont::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; - if (boost::has_trivial_destructor_after_move::value != + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != boost::has_trivial_destructor_after_move::value && - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(default allocator) test failed" << std::endl; - return 1; - } + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(default allocator) test failed"); } // std::allocator { typedef boost::container::stable_vector > cont; typedef cont::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; - if (boost::has_trivial_destructor_after_move::value != + BOOST_STATIC_ASSERT_MSG( + !(boost::has_trivial_destructor_after_move::value != boost::has_trivial_destructor_after_move::value && - boost::has_trivial_destructor_after_move::value) { - std::cerr << "has_trivial_destructor_after_move(std::allocator) test failed" << std::endl; - return 1; - } + boost::has_trivial_destructor_after_move::value) + , "has_trivial_destructor_after_move(std::allocator) test failed"); } return 0; diff --git a/test/static_vector_test.hpp b/test/static_vector_test.hpp index ab931b2..f279a01 100644 --- a/test/static_vector_test.hpp +++ b/test/static_vector_test.hpp @@ -48,11 +48,12 @@ class value_nc public: explicit value_nc(int a = 0) : aa(a) {} ~value_nc() {} + value_nc & operator=(int a){ aa = a; return *this; } bool operator==(value_nc const& v) const { return aa == v.aa; } bool operator<(value_nc const& v) const { return aa < v.aa; } private: value_nc(value_nc const&) {} - value_nc & operator=(value_ndc const&) { return *this; } + value_nc & operator=(value_nc const&) { return *this; } int aa; }; @@ -66,6 +67,7 @@ public: counting_value(BOOST_RV_REF(counting_value) p) : aa(p.aa), bb(p.bb) { p.aa = 0; p.bb = 0; ++c(); } // Move constructor counting_value& operator=(BOOST_RV_REF(counting_value) p) { aa = p.aa; p.aa = 0; bb = p.bb; p.bb = 0; return *this; } // Move assignment counting_value& operator=(BOOST_COPY_ASSIGN_REF(counting_value) p) { aa = p.aa; bb = p.bb; return *this; } // Copy assignment + counting_value& operator=(int a) { aa =a; return *this; } // Copy assignment ~counting_value() { --c(); } bool operator==(counting_value const& v) const { return aa == v.aa && bb == v.bb; } bool operator<(counting_value const& v) const { return aa < v.aa || ( aa == v.aa && bb < v.bb ); } @@ -94,6 +96,9 @@ class shptr_value typedef boost::shared_ptr Ptr; public: explicit shptr_value(int a = 0) : m_ptr(new int(a)) {} + shptr_value & operator=(int a) + { m_ptr.reset(new int(a)); return *this; } + bool operator==(shptr_value const& v) const { return *m_ptr == *(v.m_ptr); } bool operator<(shptr_value const& v) const { return *m_ptr < *(v.m_ptr); } private: diff --git a/test/vector_test.cpp b/test/vector_test.cpp index 398eaa3..136b471 100644 --- a/test/vector_test.cpp +++ b/test/vector_test.cpp @@ -82,6 +82,10 @@ bool test_smart_ref_type() class recursive_vector { public: + recursive_vector (const recursive_vector &x) + : vector_(x.vector_) + {} + recursive_vector & operator=(const recursive_vector &x) { this->vector_ = x.vector_; return *this; }