mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Refien utest for log heaer generating.
This commit is contained in:
parent
80bac7d982
commit
36bfbb902b
1 changed files with 6 additions and 4 deletions
|
@ -1245,29 +1245,31 @@ VOID TEST(TCPServerTest, ContextUtility)
|
||||||
EXPECT_EQ(0, ctx.set_id(100));
|
EXPECT_EQ(0, ctx.set_id(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int base_size = 0;
|
||||||
if (true) {
|
if (true) {
|
||||||
int size = 0; char buf[1024]; HELPER_ARRAY_INIT(buf, 1024, 0);
|
int size = 0; char buf[1024]; HELPER_ARRAY_INIT(buf, 1024, 0);
|
||||||
ASSERT_TRUE(srs_log_header(buf, 1024, true, true, "SRS", 100, "Trace", &size));
|
ASSERT_TRUE(srs_log_header(buf, 1024, true, true, "SRS", 100, "Trace", &size));
|
||||||
EXPECT_EQ(53, size);
|
base_size = size;
|
||||||
|
EXPECT_TRUE(base_size > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
int size = 0; char buf[1024]; HELPER_ARRAY_INIT(buf, 1024, 0);
|
int size = 0; char buf[1024]; HELPER_ARRAY_INIT(buf, 1024, 0);
|
||||||
ASSERT_TRUE(srs_log_header(buf, 1024, false, true, "SRS", 100, "Trace", &size));
|
ASSERT_TRUE(srs_log_header(buf, 1024, false, true, "SRS", 100, "Trace", &size));
|
||||||
EXPECT_EQ(53, size);
|
EXPECT_EQ(base_size, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
int size = 0; char buf[1024]; HELPER_ARRAY_INIT(buf, 1024, 0);
|
int size = 0; char buf[1024]; HELPER_ARRAY_INIT(buf, 1024, 0);
|
||||||
ASSERT_TRUE(srs_log_header(buf, 1024, false, true, NULL, 100, "Trace", &size));
|
ASSERT_TRUE(srs_log_header(buf, 1024, false, true, NULL, 100, "Trace", &size));
|
||||||
EXPECT_EQ(48, size);
|
EXPECT_EQ(base_size - 5, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
int size = 0; char buf[1024]; HELPER_ARRAY_INIT(buf, 1024, 0);
|
int size = 0; char buf[1024]; HELPER_ARRAY_INIT(buf, 1024, 0);
|
||||||
ASSERT_TRUE(srs_log_header(buf, 1024, false, false, NULL, 100, "Trace", &size));
|
ASSERT_TRUE(srs_log_header(buf, 1024, false, false, NULL, 100, "Trace", &size));
|
||||||
EXPECT_EQ(45, size);
|
EXPECT_EQ(base_size - 8, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true) {
|
if (true) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue