forked from boostorg/regex
Updated tests to check new sub_match non-member operators.
[SVN r20444]
This commit is contained in:
@ -64,6 +64,24 @@ int main()
|
||||
>();
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
// verify basic_regex member functions:
|
||||
//
|
||||
const char* c_exp = "abc";
|
||||
r = c_exp;
|
||||
r = r;
|
||||
r = s;
|
||||
if((r.mark_count()) || (0 == r.max_size()) || (r.empty()) || (0 == r.size()) || (r.begin() == r.end())) abort();
|
||||
|
||||
r.assign(r);
|
||||
r.assign(c_exp);
|
||||
r.assign(c_exp, boost::regex::perl);
|
||||
r.assign(c_exp, 1, boost::regex::perl);
|
||||
r.assign(s);
|
||||
r.assign(s, boost::regex::perl);
|
||||
r.assign(c_exp, c_exp+1);
|
||||
r.assign(c_exp, c_exp+1, boost::regex::perl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -386,6 +386,32 @@ void cpp_tests(const basic_regex<C, T, A>& e, bool recurse = true)
|
||||
cout << "string comparison failed for result" << std::endl;
|
||||
}
|
||||
}
|
||||
//
|
||||
// now try addition operators:
|
||||
string_type sa(1, (string_type::value_type)'a');
|
||||
if(
|
||||
((m[0] + sa) != (s + sa))
|
||||
|| (sa + m[0]) != (sa + s)
|
||||
|| ((m[0] + m[0]) != (s + s))
|
||||
|| ((m[0] + m[0]) != (s + s))
|
||||
|| ((m[0] + sa[0]) != (s + sa[0]))
|
||||
|| ((sa[0] + m[0]) != (sa[0] + s))
|
||||
)
|
||||
{
|
||||
begin_error();
|
||||
cout << "string addition failed for result" << std::endl;
|
||||
}
|
||||
if(s.find_first_of((string_type::value_type)0) == string_type::npos)
|
||||
{
|
||||
if(
|
||||
((m[0] + sa.c_str()) != (s + sa))
|
||||
|| ((sa.c_str() + m[0]) != (sa + s))
|
||||
)
|
||||
{
|
||||
begin_error();
|
||||
cout << "string addition failed for result" << std::endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user