Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ab26b9a7
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看板
提交
ab26b9a7
编写于
3月 02, 2022
作者:
Y
y00314596
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add by yangqing3@huawei.com
Signed-off-by:
N
y00314596
<
yangqing3@huawei.com
>
上级
bb9b50de
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
281 addition
and
0 deletion
+281
-0
global/perf/perfjs/src/main/js/default/test/Perf.test.js
global/perf/perfjs/src/main/js/default/test/Perf.test.js
+238
-0
global/resmgr_standard/resmgrjs/src/main/js/default/test/Resmgr.test.js
...standard/resmgrjs/src/main/js/default/test/Resmgr.test.js
+43
-0
未找到文件。
global/perf/perfjs/src/main/js/default/test/Perf.test.js
浏览文件 @
ab26b9a7
...
...
@@ -291,5 +291,243 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1200
* @tc.name test the performance of PhoneNumberFormat
* @tc.desc check the performance of PhoneNumberFormat
*/
it
(
'
perf_test_1200
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_1200
'
+
'
start
'
);
let
phonenumber
=
null
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
phonenumber
=
new
I18n
.
PhoneNumberFormat
(
'
CN
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_1200--
'
+
'
phonenumber:
'
+
phonenumber
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1300
* @tc.name test the performance of isValidNumber
* @tc.desc check the performance of isValidNumber
*/
it
(
'
perf_test_1300
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_1300
'
+
'
start
'
);
let
phonenumber
=
new
I18n
.
PhoneNumberFormat
(
'
CN
'
);
let
valid
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
valid
=
phonenumber
.
isValidNumber
(
'
13510574676
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_1300--
'
+
'
valid:
'
+
valid
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1400
* @tc.name test the performance of format
* @tc.desc check the performance of format
*/
it
(
'
perf_test_1400
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_1400
'
+
'
start
'
);
let
phonenumber
=
new
I18n
.
PhoneNumberFormat
(
'
CN
'
);
let
value
=
'
1234
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
phonenumber
.
format
(
'
13510574676
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_1400--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1500
* @tc.name test the performance of getCalendar
* @tc.desc check the performance of getCalendar
*/
it
(
'
perf_test_1500
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_1500
'
+
'
start
'
);
let
calendar
=
null
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
calendar
=
I18n
.
getCalendar
(
'
zh
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_1500--
'
+
'
calendar:
'
+
calendar
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1600
* @tc.name test the performance of isWeekend
* @tc.desc check the performance of isWeekend
*/
it
(
'
perf_test_1600
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_1600
'
+
'
start
'
);
let
calendar
=
I18n
.
getCalendar
(
'
zh
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
calendar
.
isWeekend
(
new
Date
(
2021
,
10
,
1
,
10
,
0
,
0
,
0
));
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_1600--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1700
* @tc.name test the performance of getDisplayName
* @tc.desc check the performance of getDisplayName
*/
it
(
'
perf_test_1700
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_1700
'
+
'
start
'
);
let
calendar
=
I18n
.
getCalendar
(
'
zh
'
,
'
chinese
'
);
let
name
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
name
=
calendar
.
getDisplayName
(
'
zh
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_1700--
'
+
'
name:
'
+
name
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1800
* @tc.name test the performance of calendar.get
* @tc.desc check the performance of calendar.get
*/
it
(
'
perf_test_1800
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_1800
'
+
'
start
'
);
let
calendar
=
I18n
.
getCalendar
(
'
zh
'
);
let
value
=
0
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
calendar
.
get
(
'
year
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_1800--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_1900
* @tc.name test the performance of calendar.setTime with date param
* @tc.desc check the performance of calendar.setTime
*/
it
(
'
perf_test_1900
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_1900
'
+
'
start
'
);
let
calendar
=
I18n
.
getCalendar
(
'
zh
'
);
let
date1
=
new
Date
(
2021
,
8
,
8
,
8
,
8
,
8
,
8
);
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
calendar
.
setTime
(
date1
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_1900--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_2000
* @tc.name test the performance of calendar.setTime with time param
* @tc.desc check the performance of calendar.setTime
*/
it
(
'
perf_test_2000
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_2000
'
+
'
start
'
);
let
calendar
=
I18n
.
getCalendar
(
'
zh
'
);
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
calendar
.
setTime
(
10540800000
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_2000--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
console
.
log
(
'
*************end PerfTest*************
'
);
})
\ No newline at end of file
global/resmgr_standard/resmgrjs/src/main/js/default/test/Resmgr.test.js
浏览文件 @
ab26b9a7
...
...
@@ -341,5 +341,48 @@ describe('resMgrTest', function () {
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2000
* @tc.name test getRawFileDescriptor method in callback mode
* @tc.desc get the RawFileDescriptor in callback mode
*/
it
(
'
getRawFileDescriptor_test_001
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getRawFileDescriptor
(
'
rawfiletest.xml
'
,
(
error
,
rawfile
)
=>
{
let
fdValue
=
rawfile
.
fd
;
let
offsetValue
=
rawfile
.
offset
;
let
lengthValue
=
rawfile
.
length
;
expect
(
rawfile
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFileDescriptor_test_001--
'
+
'
fd:
'
+
fdValue
+
'
offset:
'
+
offsetValue
+
'
length:
'
+
lengthValue
);
})
})
done
();
})
/* *
* @tc.number SUB_GLOBAL_RESMGR_JS_2100
* @tc.name test getRawFileDescriptor method in promise mode
* @tc.desc get the RawFileDescriptor in promise mode
*/
it
(
'
getRawFileDescriptor_test_002
'
,
0
,
async
function
(
done
)
{
resmgr
.
getResourceManager
((
error
,
mgr
)
=>
{
mgr
.
getRawFileDescriptor
(
'
rawfiletest.xml
'
).
then
(
rawfile
=>
{
rawfile
.
fd
=
2000
;
rawfile
.
offset
=
20
;
rawfile
.
length
=
200
;
expect
(
rawfile
!==
null
).
assertTrue
();
console
.
log
(
'
getRawFileDescriptor_test_002--
'
+
rawfile
);
console
.
log
(
'
getRawFileDescriptor_test_002--
'
+
'
fd:
'
+
rawfile
.
fd
+
'
offset:
'
+
rawfile
.
offset
+
'
length:
'
+
rawfile
.
length
);
})
})
done
();
})
console
.
log
(
'
*************end ResmgrTest*************
'
);
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录