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

add reload utest.

This commit is contained in:
winlin 2014-08-05 09:16:25 +08:00
parent daa382fee5
commit 798f9139a4
12 changed files with 151 additions and 42 deletions

View file

@ -29,6 +29,47 @@ using namespace std;
#include <srs_kernel_error.hpp>
#include <srs_app_source.hpp>
MockSrsConfigBuffer::MockSrsConfigBuffer(string buf)
{
// read all.
int filesize = (int)buf.length();
if (filesize <= 0) {
return;
}
// create buffer
pos = last = start = new char[filesize];
end = start + filesize;
memcpy(start, buf.data(), filesize);
}
MockSrsConfigBuffer::~MockSrsConfigBuffer()
{
}
int MockSrsConfigBuffer::fullfill(const char* /*filename*/)
{
return ERROR_SUCCESS;
}
MockSrsConfig::MockSrsConfig()
{
}
MockSrsConfig::~MockSrsConfig()
{
}
int MockSrsConfig::parse(string buf)
{
MockSrsConfigBuffer buffer(buf);
return parse_buffer(&buffer);
}
#ifdef ENABLE_UTEST_CONFIG
#define _MIN_OK_CONF "listen 1935; "
// full.conf
@ -993,45 +1034,6 @@ std::string __full_conf = ""
"} \n"
;
MockSrsConfigBuffer::MockSrsConfigBuffer(string buf)
{
// read all.
int filesize = (int)buf.length();
if (filesize <= 0) {
return;
}
// create buffer
pos = last = start = new char[filesize];
end = start + filesize;
memcpy(start, buf.data(), filesize);
}
MockSrsConfigBuffer::~MockSrsConfigBuffer()
{
}
int MockSrsConfigBuffer::fullfill(const char* /*filename*/)
{
return ERROR_SUCCESS;
}
MockSrsConfig::MockSrsConfig()
{
}
MockSrsConfig::~MockSrsConfig()
{
}
int MockSrsConfig::parse(string buf)
{
MockSrsConfigBuffer buffer(buf);
return parse_buffer(&buffer);
}
VOID TEST(ConfigTest, CheckMacros)
{
#ifndef SRS_CONSTS_LOCALHOST
@ -5452,3 +5454,5 @@ VOID TEST(ConfigMainTest, CheckConf_pithy_print)
}
}
#endif