Use algo_equal to reduce test dependencies

This commit is contained in:
Ion Gaztañaga
2024-07-15 11:50:50 +02:00
parent 8d0dc6daeb
commit 4ea9c64316
2 changed files with 10 additions and 10 deletions

View File

@@ -25,7 +25,7 @@
#include "check_equal_containers.hpp"
#include "movable_int.hpp"
#include <boost/algorithm/cxx14/equal.hpp>
#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare
#define BOOST_CONTAINER_DEVECTOR_ALLOC_STATS
#include <boost/container/devector.hpp>
@@ -1136,17 +1136,17 @@ template <class Devector> void test_begin_end()
{
Devector actual; get_range<Devector>(10, actual);
BOOST_TEST(boost::algorithm::equal(expected.begin(), expected.end(), actual.begin(), actual.end()));
BOOST_TEST(boost::algorithm::equal(expected.rbegin(), expected.rend(), actual.rbegin(), actual.rend()));
BOOST_TEST(boost::algorithm::equal(expected.cbegin(), expected.cend(), actual.cbegin(), actual.cend()));
BOOST_TEST(boost::algorithm::equal(expected.crbegin(), expected.crend(), actual.crbegin(), actual.crend()));
BOOST_TEST(::boost::container::algo_equal(expected.begin(), expected.end(), actual.begin(), actual.end()));
BOOST_TEST(::boost::container::algo_equal(expected.rbegin(), expected.rend(), actual.rbegin(), actual.rend()));
BOOST_TEST(::boost::container::algo_equal(expected.cbegin(), expected.cend(), actual.cbegin(), actual.cend()));
BOOST_TEST(::boost::container::algo_equal(expected.crbegin(), expected.crend(), actual.crbegin(), actual.crend()));
}
{
Devector cactual; get_range<Devector>(10, cactual);
BOOST_TEST(boost::algorithm::equal(expected.begin(), expected.end(), cactual.begin(), cactual.end()));
BOOST_TEST(boost::algorithm::equal(expected.rbegin(), expected.rend(), cactual.rbegin(), cactual.rend()));
BOOST_TEST(::boost::container::algo_equal(expected.begin(), expected.end(), cactual.begin(), cactual.end()));
BOOST_TEST(::boost::container::algo_equal(expected.rbegin(), expected.rend(), cactual.rbegin(), cactual.rend()));
}
}

View File

@@ -13,6 +13,7 @@
#define BOOST_CONTAINER_TEST_TEST_UTIL_HPP
#include "test_elem.hpp"
#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare
// get_range
@@ -86,8 +87,7 @@ void print_range(std::ostream& out, Array (&range)[N])
template <typename C1, typename C2, unsigned N>
void test_equal_range(const C1& a, const C2 (&b)[N])
{
bool equals = boost::algorithm::equal
(a.begin(), a.end(), b, b+N);
bool equals = ::boost::container::algo_equal(a.begin(), a.end(), b, b+N);
BOOST_TEST(equals);
@@ -104,7 +104,7 @@ void test_equal_range(const C1& a, const C2 (&b)[N])
template <typename C1, typename C2>
void test_equal_range(const C1& a, const C2&b)
{
bool equals = boost::algorithm::equal
bool equals = boost::container::algo_equal
(a.begin(), a.end(), b.begin(), b.end());
BOOST_TEST(equals);