Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-03-08 14:05:45 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4a0023ae63bbb447bd912d6094c18eae0463ad49
4a0023ae
1 parent
cae8228b
amf0 utest: finish utest for string to any
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
27 行增加
和
0 行删除
trunk/src/rtmp/srs_protocol_amf0.hpp
trunk/src/utest/srs_utest_amf0.cpp
trunk/src/rtmp/srs_protocol_amf0.hpp
查看文件 @
4a0023a
...
...
@@ -60,6 +60,10 @@ public:
virtual
bool
is_object_eof
();
virtual
bool
is_ecma_array
();
public
:
/**
* get the string of any when is_string() indicates true.
* user must ensure the type is a string, or assert failed.
*/
virtual
std
::
string
to_str
();
public
:
virtual
int
size
()
=
0
;
...
...
trunk/src/utest/srs_utest_amf0.cpp
查看文件 @
4a0023a
...
...
@@ -22,6 +22,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <srs_utest_amf0.hpp>
#include <srs_core_autofree.hpp>
VOID
TEST
(
AMF0Test
,
Size
)
{
// size of elem
...
...
@@ -259,3 +261,24 @@ VOID TEST(AMF0Test, Size)
EXPECT_EQ
(
size
,
SrsAmf0Size
::
array
(
&
o
));
}
}
VOID
TEST
(
AMF0Test
,
AnyElem
)
{
SrsAmf0Any
*
o
=
NULL
;
// string
if
(
true
)
{
o
=
SrsAmf0Any
::
str
();
SrsAutoFree
(
SrsAmf0Any
,
o
,
false
);
EXPECT_TRUE
(
NULL
!=
o
);
EXPECT_TRUE
(
o
->
is_string
());
EXPECT_STREQ
(
""
,
o
->
to_str
().
c_str
());
}
if
(
true
)
{
o
=
SrsAmf0Any
::
str
(
"winlin"
);
SrsAutoFree
(
SrsAmf0Any
,
o
,
false
);
EXPECT_TRUE
(
NULL
!=
o
);
EXPECT_TRUE
(
o
->
is_string
());
EXPECT_STREQ
(
"winlin"
,
o
->
to_str
().
c_str
());
}
}
...
...
请
注册
或
登录
后发表评论