Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
459bcf86
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
459bcf86
编写于
4月 06, 2021
作者:
O
openharmony_ci
提交者:
Gitee
4月 06, 2021
浏览文件
操作
浏览文件
下载
差异文件
!109 Resolve failed test cases:ActsTimeApiTest#TimeUtilsTest#testStrftime&testWcsftime
Merge pull request !109 from 南先森/master
上级
ccc3d1ee
fde5f3ad
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
5 deletion
+7
-5
kernel_lite/time_posix/src/TimeUtilsTest.cpp
kernel_lite/time_posix/src/TimeUtilsTest.cpp
+7
-5
未找到文件。
kernel_lite/time_posix/src/TimeUtilsTest.cpp
浏览文件 @
459bcf86
...
@@ -249,6 +249,7 @@ HWTEST_F(TimeUtilsTest, testMktime, Function | MediumTest | Level2)
...
@@ -249,6 +249,7 @@ HWTEST_F(TimeUtilsTest, testMktime, Function | MediumTest | Level2)
*/
*/
HWTEST_F
(
TimeUtilsTest
,
testStrftime
,
Function
|
MediumTest
|
Level3
)
HWTEST_F
(
TimeUtilsTest
,
testStrftime
,
Function
|
MediumTest
|
Level3
)
{
{
size_t
strftimeBytes
=
19
;
char
buffer
[
80
]
=
{
0
};
char
buffer
[
80
]
=
{
0
};
time_t
mtime
=
18880
;
time_t
mtime
=
18880
;
struct
tm
*
localTime
=
localtime
(
&
mtime
);
struct
tm
*
localTime
=
localtime
(
&
mtime
);
...
@@ -276,8 +277,8 @@ HWTEST_F(TimeUtilsTest, testStrftime, Function | MediumTest | Level3)
...
@@ -276,8 +277,8 @@ HWTEST_F(TimeUtilsTest, testStrftime, Function | MediumTest | Level3)
EXPECT_STREQ
(
buffer
,
"12/13/01 20:45:52"
)
<<
"buffer return error!"
;
EXPECT_STREQ
(
buffer
,
"12/13/01 20:45:52"
)
<<
"buffer return error!"
;
ftime
=
strftime
(
buffer
,
sizeof
(
buffer
)
-
1
,
"%Y-%m-%d %H:%M:%S"
,
localTime
);
ftime
=
strftime
(
buffer
,
sizeof
(
buffer
)
-
1
,
"%Y-%m-%d %H:%M:%S"
,
localTime
);
EXPECT_EQ
(
ftime
,
g_zero
)
<<
"strftime return error!"
;
EXPECT_EQ
(
ftime
,
strftimeBytes
)
<<
"strftime return error!"
;
EXPECT_STREQ
(
buffer
,
"1901-12-13"
)
<<
"buffer return error!"
;
EXPECT_STREQ
(
buffer
,
"1901-12-13
20:45:52
"
)
<<
"buffer return error!"
;
}
}
/**
/**
...
@@ -304,18 +305,19 @@ HWTEST_F(TimeUtilsTest, testStrftimeL, Function | MediumTest | Level2)
...
@@ -304,18 +305,19 @@ HWTEST_F(TimeUtilsTest, testStrftimeL, Function | MediumTest | Level2)
*/
*/
HWTEST_F
(
TimeUtilsTest
,
testWcsftime
,
Function
|
MediumTest
|
Level2
)
HWTEST_F
(
TimeUtilsTest
,
testWcsftime
,
Function
|
MediumTest
|
Level2
)
{
{
size_t
wcsftimeBytes
=
33
;
wchar_t
buff
[
48
]
=
{
0
};
wchar_t
buff
[
48
]
=
{
0
};
struct
tm
*
localTime
=
localtime
(
&
g_time
);
struct
tm
*
localTime
=
localtime
(
&
g_time
);
ASSERT_NE
(
nullptr
,
localTime
);
ASSERT_NE
(
nullptr
,
localTime
);
size_t
len
=
wcsftime
(
buff
,
sizeof
(
buff
)
-
1
,
L"%A %c"
,
localTime
);
size_t
len
=
wcsftime
(
buff
,
sizeof
(
buff
)
-
1
,
L"%A %c"
,
localTime
);
LOG
(
"buff = %ls, len = %ld
\n
"
,
buff
,
(
long
)
len
);
LOG
(
"buff = %ls, len = %ld
\n
"
,
buff
,
(
long
)
len
);
EXPECT_EQ
(
len
,
(
size_t
)
33
)
<<
"wcsftime return error!"
;
EXPECT_EQ
(
len
,
wcsftimeBytes
)
<<
"wcsftime return error!"
;
EXPECT_STREQ
(
buff
,
L"Thursday Thu Jan 1 05:14:40 1970"
)
<<
"buff return error!"
;
EXPECT_STREQ
(
buff
,
L"Thursday Thu Jan 1 05:14:40 1970"
)
<<
"buff return error!"
;
localTime
=
localtime
(
&
g_time
);
localTime
=
localtime
(
&
g_time
);
ASSERT_NE
(
nullptr
,
localTime
);
ASSERT_NE
(
nullptr
,
localTime
);
len
=
wcsftime
(
buff
,
sizeof
(
buff
)
-
1
,
L"%A %c"
,
localTime
);
len
=
wcsftime
(
buff
,
sizeof
(
buff
)
-
1
,
L"%A %c"
,
localTime
);
LOG
(
"buff = %ls, len = %ld
\n
"
,
buff
,
(
long
)
len
);
LOG
(
"buff = %ls, len = %ld
\n
"
,
buff
,
(
long
)
len
);
EXPECT_EQ
(
len
,
g_zero
)
<<
"wcsftime return error!"
;
EXPECT_EQ
(
len
,
wcsftimeBytes
)
<<
"wcsftime return error!"
;
EXPECT_STREQ
(
buff
,
L"Thursday"
)
<<
"buff return error!"
;
EXPECT_STREQ
(
buff
,
L"Thursday
Thu Jan 1 05:14:40 1970
"
)
<<
"buff return error!"
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录