forked from boostorg/regex
Merged accumulated patches from Trunk.
[SVN r62831]
This commit is contained in:
@ -9,9 +9,18 @@ project
|
||||
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
|
||||
<toolset>msvc-7.1:<define>TEST_MFC=1
|
||||
<toolset>msvc-7.0:<define>TEST_MFC=1
|
||||
<toolset>msvc:<asynch-exceptions>on
|
||||
# There are unidentified linker problems on these platforms:
|
||||
<toolset>mipspro-7.4:<link>static
|
||||
<toolset>sun-5.9:<link>static
|
||||
<toolset>msvc:<warnings>all
|
||||
<toolset>gcc:<warnings>all
|
||||
<toolset>gcc:<cxxflags>-Wextra
|
||||
<toolset>gcc:<cxxflags>-Wshadow
|
||||
<define>U_USING_ICU_NAMESPACE=0
|
||||
<toolset>gcc-mw:<link>static
|
||||
<toolset>gcc-mingw:<link>static
|
||||
<toolset>gcc-cygwin:<link>static
|
||||
;
|
||||
|
||||
#
|
||||
@ -135,4 +144,4 @@ test-suite regex
|
||||
]
|
||||
;
|
||||
|
||||
|
||||
build-project ../example ;
|
||||
|
@ -35,7 +35,7 @@ int main()
|
||||
regex_tA re;
|
||||
int result;
|
||||
result = regcompA(&re, expression, REG_AWK);
|
||||
if(result > REG_NOERROR)
|
||||
if(result > (int)REG_NOERROR)
|
||||
{
|
||||
char buf[256];
|
||||
regerrorA(result, &re, buf, sizeof(buf));
|
||||
@ -46,7 +46,7 @@ int main()
|
||||
matches[0].rm_so = 0;
|
||||
matches[0].rm_eo = strlen(text);
|
||||
result = regexecA(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||
if(result > REG_NOERROR)
|
||||
if(result > (int)REG_NOERROR)
|
||||
{
|
||||
char buf[256];
|
||||
regerrorA(result, &re, buf, sizeof(buf));
|
||||
@ -54,7 +54,7 @@ int main()
|
||||
regfreeA(&re);
|
||||
return result;
|
||||
}
|
||||
assert(matches[0].rm_so == matches[0].rm_eo == 1);
|
||||
assert((matches[0].rm_so == matches[0].rm_eo) && (matches[0].rm_eo == 1));
|
||||
regfreeA(&re);
|
||||
printf("no errors found\n");
|
||||
return 0;
|
||||
|
@ -45,11 +45,11 @@ int main()
|
||||
char nbuf[256];
|
||||
int i;
|
||||
result = regcomp(&re, expression, REG_AWK);
|
||||
if(result > REG_NOERROR)
|
||||
if(result > (int)REG_NOERROR)
|
||||
{
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
for(i = 0; i < 256; ++i)
|
||||
nbuf[i] = buf[i];
|
||||
nbuf[i] = (char)(buf[i]);
|
||||
printf(nbuf);
|
||||
return result;
|
||||
}
|
||||
@ -61,11 +61,11 @@ int main()
|
||||
matches[0].rm_so = 0;
|
||||
matches[0].rm_eo = wcslen(text);
|
||||
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
||||
if(result > REG_NOERROR)
|
||||
if(result > (int)REG_NOERROR)
|
||||
{
|
||||
regerror(result, &re, buf, sizeof(buf));
|
||||
for(i = 0; i < 256; ++i)
|
||||
nbuf[i] = buf[i];
|
||||
nbuf[i] = (char)(buf[i]);
|
||||
printf(nbuf);
|
||||
regfree(&re);
|
||||
return result;
|
||||
|
@ -33,9 +33,14 @@ int* get_array_data();
|
||||
|
||||
int error_count = 0;
|
||||
|
||||
#ifndef TEST_THREADS
|
||||
#define RUN_TESTS(name) \
|
||||
std::cout << "Running test case \"" #name "\".\n";\
|
||||
name();
|
||||
#else
|
||||
#define RUN_TESTS(name) \
|
||||
name();
|
||||
#endif
|
||||
|
||||
|
||||
void run_tests()
|
||||
|
@ -132,6 +132,8 @@ void test_conditionals()
|
||||
TEST_INVALID_REGEX("(?<!*|A)", perl);
|
||||
TEST_INVALID_REGEX("(?<=?|A)", perl);
|
||||
TEST_INVALID_REGEX("(?<=*|\\B)", perl);
|
||||
TEST_INVALID_REGEX("(?<!a|bc)de", perl);
|
||||
TEST_INVALID_REGEX("(?<=a|bc)de", perl);
|
||||
}
|
||||
|
||||
void test_options()
|
||||
@ -278,8 +280,8 @@ void test_options2()
|
||||
TEST_REGEX_SEARCH("(?<=^[[:alpha:]]{4})(?:bar|cat)", perl, "aaaacat", match_default, make_array(4, 7, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?<=^[[:alpha:]]{4})(?:bar|cat)", perl, "aaacat", match_default, make_array(-2, -2));
|
||||
|
||||
TEST_REGEX_SEARCH("(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "abxyZZ", match_default, make_array(4, 6, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "abXyZZ", match_default, make_array(4, 6, -2, -2));
|
||||
//TEST_REGEX_SEARCH("(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "abxyZZ", match_default, make_array(4, 6, -2, -2));
|
||||
//TEST_REGEX_SEARCH("(?<=ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "abXyZZ", match_default, make_array(4, 6, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "ZZZ", match_default, make_array(0, 3, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "zZZ", match_default, make_array(0, 3, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?:ab(?i)x(?-i)y|(?i)z|b)ZZ", perl, "bZZ", match_default, make_array(0, 3, -2, -2));
|
||||
@ -674,6 +676,15 @@ void test_mark_resets()
|
||||
TEST_REGEX_SEARCH("^X(?7)(a)(?|(b)|(q)(r)(s))(c)(d)(Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, -1, -1, -1, -1, 4, 5, 5, 6, 6, 7, -2, -2));
|
||||
TEST_REGEX_SEARCH("^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, -1, -1, -1, -1, 4, 5, 5, 6, 6, 7, -2, -2));
|
||||
TEST_REGEX_SEARCH("^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)", perl, "XYabcdY", match_default, make_array(0, 7, 2, 3, 3, 4, -1, -1, -1, -1, 4, 5, 5, 6, 6, 7, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?|(abc)|(?:((?:xyz)))|(123))", perl, "abc", match_default, make_array(0, 3, 0, 3, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?|(abc)|(?:)((?:)xyz)|(123))", perl, "xyz", match_default, make_array(0, 3, 0, 3, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?|(abc)|((?:(x)|(y)|(z)))|(123))", perl, "y", match_default, make_array(0, 1, 0, 1, -1, -1, 0, 1, -1, -1, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?|(abc)|((?|(x)|(y)|(z)))|(123))", perl, "y", match_default, make_array(0, 1, 0, 1, 0, 1, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?|(abc)|((?|(x)|(y)|(z)))|(123))", perl, "abc", match_default, make_array(0, 3, 0, 3, -1, -1, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?|(abc)|((?|(x)|(y)|(z)))|(123))", perl, "123", match_default, make_array(0, 3, 0, 3, -1, -1, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?|(abc)|((x)|(y)|(z))|(123))", perl, "z", match_default, make_array(0, 1, 0, 1, -1, -1, -1, -1, 0, 1, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?|(abc)|((x)|(y)|(z))|(123))", perl, "abc", match_default, make_array(0, 3, 0, 3, -1, -1, -1, -1, -1, -1, -2, -2));
|
||||
TEST_REGEX_SEARCH("(?|(abc)|((x)|(y)|(z))|(123))", perl, "123", match_default, make_array(0, 3, 0, 3, -1, -1, -1, -1, -1, -1, -2, -2));
|
||||
}
|
||||
|
||||
void test_recursion()
|
||||
|
@ -94,7 +94,7 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
||||
std::copy(u32to16type(v.begin()), u32to16type(v.end()), std::back_inserter(v16));
|
||||
#endif
|
||||
#ifndef BOOST_NO_STD_DISTANCE
|
||||
BOOST_CHECK_EQUAL(std::distance(u32to16type(v.begin()), u32to16type(v.end())), v16.size());
|
||||
BOOST_CHECK_EQUAL((std::size_t)std::distance(u32to16type(v.begin()), u32to16type(v.end())), v16.size());
|
||||
#endif
|
||||
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
|
||||
v32.assign(u16to32type(v16.begin()), u16to32type(v16.end()));
|
||||
@ -103,7 +103,7 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
||||
std::copy(u16to32type(v16.begin()), u16to32type(v16.end()), std::back_inserter(v32));
|
||||
#endif
|
||||
#ifndef BOOST_NO_STD_DISTANCE
|
||||
BOOST_CHECK_EQUAL(std::distance(u16to32type(v16.begin()), u16to32type(v16.end())), v32.size());
|
||||
BOOST_CHECK_EQUAL((std::size_t)std::distance(u16to32type(v16.begin()), u16to32type(v16.end())), v32.size());
|
||||
#endif
|
||||
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
||||
i = v.begin();
|
||||
@ -117,12 +117,12 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||
v16.assign(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin())));
|
||||
#ifndef BOOST_NO_STD_DISTANCE
|
||||
BOOST_CHECK_EQUAL(std::distance(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin()))), v16.size());
|
||||
BOOST_CHECK_EQUAL((std::size_t)std::distance(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin()))), v16.size());
|
||||
#endif
|
||||
std::reverse(v16.begin(), v16.end());
|
||||
v32.assign(ru16to32type(u16to32type(v16.end())), ru16to32type(u16to32type(v16.begin())));
|
||||
#ifndef BOOST_NO_STD_DISTANCE
|
||||
BOOST_CHECK_EQUAL(std::distance(ru16to32type(u16to32type(v16.end())), ru16to32type(u16to32type(v16.begin()))), v32.size());
|
||||
BOOST_CHECK_EQUAL((std::size_t)std::distance(ru16to32type(u16to32type(v16.end())), ru16to32type(u16to32type(v16.begin()))), v32.size());
|
||||
#endif
|
||||
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
||||
std::reverse(v32.begin(), v32.end());
|
||||
@ -142,7 +142,7 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
||||
std::copy(u32to8type(v.begin()), u32to8type(v.end()), std::back_inserter(v8));
|
||||
#endif
|
||||
#ifndef BOOST_NO_STD_DISTANCE
|
||||
BOOST_CHECK_EQUAL(std::distance(u32to8type(v.begin()), u32to8type(v.end())), v8.size());
|
||||
BOOST_CHECK_EQUAL((std::size_t)std::distance(u32to8type(v.begin()), u32to8type(v.end())), v8.size());
|
||||
#endif
|
||||
#if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
|
||||
v32.assign(u8to32type(v8.begin()), u8to32type(v8.end()));
|
||||
@ -151,7 +151,7 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
||||
std::copy(u8to32type(v8.begin()), u8to32type(v8.end()), std::back_inserter(v32));
|
||||
#endif
|
||||
#ifndef BOOST_NO_STD_DISTANCE
|
||||
BOOST_CHECK_EQUAL(std::distance(u8to32type(v8.begin()), u8to32type(v8.end())), v32.size());
|
||||
BOOST_CHECK_EQUAL((std::size_t)std::distance(u8to32type(v8.begin()), u8to32type(v8.end())), v32.size());
|
||||
#endif
|
||||
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
||||
i = v.begin();
|
||||
@ -165,12 +165,12 @@ void test(const std::vector< ::boost::uint32_t>& v)
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||
v8.assign(ru32to8type(u32to8type(v.end())), ru32to8type(u32to8type(v.begin())));
|
||||
#ifndef BOOST_NO_STD_DISTANCE
|
||||
BOOST_CHECK_EQUAL(std::distance(ru32to8type(u32to8type(v.end())), ru32to8type(u32to8type(v.begin()))), v8.size());
|
||||
BOOST_CHECK_EQUAL((std::size_t)std::distance(ru32to8type(u32to8type(v.end())), ru32to8type(u32to8type(v.begin()))), v8.size());
|
||||
#endif
|
||||
std::reverse(v8.begin(), v8.end());
|
||||
v32.assign(ru8to32type(u8to32type(v8.end())), ru8to32type(u8to32type(v8.begin())));
|
||||
#ifndef BOOST_NO_STD_DISTANCE
|
||||
BOOST_CHECK_EQUAL(std::distance(ru8to32type(u8to32type(v8.end())), ru8to32type(u8to32type(v8.begin()))), v32.size());
|
||||
BOOST_CHECK_EQUAL((std::size_t)std::distance(ru8to32type(u8to32type(v8.end())), ru8to32type(u8to32type(v8.begin()))), v32.size());
|
||||
#endif
|
||||
BOOST_CHECK_EQUAL(v.size(), v32.size());
|
||||
std::reverse(v32.begin(), v32.end());
|
||||
|
Reference in New Issue
Block a user