Updated History.

Added additional tests for regexes that are supposed to be empty.
Added additional test cases for non-greedy repeats.


[SVN r30605]
This commit is contained in:
John Maddock
2005-08-19 16:12:45 +00:00
parent c39176085b
commit 233f083720
5 changed files with 85 additions and 0 deletions

View File

@ -25,6 +25,31 @@
//
struct test_invalid_regex_tag{};
template<class charT, class traits>
void test_empty(boost::basic_regex<charT, traits>& r)
{
if(!r.empty())
{
BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::empty().", charT);
}
if(r.size())
{
BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::size().", charT);
}
if(r.str().size())
{
BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::str().", charT);
}
if(r.begin() != r.end())
{
BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::begin().", charT);
}
if(r.status() == 0)
{
BOOST_REGEX_TEST_ERROR("Invalid value returned from basic_regex<>::status().", charT);
}
}
template<class charT, class traits>
void test(boost::basic_regex<charT, traits>& r, const test_invalid_regex_tag&)
{
@ -39,6 +64,7 @@ void test(boost::basic_regex<charT, traits>& r, const test_invalid_regex_tag&)
{
BOOST_REGEX_TEST_ERROR("Expression compiled when it should not have done so.", charT);
}
test_empty(r);
}
catch(...)
{
@ -58,6 +84,7 @@ void test(boost::basic_regex<charT, traits>& r, const test_invalid_regex_tag&)
catch(const boost::bad_expression&)
{
have_catch = true;
test_empty(r);
}
catch(const std::runtime_error& r)
{