1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Merge 2.0release

This commit is contained in:
winlin 2018-11-27 21:24:51 +08:00
commit ba4ef34d27
13 changed files with 121 additions and 21 deletions

View file

@ -1408,6 +1408,15 @@ VOID TEST(KernelUtilityTest, UtilityString)
str1 = srs_string_replace(str, "o", "XX");
EXPECT_STREQ("HellXX, WXXrld! HellXX, SRS!", str1.c_str());
str1 = srs_string_trim_start(str, "x");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
str1 = srs_string_trim_start(str, "S!R");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
str1 = srs_string_trim_start(str, "lHe");
EXPECT_STREQ("o, World! Hello, SRS!", str1.c_str());
str1 = srs_string_trim_end(str, "x");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
@ -1415,7 +1424,7 @@ VOID TEST(KernelUtilityTest, UtilityString)
str1 = srs_string_trim_end(str, "He");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
str1 = srs_string_trim_end(str, "HeS!R");
str1 = srs_string_trim_end(str, "S!R");
EXPECT_STREQ("Hello, World! Hello, ", str1.c_str());
str1 = srs_string_remove(str, "x");
@ -1426,6 +1435,18 @@ VOID TEST(KernelUtilityTest, UtilityString)
str1 = srs_string_remove(str, "ol");
EXPECT_STREQ("He, Wrd! He, SRS!", str1.c_str());
str1 = srs_erase_first_substr(str, "Hello");
EXPECT_STREQ(", World! Hello, SRS!", str1.c_str());
str1 = srs_erase_first_substr(str, "XX");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
str1 = srs_erase_last_substr(str, "Hello");
EXPECT_STREQ("Hello, World! , SRS!", str1.c_str());
str1 = srs_erase_last_substr(str, "XX");
EXPECT_STREQ("Hello, World! Hello, SRS!", str1.c_str());
EXPECT_FALSE(srs_string_ends_with("Hello", "x"));
EXPECT_TRUE(srs_string_ends_with("Hello", "o"));

View file

@ -556,6 +556,16 @@ VOID TEST(ProtocolUtilityTest, DiscoveryTcUrl)
EXPECT_STREQ("live", app.c_str());
EXPECT_STREQ("show", stream.c_str());
EXPECT_EQ(19351, port);
// _definst_ at the end of app
tcUrl = "rtmp://winlin.cn/live/_definst_"; stream= "show";
srs_discovery_tc_url(tcUrl, schema, ip, vhost, app, stream, port, param);
EXPECT_STREQ("rtmp", schema.c_str());
EXPECT_STREQ("winlin.cn", ip.c_str());
EXPECT_STREQ("winlin.cn", vhost.c_str());
EXPECT_STREQ("live", app.c_str());
EXPECT_STREQ("show", stream.c_str());
EXPECT_EQ(1935, port);
}
/**