From 53a020f1f1017efc90fd8dd6a251abbe76b9f6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 4 Jan 2022 00:36:36 +0100 Subject: [PATCH] Use BOOST_STATIC_ASSERT_MSG for constant checks --- test/flat_tree_test.cpp | 17 +++++++---------- test/tree_test.cpp | 15 +++++---------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/test/flat_tree_test.cpp b/test/flat_tree_test.cpp index e65b73a..e0cbf75 100644 --- a/test/flat_tree_test.cpp +++ b/test/flat_tree_test.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -132,12 +133,10 @@ int main () std::less, void> tree; typedef tree::container_type container_type; typedef tree::key_compare key_compare; - 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 { @@ -145,12 +144,10 @@ int main () std::less, std::allocator > tree; typedef tree::container_type container_type; typedef tree::key_compare key_compare; - 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/tree_test.cpp b/test/tree_test.cpp index e075596..16b6520 100644 --- a/test/tree_test.cpp +++ b/test/tree_test.cpp @@ -92,13 +92,10 @@ int main () typedef tree::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; typedef tree::key_compare key_compare; - 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 && - 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 { @@ -106,13 +103,11 @@ int main () typedef tree::allocator_type allocator_type; typedef boost::container::allocator_traits::pointer pointer; typedef tree::key_compare key_compare; - 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 && - 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;