From 22f34b7b022d3487c07f4416829aabc6aa5eb74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 2 Jan 2021 16:24:56 +0100 Subject: [PATCH] Silence warnings in tests --- test/expand_bwd_test_template.hpp | 8 ++++---- test/string_test.cpp | 29 +++++++++++++++++------------ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/test/expand_bwd_test_template.hpp b/test/expand_bwd_test_template.hpp index 1c193ac..bc6f0a3 100644 --- a/test/expand_bwd_test_template.hpp +++ b/test/expand_bwd_test_template.hpp @@ -89,7 +89,7 @@ bool test_insert_with_expand_bwd() std::vector initial_data; initial_data.resize(InitialSize[iteration]); for(unsigned int i = 0; i < InitialSize[iteration]; ++i){ - initial_data[i] = i; + initial_data[i] = static_cast(i); } if(!life_count::check(InitialSize[iteration])) @@ -97,7 +97,7 @@ bool test_insert_with_expand_bwd() Vect data_to_insert; data_to_insert.resize(InsertSize[iteration]); for(unsigned int i = 0; i < InsertSize[iteration]; ++i){ - data_to_insert[i] = -i; + data_to_insert[i] = static_cast(-i); } if(!life_count::check(InitialSize[iteration]+InsertSize[iteration])) @@ -153,14 +153,14 @@ bool test_assign_with_expand_bwd() std::vector initial_data; initial_data.resize(InitialSize[iteration]); for(unsigned int i = 0; i < InitialSize[iteration]; ++i){ - initial_data[i] = i; + initial_data[i] = static_cast(i); } //Create data to assign std::vector data_to_insert; data_to_insert.resize(InsertSize[iteration]); for(unsigned int i = 0; i < InsertSize[iteration]; ++i){ - data_to_insert[i] = -i; + data_to_insert[i] = static_cast(-i); } //Insert initial data to the vector to test diff --git a/test/string_test.cpp b/test/string_test.cpp index 48b5784..962b6e1 100644 --- a/test/string_test.cpp +++ b/test/string_test.cpp @@ -27,6 +27,7 @@ #include "../../intrusive/test/iterator_test.hpp" #include #include +#include using namespace boost::container; @@ -504,6 +505,12 @@ struct alloc_propagate_base int main() { + { + boost::container::string a = "abcdefghijklmnopqrstuvwxyz"; + boost::container::hash_value(a); + } + + if(string_test()){ return 1; } @@ -569,24 +576,22 @@ int main() typedef boost::container::basic_string 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(default allocator) test failed"); } // std::allocator { typedef boost::container::basic_string, std::allocator > 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 boost::report_errors();