Boost logo

Boost-Commit :

From: john_at_[hidden]
Date: 2007-09-10 06:37:20


Author: johnmaddock
Date: 2007-09-10 06:37:19 EDT (Mon, 10 Sep 2007)
New Revision: 39177
URL: http://svn.boost.org/trac/boost/changeset/39177

Log:
Added optional code to test SGI rope with Regex.
Text files modified:
   trunk/libs/regex/test/regress/test_regex_search.hpp | 37 +++++++++++++++++++++++++++++++++++++
   1 files changed, 37 insertions(+), 0 deletions(-)

Modified: trunk/libs/regex/test/regress/test_regex_search.hpp
==============================================================================
--- trunk/libs/regex/test/regress/test_regex_search.hpp (original)
+++ trunk/libs/regex/test/regress/test_regex_search.hpp 2007-09-10 06:37:19 EDT (Mon, 10 Sep 2007)
@@ -19,6 +19,9 @@
 #ifndef BOOST_REGEX_REGRESS_REGEX_SEARCH_HPP
 #define BOOST_REGEX_REGRESS_REGEX_SEARCH_HPP
 #include "info.hpp"
+#ifdef TEST_ROPE
+#include <rope>
+#endif
 //
 // this file implements a test for a regular expression that should compile,
 // followed by a search for that expression:
@@ -119,6 +122,40 @@
          BOOST_REGEX_TEST_ERROR("Unexpected match was found when using the match_any flag.", charT);
       }
    }
+#ifdef TEST_ROPE
+ std::rope<charT> rsearch_text;
+ for(unsigned i = 0; i < search_text.size(); ++i)
+ {
+ std::rope<charT> c(search_text[i]);
+ if(++i != search_text.size())
+ {
+ c.append(search_text[i]);
+ if(++i != search_text.size())
+ {
+ c.append(search_text[i]);
+ }
+ }
+ rsearch_text.append(c);
+ }
+ boost::match_results<std::rope<charT>::const_iterator> rwhat;
+ if(boost::regex_search(
+ rsearch_text.begin(),
+ rsearch_text.end(),
+ rwhat,
+ r,
+ opts))
+ {
+ test_result(rwhat, rsearch_text.begin(), answer_table);
+ }
+ else
+ {
+ if(answer_table[0] >= 0)
+ {
+ // we should have had a match but didn't:
+ BOOST_REGEX_TEST_ERROR("Expected match was not found.", charT);
+ }
+ }
+#endif
 }
 
 template<class charT, class traits>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk