@@ -16,7 +16,7 @@ TEST(PatternReplace, Grouping1)
|
||||
char* output=NULL;
|
||||
size_t output_sz=0;
|
||||
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz);
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz, 1);
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
// EXPECT_STREQ(output, expect);
|
||||
printf("%s\n", output);
|
||||
@@ -31,7 +31,7 @@ TEST(PatternReplace, Grouping2)
|
||||
char* output=NULL;
|
||||
size_t output_sz=0;
|
||||
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz);
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz, 1);
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
EXPECT_TRUE(NULL==strstr(output, "中央空调"));
|
||||
EXPECT_TRUE(NULL!=strstr(output, "中央Air conditioner"));
|
||||
@@ -68,7 +68,7 @@ TEST(PatternReplace, Non_Zero_Terminated)
|
||||
|
||||
char* output=NULL;
|
||||
size_t output_sz=0;
|
||||
simple_replace(find, replacement, input, input_sz, &output, &output_sz);
|
||||
simple_replace(find, replacement, input, input_sz, &output, &output_sz, 1);
|
||||
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
EXPECT_TRUE(NULL==memmem(output, output_sz, find, strlen(find)));
|
||||
@@ -89,7 +89,7 @@ TEST(PatternReplace, ASCII)
|
||||
char* output=NULL;
|
||||
size_t output_sz=0;
|
||||
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz);
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz, 1);
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
EXPECT_TRUE(NULL==strstr(output, find));
|
||||
EXPECT_TRUE(NULL!=strstr(output, replacement));
|
||||
@@ -107,7 +107,7 @@ TEST(PatternReplace, UTF8)
|
||||
char* output=NULL;
|
||||
size_t output_sz=0;
|
||||
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz);
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz, 1);
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
EXPECT_TRUE(NULL==strstr(output, find));
|
||||
EXPECT_TRUE(NULL!=strstr(output, replacement));
|
||||
@@ -124,7 +124,7 @@ TEST(PatternReplace, CaseInsensitive)
|
||||
char* output=NULL;
|
||||
size_t output_sz=0;
|
||||
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz);
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz, 1);
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
EXPECT_TRUE(NULL==strstr(output, find));
|
||||
EXPECT_TRUE(NULL!=strstr(output, replacement));
|
||||
@@ -148,7 +148,7 @@ TEST(PatternReplace, CaseInsensitiveRussian)
|
||||
char* output=NULL;
|
||||
size_t output_sz=0;
|
||||
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz);
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz, 1);
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
EXPECT_TRUE(NULL==strstr(output, find));
|
||||
EXPECT_TRUE(NULL!=strstr(output, replacement));
|
||||
@@ -165,7 +165,7 @@ TEST(PatternReplace, QueryAdd)
|
||||
char* output=NULL;
|
||||
size_t output_sz=0;
|
||||
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz);
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz, 1);
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
EXPECT_TRUE(NULL==strstr(output, find));
|
||||
EXPECT_TRUE(NULL!=strstr(output, replacement));
|
||||
@@ -184,7 +184,7 @@ TEST(PatternReplace, QueryDel)
|
||||
char* output=NULL;
|
||||
size_t output_sz=0;
|
||||
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz);
|
||||
simple_replace(find, replacement, input, strlen(input),&output, &output_sz, 1);
|
||||
EXPECT_TRUE(output_sz>0);
|
||||
EXPECT_TRUE(NULL==strstr(output, find));
|
||||
EXPECT_TRUE(NULL!=strstr(output, replacement));
|
||||
|
||||
Reference in New Issue
Block a user