forked from boostorg/regex
Remove a lot of boost dependencies and workarounds.
This commit is contained in:
@ -15,7 +15,14 @@
|
||||
* VERSION see <boost/version.hpp>
|
||||
* DESCRIPTION: Test code for a generic object cache.
|
||||
*/
|
||||
#include <boost/regex/pending/object_cache.hpp>
|
||||
#include <boost/regex/config.hpp>
|
||||
#ifdef BOOST_REGEX_CXX03
|
||||
#include <boost/regex/v4/object_cache.hpp>
|
||||
#define SP_NS boost
|
||||
#else
|
||||
#include <boost/regex/v5/object_cache.hpp>
|
||||
#define SP_NS std
|
||||
#endif
|
||||
#include <boost/detail/lightweight_main.hpp>
|
||||
#include "../test_macros.hpp"
|
||||
|
||||
@ -49,7 +56,7 @@ int cpp_main(int /*argc*/, char * /*argv*/[])
|
||||
int i;
|
||||
for(i = 0; i < 20; ++i)
|
||||
{
|
||||
boost::shared_ptr<const test_object> p = boost::object_cache<int, test_object>::get(i, max_cache_size);
|
||||
SP_NS::shared_ptr<const test_object> p = boost::object_cache<int, test_object>::get(i, max_cache_size);
|
||||
BOOST_CHECK(p->value() == i);
|
||||
p = boost::object_cache<int, test_object>::get(i, max_cache_size);
|
||||
BOOST_CHECK(p->value() == i);
|
||||
@ -64,7 +71,7 @@ int cpp_main(int /*argc*/, char * /*argv*/[])
|
||||
{
|
||||
for(i = 20 - max_cache_size; i < 20; ++i)
|
||||
{
|
||||
boost::shared_ptr<const test_object> p = boost::object_cache<int, test_object>::get(i, max_cache_size);
|
||||
SP_NS::shared_ptr<const test_object> p = boost::object_cache<int, test_object>::get(i, max_cache_size);
|
||||
BOOST_CHECK(p->value() == i);
|
||||
p = boost::object_cache<int, test_object>::get(i, max_cache_size);
|
||||
BOOST_CHECK(p->value() == i);
|
||||
|
@ -86,7 +86,7 @@ void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<2> const*)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
|
||||
}
|
||||
if((w1.position(i) != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2.prefix().first), iterator_type(w2[i].first))) || (w1.length(i) != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2[i].first), iterator_type(w2[i].second))))
|
||||
if((w1.position(i) != std::distance(iterator_type(w2.prefix().first), iterator_type(w2[i].first))) || (w1.length(i) != std::distance(iterator_type(w2[i].first), iterator_type(w2[i].second))))
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Iterator mismatch in match_results class", UChar32);
|
||||
}
|
||||
@ -106,7 +106,7 @@ void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<2> const*)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
|
||||
}
|
||||
if ((w1.position("abc") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2.prefix().first), iterator_type(w2["abc"].first))) || (w1.length("abc") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2["abc"].first), iterator_type(w2["abc"].second))))
|
||||
if ((w1.position("abc") != std::distance(iterator_type(w2.prefix().first), iterator_type(w2["abc"].first))) || (w1.length("abc") != std::distance(iterator_type(w2["abc"].first), iterator_type(w2["abc"].second))))
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Iterator mismatch in match_results class", UChar32);
|
||||
}
|
||||
@ -121,7 +121,7 @@ void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<2> const*)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
|
||||
}
|
||||
if ((w1.position("N") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2.prefix().first), iterator_type(w2["N"].first))) || (w1.length("N") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2["N"].first), iterator_type(w2["N"].second))))
|
||||
if ((w1.position("N") != std::distance(iterator_type(w2.prefix().first), iterator_type(w2["N"].first))) || (w1.length("N") != std::distance(iterator_type(w2["N"].first), iterator_type(w2["N"].second))))
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Iterator mismatch in match_results class", UChar32);
|
||||
}
|
||||
@ -150,7 +150,7 @@ void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<1> const*)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
|
||||
}
|
||||
if((w1.position(i) != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2.prefix().first), iterator_type(w2[i].first))) || (w1.length(i) != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2[i].first), iterator_type(w2[i].second))))
|
||||
if((w1.position(i) != std::distance(iterator_type(w2.prefix().first), iterator_type(w2[i].first))) || (w1.length(i) != std::distance(iterator_type(w2[i].first), iterator_type(w2[i].second))))
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR("Iterator mismatch in match_results class", UChar32);
|
||||
}
|
||||
|
@ -170,21 +170,21 @@ void test_mfc(const char&, const test_regex_search_tag&)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244)
|
||||
#endif
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->first) != last_end2)
|
||||
if(std::distance(s.GetString(), tstart2->first) != last_end2)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in location of start of field split, found: "
|
||||
<< boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->first)
|
||||
<< std::distance(s.GetString(), tstart2->first)
|
||||
<< ", expected: "
|
||||
<< last_end2
|
||||
<< ".", char);
|
||||
}
|
||||
int expected_end = static_cast<int>(answer_table[0] < 0 ? s.GetLength() : answer_table[0]);
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->second) != expected_end)
|
||||
if(std::distance(s.GetString(), tstart2->second) != expected_end)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in location of end2 of field split, found: "
|
||||
<< boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->second)
|
||||
<< std::distance(s.GetString(), tstart2->second)
|
||||
<< ", expected: "
|
||||
<< expected_end
|
||||
<< ".", char);
|
||||
@ -348,21 +348,21 @@ void test_mfc(const wchar_t&, const test_regex_search_tag&)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244)
|
||||
#endif
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->first) != last_end2)
|
||||
if(std::distance(s.GetString(), tstart2->first) != last_end2)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in location of start of field split, found: "
|
||||
<< boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->first)
|
||||
<< std::distance(s.GetString(), tstart2->first)
|
||||
<< ", expected: "
|
||||
<< last_end2
|
||||
<< ".", wchar_t);
|
||||
}
|
||||
int expected_end = static_cast<int>(answer_table[0] < 0 ? s.GetLength() : answer_table[0]);
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->second) != expected_end)
|
||||
if(std::distance(s.GetString(), tstart2->second) != expected_end)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in location of end2 of field split, found: "
|
||||
<< boost::BOOST_REGEX_DETAIL_NS::distance(s.GetString(), tstart2->second)
|
||||
<< std::distance(s.GetString(), tstart2->second)
|
||||
<< ", expected: "
|
||||
<< expected_end
|
||||
<< ".", wchar_t);
|
||||
|
@ -47,18 +47,18 @@ void test_sub_match(const boost::sub_match<BidirectionalIterator>& sub, Bidirect
|
||||
}
|
||||
else
|
||||
{
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.first) != answer_table[2*i])
|
||||
if(std::distance(base, sub.first) != answer_table[2*i])
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in start location of sub-expression "
|
||||
<< i << ", found " << boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.first)
|
||||
<< i << ", found " << std::distance(base, sub.first)
|
||||
<< ", expected " << answer_table[2*i] << ".", charT);
|
||||
}
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.second) != answer_table[1+ 2*i])
|
||||
if(std::distance(base, sub.second) != answer_table[1+ 2*i])
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in end location of sub-expression "
|
||||
<< i << ", found " << boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.second)
|
||||
<< i << ", found " << std::distance(base, sub.second)
|
||||
<< ", expected " << answer_table[1 + 2*i] << ".", charT);
|
||||
}
|
||||
}
|
||||
@ -238,21 +238,21 @@ void test_regex_token_iterator(boost::basic_regex<charT, traits>& r)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244)
|
||||
#endif
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first) != last_end2)
|
||||
if(std::distance(search_text.begin(), start2->first) != last_end2)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in location of start of field split, found: "
|
||||
<< boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first)
|
||||
<< std::distance(search_text.begin(), start2->first)
|
||||
<< ", expected: "
|
||||
<< last_end2
|
||||
<< ".", charT);
|
||||
}
|
||||
int expected_end = static_cast<int>(answer_table[0] < 0 ? search_text.size() : answer_table[0]);
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second) != expected_end)
|
||||
if(std::distance(search_text.begin(), start2->second) != expected_end)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in location of end2 of field split, found: "
|
||||
<< boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second)
|
||||
<< std::distance(search_text.begin(), start2->second)
|
||||
<< ", expected: "
|
||||
<< expected_end
|
||||
<< ".", charT);
|
||||
|
@ -55,18 +55,18 @@ void test_sub_match(const boost::sub_match<BidirectionalIterator>& sub, Bidirect
|
||||
}
|
||||
else
|
||||
{
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.first) != answer_table[2*i])
|
||||
if(std::distance(base, sub.first) != answer_table[2*i])
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in start location of sub-expression "
|
||||
<< i << ", found " << boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.first)
|
||||
<< i << ", found " << std::distance(base, sub.first)
|
||||
<< ", expected " << answer_table[2*i] << ".", charT);
|
||||
}
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.second) != answer_table[1+ 2*i])
|
||||
if(std::distance(base, sub.second) != answer_table[1+ 2*i])
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in end location of sub-expression "
|
||||
<< i << ", found " << boost::BOOST_REGEX_DETAIL_NS::distance(base, sub.second)
|
||||
<< i << ", found " << std::distance(base, sub.second)
|
||||
<< ", expected " << answer_table[1 + 2*i] << ".", charT);
|
||||
}
|
||||
}
|
||||
@ -291,21 +291,21 @@ void test_regex_token_iterator(boost::basic_regex<charT, traits>& r)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244)
|
||||
#endif
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first) != last_end2)
|
||||
if(std::distance(search_text.begin(), start2->first) != last_end2)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in location of start of field split, found: "
|
||||
<< boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first)
|
||||
<< std::distance(search_text.begin(), start2->first)
|
||||
<< ", expected: "
|
||||
<< last_end2
|
||||
<< ".", charT);
|
||||
}
|
||||
int expected_end = static_cast<int>(answer_table[0] < 0 ? search_text.size() : answer_table[0]);
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second) != expected_end)
|
||||
if(std::distance(search_text.begin(), start2->second) != expected_end)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in location of end2 of field split, found: "
|
||||
<< boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second)
|
||||
<< std::distance(search_text.begin(), start2->second)
|
||||
<< ", expected: "
|
||||
<< expected_end
|
||||
<< ".", charT);
|
||||
@ -350,21 +350,21 @@ void test_regex_token_iterator(boost::basic_regex<charT, traits>& r)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244)
|
||||
#endif
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first) != last_end2)
|
||||
if(std::distance(search_text.begin(), start2->first) != last_end2)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in location of start of field split, found: "
|
||||
<< boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->first)
|
||||
<< std::distance(search_text.begin(), start2->first)
|
||||
<< ", expected: "
|
||||
<< last_end2
|
||||
<< ".", charT);
|
||||
}
|
||||
int expected_end = static_cast<int>(answer_table[0] < 0 ? search_text.size() : answer_table[0]);
|
||||
if(boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second) != expected_end)
|
||||
if(std::distance(search_text.begin(), start2->second) != expected_end)
|
||||
{
|
||||
BOOST_REGEX_TEST_ERROR(
|
||||
"Error in location of end2 of field split, found: "
|
||||
<< boost::BOOST_REGEX_DETAIL_NS::distance(search_text.begin(), start2->second)
|
||||
<< std::distance(search_text.begin(), start2->second)
|
||||
<< ", expected: "
|
||||
<< expected_end
|
||||
<< ".", charT);
|
||||
|
Reference in New Issue
Block a user