update to pcre 7.9

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13706 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2009-06-08 23:51:30 +00:00
parent a1e5add731
commit f7efdaa901
178 changed files with 43560 additions and 11382 deletions

View File

@@ -32,10 +32,19 @@
// Unittest for scanner, especially GetNextComments and GetComments()
// functionality.
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <string>
#include <vector>
#include <pcre_stringpiece.h>
#include <pcre_scanner.h>
#include "pcrecpp.h"
#include "pcre_stringpiece.h"
#include "pcre_scanner.h"
#define FLAGS_unittest_stack_size 49152
// Dies with a fatal error if the two values are not equal.
#define CHECK_EQ(a, b) do { \
@@ -116,8 +125,31 @@ static void TestScanner() {
comments.resize(0);
}
static void TestBigComment() {
string input;
for (int i = 0; i < 1024; ++i) {
char buf[1024]; // definitely big enough
sprintf(buf, " # Comment %d\n", i);
input += buf;
}
input += "name = value;\n";
Scanner s(input.c_str());
s.SetSkipExpression("\\s+|#.*\n");
string name;
string value;
s.Consume("(\\w+) = (\\w+);", &name, &value);
CHECK_EQ(name, "name");
CHECK_EQ(value, "value");
}
// TODO: also test scanner and big-comment in a thread with a
// small stack size
int main(int argc, char** argv) {
TestScanner();
TestBigComment();
// Done
printf("OK\n");