Boost logo

Boost-Commit :

From: dgregor_at_[hidden]
Date: 2007-07-26 20:24:30


Author: dgregor
Date: 2007-07-26 20:24:30 EDT (Thu, 26 Jul 2007)
New Revision: 7562
URL: http://svn.boost.org/trac/boost/changeset/7562

Log:
Fix eol-style and mime-types
Properties modified:
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/regress/test_named_captures.hpp (contents, props changed)
Text files modified:
   sandbox/SOC/2007/regex/named-captures/libs/regex/test/regress/test_named_captures.hpp | 164 ++++++++++++++++++++--------------------
   1 files changed, 82 insertions(+), 82 deletions(-)

Modified: sandbox/SOC/2007/regex/named-captures/libs/regex/test/regress/test_named_captures.hpp
==============================================================================
--- sandbox/SOC/2007/regex/named-captures/libs/regex/test/regress/test_named_captures.hpp (original)
+++ sandbox/SOC/2007/regex/named-captures/libs/regex/test/regress/test_named_captures.hpp 2007-07-26 20:24:30 EDT (Thu, 26 Jul 2007)
@@ -1,83 +1,83 @@
-
-#include <iostream>
-
-using namespace std;
-using namespace boost;
-
-void test_named_captures(const string& pattern, const string& text)
-{
- regex ex(pattern);
- smatch matches;
- if (regex_match(text, matches, ex, match_extra))
- cout << pattern << " matches " << text << endl;
- else
- cout << pattern << " does not match " << text << endl;
-}
-
-void test_named_groups()
-{
- test_named_captures("(?P<alpha>a)", "a");
- test_named_captures("(?P<alpha>abc)+", "abcabc");
- test_named_captures("(?P<alpha>a+)(b+)", "aaabbb");
- test_named_captures("(a+)(?P<beta>b+)", "aaabbb");
- test_named_captures("(?P<outer>(a+)b+)", "aaabbb");
- test_named_captures("(?P<outer>a+(b+))", "aaabbb");
- test_named_captures("(a+(?P<inner>b+))", "aaabbb");
- test_named_captures("(?P<outer>a+(?P<inner>b+))", "aaabbb");
- test_named_captures("a+(?P<inSiDe>b+)b+", "aaadzabbb"); //should fail
- test_named_captures("(a)(?P<alt>b|$)", "ab");
- test_named_captures("(a)(?P<alt>b|$)", "a");
-}
-
-void test_named_retrieval()
-{
- smatch matches;
- regex ad("got (?P<drink>\\w+)\\?$");
- string text = "got milk?";
- if (regex_match(text, matches, ad, match_extra) && matches["drink"] == "milk")
- cout << "passed ad\n";
- else
- cout << "failed ad\n";
-
- regex magic("(?P<first>abra)ca(?P<second>dabra)!");
- text = "abracadabra!";
- if (regex_match(text, matches, magic, match_extra) && matches["first"] == "abra" && matches["second"] == "dabra")
- cout << "passed magic\n";
- else
- cout << "failed magic\n";
-
- regex poem("(?P<first>.*), (\\w+) (?P<second>.*) D.*");
- text = "Twas brillig, and the slithy toves Did gyre and gimble in the wabe";
- if (regex_match(text, matches, poem, match_extra) &&
- matches["first"] == "Twas brillig" && matches["second"] == "the slithy toves" &&
- matches["second"] == matches[3])
- cout << "passed poem\n";
- else
- cout << "failed poem\n";
-}
-
-void test_named_backrefs()
-{
- test_named_captures("(?P<alpha>a)bc(?P=alpha)", "abca");
- test_named_captures("(?P<alpha>a+)bc(?P=alpha)", "aaabcaaa");
- test_named_captures("(?P<alpha>a+)bc(?P=alpha)", "aaabca"); //should fail
- test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "abb");
- test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "add");
- test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "abd"); //should fail
- test_named_captures("(?P<name>\\w+) (.*) (?P=name)", "Jameson R. Jameson");
- test_named_captures("(a+(?P<inner>b+))(?P=inner)", "aabbbb");
- test_named_captures("(a+(?P<inner>b+))c(?P=inner)", "aabcb");
- test_named_captures("(a+(?P<inner>b+))(?P=inner)", "aabbb"); //should fail
- test_named_captures("(?P<recursive>a+(?P=recursive))(b+)", "aaabbb"); //should fail
- test_named_captures("(?P<recursive>a+(?P=recursive))(b+)", "aaabbb"); //should fail
- // the two below should (and do) cause runtime errors when the pattern compiles
- //test_named_captures("(?P=alpha)", "abca"); //should fail
- //test_named_captures("(?P=<alpha>.*)(?=beta)", "abab"); //should fail
-}
-
-void run_experimental()
-{
- test_named_groups();
- test_named_retrieval();
- test_named_backrefs();
+
+#include <iostream>
+
+using namespace std;
+using namespace boost;
+
+void test_named_captures(const string& pattern, const string& text)
+{
+ regex ex(pattern);
+ smatch matches;
+ if (regex_match(text, matches, ex, match_extra))
+ cout << pattern << " matches " << text << endl;
+ else
+ cout << pattern << " does not match " << text << endl;
+}
+
+void test_named_groups()
+{
+ test_named_captures("(?P<alpha>a)", "a");
+ test_named_captures("(?P<alpha>abc)+", "abcabc");
+ test_named_captures("(?P<alpha>a+)(b+)", "aaabbb");
+ test_named_captures("(a+)(?P<beta>b+)", "aaabbb");
+ test_named_captures("(?P<outer>(a+)b+)", "aaabbb");
+ test_named_captures("(?P<outer>a+(b+))", "aaabbb");
+ test_named_captures("(a+(?P<inner>b+))", "aaabbb");
+ test_named_captures("(?P<outer>a+(?P<inner>b+))", "aaabbb");
+ test_named_captures("a+(?P<inSiDe>b+)b+", "aaadzabbb"); //should fail
+ test_named_captures("(a)(?P<alt>b|$)", "ab");
+ test_named_captures("(a)(?P<alt>b|$)", "a");
+}
+
+void test_named_retrieval()
+{
+ smatch matches;
+ regex ad("got (?P<drink>\\w+)\\?$");
+ string text = "got milk?";
+ if (regex_match(text, matches, ad, match_extra) && matches["drink"] == "milk")
+ cout << "passed ad\n";
+ else
+ cout << "failed ad\n";
+
+ regex magic("(?P<first>abra)ca(?P<second>dabra)!");
+ text = "abracadabra!";
+ if (regex_match(text, matches, magic, match_extra) && matches["first"] == "abra" && matches["second"] == "dabra")
+ cout << "passed magic\n";
+ else
+ cout << "failed magic\n";
+
+ regex poem("(?P<first>.*), (\\w+) (?P<second>.*) D.*");
+ text = "Twas brillig, and the slithy toves Did gyre and gimble in the wabe";
+ if (regex_match(text, matches, poem, match_extra) &&
+ matches["first"] == "Twas brillig" && matches["second"] == "the slithy toves" &&
+ matches["second"] == matches[3])
+ cout << "passed poem\n";
+ else
+ cout << "failed poem\n";
+}
+
+void test_named_backrefs()
+{
+ test_named_captures("(?P<alpha>a)bc(?P=alpha)", "abca");
+ test_named_captures("(?P<alpha>a+)bc(?P=alpha)", "aaabcaaa");
+ test_named_captures("(?P<alpha>a+)bc(?P=alpha)", "aaabca"); //should fail
+ test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "abb");
+ test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "add");
+ test_named_captures("a(?P<alpha>b|d)(?P=alpha)", "abd"); //should fail
+ test_named_captures("(?P<name>\\w+) (.*) (?P=name)", "Jameson R. Jameson");
+ test_named_captures("(a+(?P<inner>b+))(?P=inner)", "aabbbb");
+ test_named_captures("(a+(?P<inner>b+))c(?P=inner)", "aabcb");
+ test_named_captures("(a+(?P<inner>b+))(?P=inner)", "aabbb"); //should fail
+ test_named_captures("(?P<recursive>a+(?P=recursive))(b+)", "aaabbb"); //should fail
+ test_named_captures("(?P<recursive>a+(?P=recursive))(b+)", "aaabbb"); //should fail
+ // the two below should (and do) cause runtime errors when the pattern compiles
+ //test_named_captures("(?P=alpha)", "abca"); //should fail
+ //test_named_captures("(?P=<alpha>.*)(?=beta)", "abab"); //should fail
+}
+
+void run_experimental()
+{
+ test_named_groups();
+ test_named_retrieval();
+ test_named_backrefs();
 }
\ No newline at end of file


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