MCPcopy Create free account
hub / github.com/catboost/catboost / Y_UNIT_TEST

Function Y_UNIT_TEST

library/cpp/string_utils/url/url_ut.cpp:8–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7Y_UNIT_TEST_SUITE(TUtilUrlTest) {
8 Y_UNIT_TEST(TestGetHostAndGetHostAndPort) {
9 UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru/bebe"));
10 UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHostAndPort("ya.ru/bebe"));
11 UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru"));
12 UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHostAndPort("ya.ru"));
13 UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru:8080"));
14 UNIT_ASSERT_VALUES_EQUAL("ya.ru:8080", GetHostAndPort("ya.ru:8080"));
15 UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru/bebe:8080"));
16 UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHostAndPort("ya.ru/bebe:8080"));
17 UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("ya.ru:8080/bebe"));
18 UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetHost("https://ya.ru:8080/bebe"));
19 UNIT_ASSERT_VALUES_EQUAL("www.ya.ru", GetHost("www.ya.ru:8080/bebe"));
20 UNIT_ASSERT_VALUES_EQUAL("www.ya.ru", GetHost("https://www.ya.ru:8080/bebe"));
21 UNIT_ASSERT_VALUES_EQUAL("ya.ru:8080", GetHostAndPort("ya.ru:8080/bebe"));
22 // irl RFC3986 sometimes gets ignored
23 UNIT_ASSERT_VALUES_EQUAL("pravda-kmv.ru", GetHost("pravda-kmv.ru?page=news&id=6973"));
24 UNIT_ASSERT_VALUES_EQUAL("pravda-kmv.ru", GetHostAndPort("pravda-kmv.ru?page=news&id=6973"));
25 // check simple string
26 UNIT_ASSERT_VALUES_EQUAL("some_blender_url", GetHost("some_blender_url"));
27 UNIT_ASSERT_VALUES_EQUAL("", GetHost(""));
28 }
29
30 Y_UNIT_TEST(TestGetSchemeHostAndPortWithoutSplit) {
31 UNIT_ASSERT_VALUES_EQUAL("ya.ru", GetSchemeHostAndPort("ya.ru/bebe"));

Callers

nothing calls this directly

Calls 15

GetHostFunction · 0.85
GetHostAndPortFunction · 0.85
GetSchemeHostAndPortFunction · 0.85
GetSchemeHostFunction · 0.85
GetPathAndQueryFunction · 0.85
GetDomainFunction · 0.85
GetParentDomainFunction · 0.85
GetZoneFunction · 0.85
AddSchemePrefixFunction · 0.85
GetSchemePrefixFunction · 0.85
CutSchemePrefixFunction · 0.85
CutHttpPrefixFunction · 0.85

Tested by

no test coverage detected