Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
26de56ee
提交
26de56ee
authored
2月 19, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Proper static stuff initialization in worker tests
上级
31cf7572
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
41 行增加
和
13 行删除
+41
-13
test-bitrate.cpp
worker/test/test-bitrate.cpp
+15
-13
tests.cpp
worker/test/tests.cpp
+26
-0
没有找到文件。
worker/test/test-bitrate.cpp
浏览文件 @
26de56ee
#include "include/catch.hpp"
#include "common.h"
#include "DepLibUV.h"
#include "RTC/RtpDataCounter.h"
#include "../include/DepLibUV.h"
#include <vector>
using
namespace
RTC
;
struct
data
{
struct
data
{
uint32_t
offset
;
uint32_t
size
;
uint32_t
rate
;
...
...
@@ -17,6 +18,7 @@ void validate(RateCalculator& rate, uint64_t time_base, std::vector<data>& inpu
for
(
auto
it
=
input
.
begin
();
it
!=
input
.
end
();
++
it
)
{
auto
&
item
=
*
it
;
rate
.
Update
(
item
.
size
,
time_base
+
item
.
offset
);
REQUIRE
(
rate
.
GetRate
(
time_base
+
item
.
offset
)
==
item
.
rate
);
}
...
...
@@ -24,14 +26,14 @@ void validate(RateCalculator& rate, uint64_t time_base, std::vector<data>& inpu
SCENARIO
(
"Bitrate calculator"
,
"[rtp][bitrate]"
)
{
DepLibUV
::
ClassInit
();
uint64_t
now
=
DepLibUV
::
GetTime
();
SECTION
(
"receive single item per 1000 ms"
)
{
RateCalculator
rate
;
std
::
vector
<
data
>
input
=
{
{
0
,
5
,
40
}
std
::
vector
<
data
>
input
=
{
{
0
,
5
,
40
}
};
validate
(
rate
,
now
,
input
);
...
...
@@ -40,11 +42,12 @@ SCENARIO("Bitrate calculator", "[rtp][bitrate]")
SECTION
(
"receive multiple items per 1000 ms"
)
{
RateCalculator
rate
;
std
::
vector
<
data
>
input
=
{
{
0
,
5
,
40
},
{
100
,
2
,
56
},
{
300
,
2
,
72
},
{
999
,
4
,
104
}
std
::
vector
<
data
>
input
=
{
{
0
,
5
,
40
},
{
100
,
2
,
56
},
{
300
,
2
,
72
},
{
999
,
4
,
104
}
};
validate
(
rate
,
now
,
input
);
...
...
@@ -53,7 +56,8 @@ SCENARIO("Bitrate calculator", "[rtp][bitrate]")
SECTION
(
"slide"
)
{
RateCalculator
rate
;
std
::
vector
<
data
>
input
=
{
std
::
vector
<
data
>
input
=
{
{
0
,
5
,
40
},
{
999
,
2
,
56
},
{
1001
,
1
,
24
},
...
...
@@ -65,6 +69,4 @@ SCENARIO("Bitrate calculator", "[rtp][bitrate]")
REQUIRE
(
rate
.
GetRate
(
now
+
3000
)
==
0
);
}
DepLibUV
::
ClassDestroy
();
}
worker/test/tests.cpp
浏览文件 @
26de56ee
...
...
@@ -3,6 +3,12 @@
#include "include/catch.hpp"
#include "Settings.h"
#include "LogLevel.h"
#include "DepLibUV.h"
#include "DepOpenSSL.h"
#include "Utils.h"
static
void
init
();
static
void
destroy
();
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -10,7 +16,27 @@ int main(int argc, char* argv[])
Settings
::
configuration
.
logTags
.
rtp
=
true
;
Settings
::
configuration
.
logTags
.
rtcp
=
true
;
init
();
int
ret
=
Catch
::
Session
().
run
(
argc
,
argv
);
destroy
();
return
ret
;
}
void
init
()
{
// Initialize static stuff.
DepLibUV
::
ClassInit
();
DepOpenSSL
::
ClassInit
();
Utils
::
Crypto
::
ClassInit
();
}
void
destroy
()
{
// Free static stuff.
Utils
::
Crypto
::
ClassDestroy
();
DepOpenSSL
::
ClassDestroy
();
DepLibUV
::
ClassDestroy
();
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论