| 32 |
// Unittest for scanner, especially GetNextComments and GetComments() |
// Unittest for scanner, especially GetNextComments and GetComments() |
| 33 |
// functionality. |
// functionality. |
| 34 |
|
|
| 35 |
|
#ifdef HAVE_CONFIG_H |
| 36 |
|
#include "config.h" |
| 37 |
|
#endif |
| 38 |
|
|
| 39 |
#include <stdio.h> |
#include <stdio.h> |
| 40 |
#include <string> |
#include <string> |
| 41 |
#include <vector> |
#include <vector> |
|
#include <pcre_stringpiece.h> |
|
|
#include <pcre_scanner.h> |
|
| 42 |
|
|
| 43 |
#ifdef _WIN32 |
#include "pcrecpp.h" |
| 44 |
# define snprintf _snprintf |
#include "pcre_stringpiece.h" |
| 45 |
#endif |
#include "pcre_scanner.h" |
| 46 |
|
|
| 47 |
#define FLAGS_unittest_stack_size 49152 |
#define FLAGS_unittest_stack_size 49152 |
| 48 |
|
|
| 128 |
static void TestBigComment() { |
static void TestBigComment() { |
| 129 |
string input; |
string input; |
| 130 |
for (int i = 0; i < 1024; ++i) { |
for (int i = 0; i < 1024; ++i) { |
| 131 |
char buf[1024]; |
char buf[1024]; // definitely big enough |
| 132 |
snprintf(buf, sizeof(buf), " # Comment %d\n", i); |
sprintf(buf, " # Comment %d\n", i); |
| 133 |
input += buf; |
input += buf; |
| 134 |
} |
} |
| 135 |
input += "name = value;\n"; |
input += "name = value;\n"; |