From f7eb12d9c72d965a04e118668304d38f10abbe2a Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 21 Oct 2003 11:19:42 +0000 Subject: [PATCH] Updated tests to check new sub_match non-member operators. [SVN r20444] --- test/concepts/concept_check.cpp | 18 ++++++++++++++++++ test/regress/tests.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/test/concepts/concept_check.cpp b/test/concepts/concept_check.cpp index 21e50b56..bbe66b13 100644 --- a/test/concepts/concept_check.cpp +++ b/test/concepts/concept_check.cpp @@ -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; } diff --git a/test/regress/tests.cpp b/test/regress/tests.cpp index 76f285d2..51be74b9 100644 --- a/test/regress/tests.cpp +++ b/test/regress/tests.cpp @@ -386,6 +386,32 @@ void cpp_tests(const basic_regex& 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 //