Expr_plus表增加中英文混合district的测试用例
This commit is contained in:
@@ -366,7 +366,7 @@
|
|||||||
"action": 1,
|
"action": 1,
|
||||||
"do_blacklist": 1,
|
"do_blacklist": 1,
|
||||||
"do_log": 1,
|
"do_log": 1,
|
||||||
"user_region": "anything",
|
"user_region": "StringScan.ExprPlus",
|
||||||
"is_valid": "yes",
|
"is_valid": "yes",
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
@@ -2290,6 +2290,33 @@
|
|||||||
"group_name": "Untitled"
|
"group_name": "Untitled"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"compile_id": 190,
|
||||||
|
"service": 1,
|
||||||
|
"action": 1,
|
||||||
|
"do_blacklist": 1,
|
||||||
|
"do_log": 1,
|
||||||
|
"user_region": "StringScan.ExprPlus",
|
||||||
|
"is_valid": "yes",
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"group_name": "Untitled",
|
||||||
|
"regions": [
|
||||||
|
{
|
||||||
|
"table_name": "HTTP_SIGNATURE",
|
||||||
|
"table_type": "expr_plus",
|
||||||
|
"table_content": {
|
||||||
|
"district": "我的DistrIct",
|
||||||
|
"keywords": "addis&sapphire",
|
||||||
|
"expr_type": "and",
|
||||||
|
"match_method": "sub",
|
||||||
|
"format": "uncase plain"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"plugin_table": [
|
"plugin_table": [
|
||||||
|
|||||||
@@ -569,25 +569,39 @@ TEST(StringScan, ExprPlus)
|
|||||||
int table_id=0;
|
int table_id=0;
|
||||||
struct Maat_rule_t result[4];
|
struct Maat_rule_t result[4];
|
||||||
int found_pos[4];
|
int found_pos[4];
|
||||||
const char* region_name="HTTP URL";
|
const char* region_name1="HTTP URL";
|
||||||
const char* scan_data="http://www.cyberessays.com/search_results.php?action=search&query=abckkk,1234567";
|
const char* region_name2="我的diStricT";
|
||||||
|
const char* scan_data1="http://www.cyberessays.com/search_results.php?action=search&query=abckkk,1234567";
|
||||||
|
const char* scan_data2="Addis Sapphire Hotel";
|
||||||
table_id=Maat_table_register(g_feather, "HTTP_SIGNATURE");
|
table_id=Maat_table_register(g_feather, "HTTP_SIGNATURE");
|
||||||
ASSERT_GT(table_id, 0);
|
ASSERT_GT(table_id, 0);
|
||||||
scan_status_t mid=NULL;
|
scan_status_t mid=NULL;
|
||||||
ret=Maat_full_scan_string(g_feather, table_id, CHARSET_GBK, scan_data, strlen(scan_data),
|
ret=Maat_full_scan_string(g_feather, table_id, CHARSET_GBK, scan_data1, strlen(scan_data1),
|
||||||
result, found_pos, 4,
|
result, found_pos, 4,
|
||||||
&mid, 0);
|
&mid, 0);
|
||||||
EXPECT_EQ(ret, -1);//Should return error for district not setting.
|
EXPECT_EQ(ret, -1);//Should return error for district not setting.
|
||||||
|
|
||||||
ret=Maat_set_scan_status(g_feather, &mid, MAAT_SET_SCAN_DISTRICT, region_name, strlen(region_name));
|
ret=Maat_set_scan_status(g_feather, &mid, MAAT_SET_SCAN_DISTRICT, region_name1, strlen(region_name1));
|
||||||
ASSERT_EQ(ret, 0);
|
ASSERT_EQ(ret, 0);
|
||||||
ret=Maat_full_scan_string(g_feather, table_id, CHARSET_GBK, scan_data, strlen(scan_data),
|
ret=Maat_full_scan_string(g_feather, table_id, CHARSET_GBK, scan_data1, strlen(scan_data1),
|
||||||
result, found_pos, 4,
|
result, found_pos, 4,
|
||||||
&mid, 0);
|
&mid, 0);
|
||||||
EXPECT_EQ(ret, 1);
|
EXPECT_EQ(ret, 1);
|
||||||
EXPECT_EQ(result[0].config_id, 128);
|
EXPECT_EQ(result[0].config_id, 128);
|
||||||
|
|
||||||
Maat_clean_status(&mid);
|
Maat_clean_status(&mid);
|
||||||
|
|
||||||
|
ret=Maat_set_scan_status(g_feather, &mid, MAAT_SET_SCAN_DISTRICT, region_name2, strlen(region_name2));
|
||||||
|
ASSERT_EQ(ret, 0);
|
||||||
|
ret=Maat_full_scan_string(g_feather, table_id, CHARSET_GBK, scan_data2, strlen(scan_data2),
|
||||||
|
result, found_pos, 4,
|
||||||
|
&mid, 0);
|
||||||
|
EXPECT_EQ(ret, 1);
|
||||||
|
EXPECT_EQ(result[0].config_id, 190);
|
||||||
|
|
||||||
|
Maat_clean_status(&mid);
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user