diff options
| author | liuxueli <[email protected]> | 2023-06-18 15:57:17 +0800 |
|---|---|---|
| committer | liuxueli <[email protected]> | 2023-06-18 15:57:17 +0800 |
| commit | 9b78e751c1e482c034e39bcc48aa1648501ee09f (patch) | |
| tree | e2db95272ad784e16b6d930153e2a1dbc3d652f2 /test | |
| parent | a9bf36ac67f0131a0f16a061358affaab71d541a (diff) | |
仅支持4级及以上IP归属地
Diffstat (limited to 'test')
| -rw-r--r-- | test/bin/gtest_maat.json | 4 | ||||
| -rw-r--r-- | test/src/gtest_bridge.cpp | 6 | ||||
| -rw-r--r-- | test/src/gtest_rule.cpp | 9 | ||||
| -rw-r--r-- | test/src/gtest_tableinfo.cpp | 4 |
4 files changed, 16 insertions, 7 deletions
diff --git a/test/bin/gtest_maat.json b/test/bin/gtest_maat.json index 0fc10df..b92c120 100644 --- a/test/bin/gtest_maat.json +++ b/test/bin/gtest_maat.json @@ -1153,7 +1153,7 @@ "table_content": { "format": "uncase plain", "match_method": "complete", - "keywords": "country_full_test..city_full_test.", + "keywords": "country_full_test..city_full_test..", "expr_type": "none" } } @@ -1184,7 +1184,7 @@ "table_content": { "format": "uncase plain", "match_method": "complete", - "keywords": "country_full_test..city_full_test.", + "keywords": "country_full_test..city_full_test..", "expr_type": "none" } } diff --git a/test/src/gtest_bridge.cpp b/test/src/gtest_bridge.cpp index 562d172..209ff3c 100644 --- a/test/src/gtest_bridge.cpp +++ b/test/src/gtest_bridge.cpp @@ -707,6 +707,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457) srt_attribute->client_location->province_full=(char *)"beijing"; srt_attribute->client_location->city_full=(char *)"west"; srt_attribute->client_location->subdivision_addr=(char *)"yuming road"; + srt_attribute->client_location->full_location=(char *)"china.beijing.west.yuming road."; srt_attribute->server_location=(struct location_info *)dictator_malloc(0, sizeof(struct location_info)); srt_attribute->server_location->ref_cnt=1; @@ -714,6 +715,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457) srt_attribute->server_location->province_full=(char *)"shanghai"; srt_attribute->server_location->city_full=(char *)"east"; srt_attribute->server_location->subdivision_addr=(char *)"zhongshan road"; + srt_attribute->server_location->full_location=(char *)"china.shanghai.east.zhongshan road."; srt_attribute->client_subscribe_id=(struct subscribe_id_info *)dictator_malloc(0, sizeof(struct subscribe_id_info)); srt_attribute->client_subscribe_id->ref_cnt=1; @@ -807,6 +809,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457) EXPECT_STREQ("beijing", srt_attribute_out->client_location->province_full); EXPECT_STREQ("west", srt_attribute_out->client_location->city_full); EXPECT_STREQ("yuming road", srt_attribute_out->client_location->subdivision_addr); + EXPECT_STREQ("china.beijing.west.yuming road.", srt_attribute_out->client_location->full_location); const struct location_info *c_location=srt_attribute_get_client_ip_location((const struct session_runtime_attribute *)srt_attribute_out); EXPECT_NE(nullptr, c_location); @@ -815,6 +818,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457) EXPECT_STREQ("beijing", c_location->province_full); EXPECT_STREQ("west", c_location->city_full); EXPECT_STREQ("yuming road", c_location->subdivision_addr); + EXPECT_STREQ("china.beijing.west.yuming road.", c_location->full_location); EXPECT_NE(nullptr, srt_attribute_out->server_location); EXPECT_EQ(1, srt_attribute_out->server_location->ref_cnt); @@ -822,6 +826,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457) EXPECT_STREQ("shanghai", srt_attribute_out->server_location->province_full); EXPECT_STREQ("east", srt_attribute_out->server_location->city_full); EXPECT_STREQ("zhongshan road", srt_attribute_out->server_location->subdivision_addr); + EXPECT_STREQ("china.shanghai.east.zhongshan road.", srt_attribute_out->server_location->full_location); const struct location_info *s_location=srt_attribute_get_server_ip_location((const struct session_runtime_attribute *)srt_attribute_out); EXPECT_NE(nullptr, s_location); @@ -830,6 +835,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457) EXPECT_STREQ("shanghai", s_location->province_full); EXPECT_STREQ("east", s_location->city_full); EXPECT_STREQ("zhongshan road", s_location->subdivision_addr); + EXPECT_STREQ("china.shanghai.east.zhongshan road.", s_location->full_location); EXPECT_NE(nullptr, srt_attribute_out->client_subscribe_id); EXPECT_EQ(1, srt_attribute_out->client_subscribe_id->ref_cnt); diff --git a/test/src/gtest_rule.cpp b/test/src/gtest_rule.cpp index a3082af..012f0ea 100644 --- a/test/src/gtest_rule.cpp +++ b/test/src/gtest_rule.cpp @@ -206,7 +206,8 @@ TEST(TM, ExDataLocationBuiltIn) EXPECT_STREQ("Other", location->city_full); EXPECT_STREQ("Hong Kong", location->country_full); EXPECT_STREQ("Other", location->province_full); - EXPECT_STREQ(NULL, location->subdivision_addr); + EXPECT_STREQ("Road1", location->subdivision_addr); + EXPECT_STREQ("Hong Kong.Other.Other.Road1.", location->full_location); EXPECT_EQ(2, location->ref_cnt); temp_addr.ipv4 = inet_addr("192.168.50.2"); @@ -215,7 +216,8 @@ TEST(TM, ExDataLocationBuiltIn) EXPECT_STREQ("Xin Xi Gang", location->city_full); EXPECT_STREQ("China", location->country_full); EXPECT_STREQ("Beijing", location->province_full); - EXPECT_STREQ(NULL, location->subdivision_addr); // location_field_num == 18; not 19 + EXPECT_STREQ("Road1", location->subdivision_addr); + EXPECT_STREQ("China.Beijing.Xin Xi Gang.Road1.", location->full_location); EXPECT_EQ(2, location->ref_cnt); location = NULL; @@ -240,7 +242,8 @@ TEST(TM, ExDataLocationUserDefine) EXPECT_STREQ("Hua Yan Bei Li", location->city_full); EXPECT_STREQ("China", location->country_full); EXPECT_STREQ("Beijing", location->province_full); - EXPECT_STREQ(NULL, location->subdivision_addr); // location_field_num == 18; not 19 + EXPECT_STREQ("Road1", location->subdivision_addr); + EXPECT_STREQ("China.Beijing.Hua Yan Bei Li.Road1.", location->full_location); EXPECT_EQ(2, location->ref_cnt); location = NULL; diff --git a/test/src/gtest_tableinfo.cpp b/test/src/gtest_tableinfo.cpp index 43d10b4..1492536 100644 --- a/test/src/gtest_tableinfo.cpp +++ b/test/src/gtest_tableinfo.cpp @@ -757,7 +757,7 @@ TEST(TSG_Table, TSG_SECURITY_SOURCE_LOCATION) struct location_info location = {0}; location.country_full = (char *)"country_full_test"; location.city_full = (char *)"city_full_test"; - location.full_location=(char *)"country_full_test..city_full_test."; + location.full_location=(char *)"country_full_test..city_full_test.."; location.full_location_len=strlen(location.full_location); struct maat_state *mid = maat_state_new(g_tsg_maat_feather, a_stream.threadnum); struct maat_rule results[MAX_RESULT_NUM] = {0}; @@ -774,7 +774,7 @@ TEST(TSG_Table, TSG_SECURITY_DESTINATION_LOCATION) struct location_info location = {0}; location.country_full = (char *)"country_full_test"; location.city_full = (char *)"city_full_test"; - location.full_location=(char *)"country_full_test..city_full_test."; + location.full_location=(char *)"country_full_test..city_full_test.."; location.full_location_len=strlen(location.full_location); struct maat_state *mid = maat_state_new(g_tsg_maat_feather, a_stream.threadnum); struct maat_rule results[MAX_RESULT_NUM] = {0}; |
