Merge branch 'develop'

Fixed Conflicts:
	doc/html/index.html
This commit is contained in:
jzmaddock
2021-02-25 19:27:04 +00:00
138 changed files with 25865 additions and 8278 deletions

View File

@ -38,6 +38,7 @@ rule regex-test ( name : sources + : requirements * : input-files * )
R_SOURCE =
basic_tests.cpp
main.cpp
wmain.cpp
test_alt.cpp
test_anchors.cpp
test_asserts.cpp
@ -61,30 +62,20 @@ test_operators.cpp
;
lib boost_regex_recursive :
../src/c_regex_traits.cpp
../src/cpp_regex_traits.cpp
../src/cregex.cpp
../src/fileiter.cpp
../src/icu.cpp
../src/instances.cpp
../src/posix_api.cpp
../src/regex.cpp
../src/regex_debug.cpp
../src/regex_raw_buffer.cpp
../src/regex_traits_defaults.cpp
../src/static_mutex.cpp
../src/w32_regex_traits.cpp
../src/wc_regex_traits.cpp
../src/wide_posix_api.cpp
../src/winstances.cpp
../src/usinstances.cpp
../build//icu_options
:
<define>BOOST_REGEX_RECURSIVE=1
<define>BOOST_REGEX_CXX03=1
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
:
;
local regress-sources = regress/$(R_SOURCE) ;
test-suite regex
@ -113,24 +104,29 @@ test-suite regex
[ regex-test wide_posix_api_check_cpp
: c_compiler_checks/wide_posix_api_check.cpp ]
[ run pathology/bad_expression_test.cpp
../build//boost_regex
[ run pathology/bad_expression_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run pathology/recursion_test.cpp
../build//boost_regex
[ run pathology/recursion_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run named_subexpressions/named_subexpressions_test.cpp
../build//boost_regex
[ run named_subexpressions/named_subexpressions_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run unicode/unicode_iterator_test.cpp ../build//boost_regex : : : release <define>TEST_UTF8 : unicode_iterator_test_utf8 ]
[ run unicode/unicode_iterator_test.cpp ../build//boost_regex : : : release <define>TEST_UTF16 : unicode_iterator_test_utf16 ]
[ run unicode/unicode_iterator_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
release <define>TEST_UTF8 : unicode_iterator_test_utf8 ]
[ run unicode/unicode_iterator_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
release <define>TEST_UTF16 : unicode_iterator_test_utf16 ]
[ run static_mutex/static_mutex_test.cpp
../../thread/build//boost_thread ../build//boost_regex
]
[ run object_cache/object_cache_test.cpp ../build//boost_regex
[ run object_cache/object_cache_test.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run config_info/regex_config_info.cpp
@ -150,31 +146,47 @@ test-suite regex
: : : <test-info>always_show_run_output : test_collate_info ]
[ link concepts/concept_check.cpp ../build//boost_regex ]
[ link concepts/icu_concept_check.cpp ../build//boost_regex ]
[ link concepts/range_concept_check.cpp ../build//boost_regex ]
[ run concepts/test_bug_11988.cpp ../build//boost_regex ]
[ link concepts/concept_check.cpp :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ link concepts/concept_check.cpp :
<define>BOOST_REGEX_STANDALONE [ check-target-builds ../build//is_legacy_03 : : <build>no ] : standalone_concept_check
]
[ link concepts/icu_concept_check.cpp :
<define>BOOST_REGEX_STANDALONE [ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ link concepts/icu_concept_check.cpp :
[ check-target-builds ../build//is_legacy_03 : : <build>no ] : standalone_icu_concept_check
]
[ link concepts/range_concept_check.cpp :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run concepts/test_bug_11988.cpp : : :
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
]
[ run
# sources
captures/captures_test.cpp
captures//boost_regex_extra ../build//icu_options
../build//icu_options
: # additional args
: # test-files
: # requirements
<threading>multi
<define>BOOST_REGEX_MATCH_EXTRA=1
<define>BOOST_REGEX_NO_LIB=1
[ check-target-builds ../build//is_legacy_03 : : <source>../build//boost_regex ]
: # test name
captures_test
]
[ run regress/$(R_SOURCE) .//boost_regex_recursive
[ run regress/$(R_SOURCE) .//boost_regex_recursive
../build//icu_options
: # command line
: # input files
: # requirements
<define>BOOST_REGEX_RECURSIVE=1
<define>BOOST_REGEX_CXX03=1
: regex_regress_recursive ]
[ run regress/$(R_SOURCE) ./noeh_test//boost_regex_noeh
@ -201,3 +213,11 @@ compile test_warnings.cpp
: <toolset>msvc:<warnings>all <toolset>msvc:<warnings-as-errors>on
<toolset>gcc:<warnings>all <toolset>gcc:<warnings-as-errors>on
<toolset>clang:<warnings>all <toolset>clang:<warnings-as-errors>on ;
compile test_warnings.cpp
: <toolset>msvc:<warnings>all <toolset>msvc:<warnings-as-errors>on
<toolset>gcc:<warnings>all <toolset>gcc:<warnings-as-errors>on
<toolset>clang:<warnings>all <toolset>clang:<warnings-as-errors>on
<define>BOOST_REGEX_STANDALONE
[ check-target-builds ../build//is_legacy_03 : : <build>no ]
: test_warnings_standalone ;

View File

@ -8,23 +8,11 @@ project
;
EX_SOURCES =
c_regex_traits.cpp
cpp_regex_traits.cpp
cregex.cpp
fileiter.cpp
icu.cpp
instances.cpp
posix_api.cpp
regex.cpp
regex_debug.cpp
regex_raw_buffer.cpp
regex_traits_defaults.cpp
static_mutex.cpp
w32_regex_traits.cpp
wc_regex_traits.cpp
wide_posix_api.cpp
winstances.cpp
usinstances.cpp ;
wide_posix_api.cpp ;
lib boost_regex_extra : $(EX_SOURCES) ../../build//icu_options
:

View File

@ -0,0 +1,18 @@
# Copyright 2018, 2019 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
project(cmake_install_test LANGUAGES CXX)
find_package(boost_regex REQUIRED)
find_package(boost_core REQUIRED)
add_executable(quick ../quick.cpp)
target_link_libraries(quick Boost::regex Boost::core)
enable_testing()
add_test(quick quick)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@ -0,0 +1,22 @@
# Copyright 2018, 2019 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
cmake_minimum_required(VERSION 3.5...3.16)
project(cmake_subdir_test LANGUAGES CXX)
add_subdirectory(../.. boostorg/reegx)
add_subdirectory(../../../config boostorg/config)
add_subdirectory(../../../core boostorg/core)
add_subdirectory(../../../assert boostorg/assert)
add_subdirectory(../../../throw_exception boostorg/throw_exception)
add_subdirectory(../../../predef boostorg/predef)
add_executable(quick ../quick.cpp)
target_link_libraries(quick Boost::regex Boost::core)
enable_testing()
add_test(quick quick)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@ -9,6 +9,7 @@
*
*/
#include <boost/regex.hpp>
#include <boost/config.hpp>
#if defined(BOOST_MSVC)
@ -22,18 +23,11 @@
#pragma warning(disable:1418 981 983 595 383)
#endif
#include <boost/regex.hpp>
#include <boost/detail/workaround.hpp>
#if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
#include <boost/regex/concepts.hpp>
#endif
int main()
{
// VC6 and VC7 can't cope with the iterator architypes,
// don't bother testing as it doesn't work:
#if !BOOST_WORKAROUND(_MSC_VER, < 1310) && !defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(__IBMCPP__) && !BOOST_WORKAROUND(__GNUC__, < 3)
boost::function_requires<
boost::RegexTraitsConcept<
boost::regex_traits<char>
@ -53,7 +47,6 @@ int main()
>();
#endif
#endif
#if !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x560)
boost::function_requires<
boost::BoostRegexConcept<
boost::basic_regex<char, boost::c_regex_traits<char> >
@ -66,7 +59,6 @@ int main()
>
>();
#endif
#endif
#if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
boost::function_requires<
boost::BoostRegexConcept<
@ -90,15 +82,12 @@ int main()
regex_traits_tester_type1
>
>();
#if !defined(__MWERKS__) && !defined(__SUNPRO_CC) // MWCW tries to instantiate std::basic_string<boost::char_architype>, not sure whose bug this is....
typedef boost::basic_regex<boost::char_architype, boost::regex_traits_architype<boost::char_architype> > regex_traits_tester_type2;
boost::function_requires<
boost::BaseRegexConcept<
regex_traits_tester_type2
>
>();
#endif // __MWERKS__
#endif
return 0;
}

View File

@ -24,23 +24,11 @@ project
lib boost_regex_noeh :
../../src/c_regex_traits.cpp
../../src/cpp_regex_traits.cpp
../../src/cregex.cpp
../../src/fileiter.cpp
../../src/icu.cpp
../../src/instances.cpp
../../src/posix_api.cpp
../../src/regex.cpp
../../src/regex_debug.cpp
../../src/regex_raw_buffer.cpp
../../src/regex_traits_defaults.cpp
../../src/static_mutex.cpp
../../src/w32_regex_traits.cpp
../../src/wc_regex_traits.cpp
../../src/wide_posix_api.cpp
../../src/winstances.cpp
../../src/usinstances.cpp
../../build//icu_options
:
<link>static

View File

@ -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);

View File

@ -201,21 +201,6 @@ void test(const char& c, const test_invalid_regex_tag& tag)
do_test(c, tag);
}
#ifndef BOOST_NO_WREGEX
void test(const wchar_t& c, const test_regex_replace_tag& tag)
{
do_test(c, tag);
}
void test(const wchar_t& c, const test_regex_search_tag& tag)
{
do_test(c, tag);
}
void test(const wchar_t& c, const test_invalid_regex_tag& tag)
{
do_test(c, tag);
}
#endif
#ifdef BOOST_NO_EXCEPTIONS
namespace boost{

View File

@ -99,7 +99,7 @@ void test_deprecated(const char&, const test_regex_search_tag&)
BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" did not compile with the POSIX C API.", char);
return;
}
// try and find the first occurance:
// try and find the first occurrence:
static const unsigned max_subs = 100;
boost::regmatch_t matches[max_subs];
if(boost::regexecA(&re, search_text.c_str(), max_subs, matches, posix_match_options) == 0)
@ -131,76 +131,11 @@ void test_deprecated(const char&, const test_regex_search_tag&)
// clean up whatever:
boost::regfreeA(&re);
//
// now try the RegEx class:
//
if(test_info<char>::syntax_options() & ~boost::regex::icase)
return;
#ifndef BOOST_NO_EXCEPTIONS
try
#endif
{
boost::RegEx e(expression, (test_info<char>::syntax_options() & boost::regex::icase) != 0);
if(e.error_code())
{
BOOST_REGEX_TEST_ERROR("Expression did not compile when it should have done, error code = " << e.error_code(), char);
}
if(e.Search(search_text, test_info<char>::match_options()))
{
int i = 0;
while(results[i*2] != -2)
{
if(e.Matched(i))
{
if(results[2*i] != static_cast<int>(e.Position(i)))
{
BOOST_REGEX_TEST_ERROR("Mismatch in start of subexpression " << i << " found with the RegEx class (found " << e.Position(i) << " expected " << results[2*i] << ").", char);
}
if(results[2*i+1] != static_cast<int>(e.Position(i) + e.Length(i)))
{
BOOST_REGEX_TEST_ERROR("Mismatch in end of subexpression " << i << " found with the RegEx class (found " << e.Position(i) + e.Length(i) << " expected " << results[2*i+1] << ").", char);
}
}
else
{
if(results[2*i] >= 0)
{
BOOST_REGEX_TEST_ERROR("Mismatch in start of subexpression " << i << " found with the RegEx class (found " << e.Position(i) << " expected " << results[2*i] << ").", char);
}
if(results[2*i+1] >= 0)
{
BOOST_REGEX_TEST_ERROR("Mismatch in end of subexpression " << i << " found with the RegEx class (found " << e.Position(i) + e.Length(i) << " expected " << results[2*i+1] << ").", char);
}
}
++i;
}
}
else
{
if(results[0] >= 0)
{
BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" was not found with class RegEx.", char);
}
}
}
#ifndef BOOST_NO_EXCEPTIONS
catch(const boost::bad_expression& r)
{
BOOST_REGEX_TEST_ERROR("Expression did not compile with RegEx class: " << r.what(), char);
}
catch(const std::runtime_error& r)
{
BOOST_REGEX_TEST_ERROR("Unexpected std::runtime_error : " << r.what(), char);
}
catch(const std::exception& r)
{
BOOST_REGEX_TEST_ERROR("Unexpected std::exception: " << r.what(), char);
}
catch(...)
{
BOOST_REGEX_TEST_ERROR("Unexpected exception of unknown type", char);
}
#endif
}
std::string to_narrow_string(std::wstring const& w)
{
return std::string(w.begin(), w.end());
}
void test_deprecated(const wchar_t&, const test_regex_search_tag&)
@ -224,10 +159,10 @@ void test_deprecated(const wchar_t&, const test_regex_search_tag&)
boost::regex_tW re;
if(boost::regcompW(&re, expression.c_str(), posix_options) != 0)
{
BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" did not compile with the POSIX C API.", wchar_t);
BOOST_REGEX_TEST_ERROR("Expression : \"" << to_narrow_string(expression.c_str()) << "\" did not compile with the POSIX C API.", wchar_t);
return;
}
// try and find the first occurance:
// try and find the first occurrence:
static const unsigned max_subs = 100;
boost::regmatch_t matches[max_subs];
if(boost::regexecW(&re, search_text.c_str(), max_subs, matches, posix_match_options) == 0)
@ -253,7 +188,7 @@ void test_deprecated(const wchar_t&, const test_regex_search_tag&)
{
if(results[0] >= 0)
{
BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" was not found with the POSIX C API.", wchar_t);
BOOST_REGEX_TEST_ERROR("Expression : \"" << to_narrow_string(expression.c_str()) << "\" was not found with the POSIX C API.", wchar_t);
}
}
// clean up whatever:
@ -300,46 +235,6 @@ void test_deprecated(const char&, const test_invalid_regex_tag&)
}
}
}
//
// now try the RegEx class:
//
if(test_info<char>::syntax_options() & ~boost::regex::icase)
return;
bool have_catch = false;
#ifndef BOOST_NO_EXCEPTIONS
try
#endif
{
boost::RegEx e(expression, (test_info<char>::syntax_options() & boost::regex::icase) != 0);
if(e.error_code())
have_catch = true;
}
#ifndef BOOST_NO_EXCEPTIONS
catch(const boost::bad_expression&)
{
have_catch = true;
}
catch(const std::runtime_error& r)
{
have_catch = true;
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::runtime_error instead: " << r.what(), char);
}
catch(const std::exception& r)
{
have_catch = true;
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but a std::exception instead: " << r.what(), char);
}
catch(...)
{
have_catch = true;
BOOST_REGEX_TEST_ERROR("Expected a bad_expression exception, but got an exception of unknown type instead", char);
}
#endif
if(!have_catch)
{
// oops expected exception was not thrown:
BOOST_REGEX_TEST_ERROR("Expected an exception, but didn't find one.", char);
}
}
void test_deprecated(const wchar_t&, const test_invalid_regex_tag&)
@ -358,7 +253,7 @@ void test_deprecated(const wchar_t&, const test_invalid_regex_tag&)
if(code == 0)
{
boost::regfreeW(&re);
BOOST_REGEX_TEST_ERROR("Expression : \"" << expression.c_str() << "\" unexpectedly compiled with the POSIX C API.", wchar_t);
BOOST_REGEX_TEST_ERROR("Expression : \"" << to_narrow_string(expression.c_str()) << "\" unexpectedly compiled with the POSIX C API.", wchar_t);
}
else
{

View File

@ -23,6 +23,7 @@
#if defined(BOOST_HAS_ICU) && !defined(BOOST_NO_STD_WSTRING)
#include <boost/regex/icu.hpp>
#include <boost/mpl/int.hpp>
#include "test.hpp"
namespace unnecessary_fix{
@ -86,7 +87,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 +107,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 +122,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 +151,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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -98,7 +98,7 @@ void test_replace()
TEST_REGEX_REPLACE("(?<one>a+)|(?<two>b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "(?{one}A:B)C", "...ACBC,,,ACBC*ACBC?");
TEST_REGEX_REPLACE("(?<one>a+)|(?<two>b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all, "?{one}:B", "...B,,,B*B?");
// move to copying unmatched data, but replace first occurance only:
// move to copying unmatched data, but replace first occurrence only:
TEST_REGEX_REPLACE("a+", perl, "...aaa,,,", match_default|format_all|format_first_only, "bbb", "...bbb,,,");
TEST_REGEX_REPLACE("a+(b+)", perl, "...aaabb,,,", match_default|format_all|format_first_only, "$1", "...bb,,,");
TEST_REGEX_REPLACE("a+(b+)", perl, "...aaabb,,,ab*abbb?", match_default|format_all|format_first_only, "$1", "...bb,,,ab*abbb?");

54
test/regress/wmain.cpp Normal file
View File

@ -0,0 +1,54 @@
/*
*
* Copyright (c) 2004
* John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE main.cpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: entry point for test program.
*/
#include "test.hpp"
#include "test_locale.hpp"
#include <stdarg.h>
#include <iostream>
#include <iomanip>
#ifdef BOOST_HAS_ICU
#include <unicode/uloc.h>
#endif
#ifdef TEST_THREADS
#include <list>
#include <boost/thread.hpp>
#include <boost/thread/tss.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/array.hpp>
int* get_array_data();
#endif
#ifndef BOOST_NO_WREGEX
void test(const wchar_t& c, const test_regex_replace_tag& tag)
{
do_test(c, tag);
}
void test(const wchar_t& c, const test_regex_search_tag& tag)
{
do_test(c, tag);
}
void test(const wchar_t& c, const test_invalid_regex_tag& tag)
{
do_test(c, tag);
}
#endif

View File

@ -22,6 +22,7 @@
#include <iostream>
#include <iomanip>
#ifdef BOOST_REGEX_CXX03
//
// we cannot use the regular Boost.Test in here: it is not thread safe
// and calls to BOOST_CHECK will eventually crash on some compilers
@ -205,3 +206,6 @@ int main()
return total_failures;
}
#else
int main() {}
#endif

View File

@ -10,20 +10,8 @@
*/
#include <libs/regex/src/c_regex_traits.cpp>
#include <libs/regex/src/cpp_regex_traits.cpp>
#include <libs/regex/src/cregex.cpp>
#include <libs/regex/src/fileiter.cpp>
#include <libs/regex/src/icu.cpp>
#include <libs/regex/src/instances.cpp>
#include <libs/regex/src/posix_api.cpp>
#include <libs/regex/src/regex.cpp>
#include <libs/regex/src/regex_debug.cpp>
#include <libs/regex/src/regex_raw_buffer.cpp>
#include <libs/regex/src/regex_traits_defaults.cpp>
#include <libs/regex/src/static_mutex.cpp>
#include <libs/regex/src/usinstances.cpp>
#include <libs/regex/src/wc_regex_traits.cpp>
#include <libs/regex/src/w32_regex_traits.cpp>
#include <libs/regex/src/wide_posix_api.cpp>
#include <libs/regex/src/winstances.cpp>

View File

@ -16,6 +16,7 @@
* DESCRIPTION: Simple test suite for Unicode interconversions.
*/
#include <boost/regex/config.hpp>
#include <boost/regex/pending/unicode_iterator.hpp>
#include <boost/detail/lightweight_main.hpp>
#include "../test_macros.hpp"
@ -317,6 +318,6 @@ int cpp_main( int, char* [] )
for(unsigned i = 0xDFFF + 1; i < 0x10FFFF; ++i)
v.push_back(i);
test(v);
return 0;
return boost::report_errors();
}