正在显示
4 个修改的文件
包含
106 行增加
和
1 行删除
@@ -517,7 +517,8 @@ fi | @@ -517,7 +517,8 @@ fi | ||
517 | # | 517 | # |
518 | # utest, the unit-test cases of srs, base on gtest1.6 | 518 | # utest, the unit-test cases of srs, base on gtest1.6 |
519 | MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_handshake" | 519 | MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_handshake" |
520 | - "srs_utest_buffer" "srs_utest_protocol" "srs_utest_kernel") | 520 | + "srs_utest_buffer" "srs_utest_protocol" "srs_utest_kernel" |
521 | + "srs_utest_core") | ||
521 | ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot}) | 522 | ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot}) |
522 | ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile}) | 523 | ModuleLibFiles=(${LibSTfile} ${LibHttpParserfile} ${LibSSLfile}) |
523 | MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") | 524 | MODULE_DEPENDS=("CORE" "KERNEL" "RTMP" "APP") |
@@ -114,6 +114,8 @@ file | @@ -114,6 +114,8 @@ file | ||
114 | ..\utest\srs_utest_amf0.cpp, | 114 | ..\utest\srs_utest_amf0.cpp, |
115 | ..\utest\srs_utest_buffer.hpp, | 115 | ..\utest\srs_utest_buffer.hpp, |
116 | ..\utest\srs_utest_buffer.cpp, | 116 | ..\utest\srs_utest_buffer.cpp, |
117 | + ..\utest\srs_utest_core.hpp, | ||
118 | + ..\utest\srs_utest_core.cpp, | ||
117 | ..\utest\srs_utest_handshake.hpp, | 119 | ..\utest\srs_utest_handshake.hpp, |
118 | ..\utest\srs_utest_handshake.cpp, | 120 | ..\utest\srs_utest_handshake.cpp, |
119 | ..\utest\srs_utest_kernel.hpp, | 121 | ..\utest\srs_utest_kernel.hpp, |
trunk/src/utest/srs_utest_core.cpp
0 → 100644
1 | +/* | ||
2 | +The MIT License (MIT) | ||
3 | + | ||
4 | +Copyright (c) 2013-2014 winlin | ||
5 | + | ||
6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
7 | +this software and associated documentation files (the "Software"), to deal in | ||
8 | +the Software without restriction, including without limitation the rights to | ||
9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
11 | +subject to the following conditions: | ||
12 | + | ||
13 | +The above copyright notice and this permission notice shall be included in all | ||
14 | +copies or substantial portions of the Software. | ||
15 | + | ||
16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
22 | +*/ | ||
23 | +#include <srs_utest_core.hpp> | ||
24 | + | ||
25 | +using namespace std; | ||
26 | + | ||
27 | +#include <srs_core_autofree.hpp> | ||
28 | + | ||
29 | +VOID TEST(CoreAutoFreeTest, Free) | ||
30 | +{ | ||
31 | + char* data = new char[32]; | ||
32 | + srs_freep(data); | ||
33 | + EXPECT_TRUE(data == NULL); | ||
34 | + | ||
35 | + if (true) { | ||
36 | + data = new char[32]; | ||
37 | + SrsAutoFree(char, data); | ||
38 | + } | ||
39 | + EXPECT_TRUE(data == NULL); | ||
40 | +} | ||
41 | + | ||
42 | +VOID TEST(CoreMacroseTest, Check) | ||
43 | +{ | ||
44 | +#ifndef SRS_AUTO_BUILD_TS | ||
45 | + EXPECT_TRUE(false); | ||
46 | +#endif | ||
47 | +#ifndef SRS_AUTO_BUILD_DATE | ||
48 | + EXPECT_TRUE(false); | ||
49 | +#endif | ||
50 | +#ifndef SRS_AUTO_UNAME | ||
51 | + EXPECT_TRUE(false); | ||
52 | +#endif | ||
53 | +#ifndef SRS_AUTO_USER_CONFIGURE | ||
54 | + EXPECT_TRUE(false); | ||
55 | +#endif | ||
56 | +#ifndef SRS_AUTO_CONFIGURE | ||
57 | + EXPECT_TRUE(false); | ||
58 | +#endif | ||
59 | +#ifndef SRS_AUTO_EMBEDED_TOOL_CHAIN | ||
60 | + EXPECT_TRUE(false); | ||
61 | +#endif | ||
62 | +#ifndef SRS_AUTO_PREFIX | ||
63 | + EXPECT_TRUE(false); | ||
64 | +#endif | ||
65 | +#ifndef SRS_AUTO_CONSTRIBUTORS | ||
66 | + EXPECT_TRUE(false); | ||
67 | +#endif | ||
68 | +} |
trunk/src/utest/srs_utest_core.hpp
0 → 100644
1 | +/* | ||
2 | +The MIT License (MIT) | ||
3 | + | ||
4 | +Copyright (c) 2013-2014 winlin | ||
5 | + | ||
6 | +Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
7 | +this software and associated documentation files (the "Software"), to deal in | ||
8 | +the Software without restriction, including without limitation the rights to | ||
9 | +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
10 | +the Software, and to permit persons to whom the Software is furnished to do so, | ||
11 | +subject to the following conditions: | ||
12 | + | ||
13 | +The above copyright notice and this permission notice shall be included in all | ||
14 | +copies or substantial portions of the Software. | ||
15 | + | ||
16 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
18 | +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
19 | +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
20 | +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
21 | +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
22 | +*/ | ||
23 | + | ||
24 | +#ifndef SRS_UTEST_CORE_HPP | ||
25 | +#define SRS_UTEST_CORE_HPP | ||
26 | + | ||
27 | +/* | ||
28 | +#include <srs_utest_core.hpp> | ||
29 | +*/ | ||
30 | +#include <srs_utest.hpp> | ||
31 | + | ||
32 | +#include <string> | ||
33 | + | ||
34 | +#endif |
-
请 注册 或 登录 后发表评论