Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a95640ec
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a95640ec
编写于
3月 04, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 04, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2194 fix collator issue
Merge pull request !2194 from 杨清/1228
上级
5b8e55d0
c6b609ca
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
725 addition
and
0 deletion
+725
-0
global/i18n_standard/intljs/src/main/js/default/test/Intl.test.js
...18n_standard/intljs/src/main/js/default/test/Intl.test.js
+7
-0
global/perf/perfjs/src/main/js/default/test/Perf.test.js
global/perf/perfjs/src/main/js/default/test/Perf.test.js
+718
-0
未找到文件。
global/i18n_standard/intljs/src/main/js/default/test/Intl.test.js
浏览文件 @
a95640ec
...
...
@@ -1313,6 +1313,7 @@ describe('intlTest', function () {
let
value
=
coll
.
compare
(
'
a
'
,
'
b
'
);
console
.
log
(
'
collator_test_3700
'
+
value
);
expect
(
value
).
assertEqual
(
-
1
);
expect
(
coll
.
resolvedOptions
().
collation
).
assertEqual
(
'
eor
'
);
})
/* *
...
...
@@ -1325,6 +1326,7 @@ describe('intlTest', function () {
let
value
=
coll
.
compare
(
'
a
'
,
'
b
'
);
console
.
log
(
'
collator_test_3800
'
+
value
);
expect
(
value
).
assertEqual
(
-
1
);
expect
(
coll
.
resolvedOptions
().
sensitivity
).
assertEqual
(
'
base
'
);
})
/* *
...
...
@@ -1337,6 +1339,7 @@ describe('intlTest', function () {
let
value
=
coll
.
compare
(
'
a
'
,
'
b
'
);
console
.
log
(
'
collator_test_3900
'
+
value
);
expect
(
value
).
assertEqual
(
-
1
);
expect
(
coll
.
resolvedOptions
().
caseFirst
).
assertEqual
(
'
upper
'
);
})
/* *
...
...
@@ -1349,6 +1352,7 @@ describe('intlTest', function () {
let
value
=
coll
.
compare
(
'
a
'
,
'
b
'
);
console
.
log
(
'
collator_test_4000
'
+
value
);
expect
(
value
).
assertEqual
(
-
1
);
expect
(
coll
.
resolvedOptions
().
numeric
).
assertTrue
();
})
/* *
...
...
@@ -1361,6 +1365,7 @@ describe('intlTest', function () {
let
value
=
coll
.
compare
(
'
a
'
,
'
b
'
);
console
.
log
(
'
collator_test_4100
'
+
value
);
expect
(
value
).
assertEqual
(
-
1
);
expect
(
coll
.
resolvedOptions
().
ignorePunctuation
).
assertTrue
();
})
/* *
...
...
@@ -1373,6 +1378,7 @@ describe('intlTest', function () {
let
value
=
coll
.
compare
(
'
a
'
,
'
b
'
);
console
.
log
(
'
collator_test_4200
'
+
value
);
expect
(
value
).
assertEqual
(
-
1
);
expect
(
coll
.
resolvedOptions
().
usage
).
assertEqual
(
'
sort
'
);
})
/* *
...
...
@@ -1385,6 +1391,7 @@ describe('intlTest', function () {
let
value
=
coll
.
compare
(
'
a
'
,
'
b
'
);
console
.
log
(
'
collator_test_4300
'
+
value
);
expect
(
value
).
assertEqual
(
-
1
);
expect
(
coll
.
resolvedOptions
().
localeMatcher
).
assertEqual
(
'
lookup
'
);
})
/* *
...
...
global/perf/perfjs/src/main/js/default/test/Perf.test.js
浏览文件 @
a95640ec
...
...
@@ -1412,5 +1412,723 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5300
* @tc.name test the performance of is24HourClock
* @tc.desc check the performance of is24HourClock
*/
it
(
'
perf_test_5300
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5300
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
is24HourClock
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5300--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5400
* @tc.name test the performance of set24HourClock
* @tc.desc check the performance of set24HourClock
*/
it
(
'
perf_test_5400
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5400
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
set24HourClock
(
true
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5400--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5500
* @tc.name test the performance of getPreferredLanguageList
* @tc.desc check the performance of getPreferredLanguageList
*/
it
(
'
perf_test_5500
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5500
'
+
'
start
'
);
let
value
=
new
Array
();
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
getPreferredLanguageList
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5500--
'
+
'
value.length:
'
+
value
.
length
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5600
* @tc.name test the performance of getFirstPreferredLanguage
* @tc.desc check the performance of getFirstPreferredLanguage
*/
it
(
'
perf_test_5600
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5600
'
+
'
start
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
getFirstPreferredLanguage
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5600--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
20
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5700
* @tc.name test the performance of addPreferredLanguage
* @tc.desc check the performance of addPreferredLanguage
*/
it
(
'
perf_test_5700
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5700
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
addPreferredLanguage
(
'
it
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5700--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5800
* @tc.name test the performance of removePreferredLanguage
* @tc.desc check the performance of removePreferredLanguage
*/
it
(
'
perf_test_5800
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5800
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
removePreferredLanguage
(
0
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5800--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5900
* @tc.name test the performance of Locale
* @tc.desc check the performance of Locale
*/
it
(
'
perf_test_5900
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5900
'
+
'
start
'
);
let
locale
=
null
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
locale
=
new
Intl
.
Locale
(
'
en-Latn-GB
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5900--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6000
* @tc.name test the performance of toString
* @tc.desc check the performance of toString
*/
it
(
'
perf_test_6000
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_6000
'
+
'
start
'
);
let
locale
=
new
Intl
.
Locale
(
'
zh
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
locale
.
toString
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_6000--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6100
* @tc.name test the performance of minimize
* @tc.desc check the performance of minimize
*/
it
(
'
perf_test_6100
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_6100
'
+
'
start
'
);
let
locale
=
new
Intl
.
Locale
(
'
zh-Hans-CN
'
);
let
locale2
=
null
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
locale2
=
locale
.
minimize
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
let
value
=
locale2
.
toString
();
console
.
log
(
'
perf_test_6100--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6200
* @tc.name test the performance of maximize
* @tc.desc check the performance of maximize
*/
it
(
'
perf_test_6200
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_6200
'
+
'
start
'
);
let
locale
=
new
Intl
.
Locale
(
'
zh-CN
'
);
let
locale2
=
null
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
locale2
=
locale
.
maximize
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
let
value
=
locale2
.
toString
();
console
.
log
(
'
perf_test_6200--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6300
* @tc.name test the performance of DateTimeFormat
* @tc.desc check the performance of DateTimeFormat
*/
it
(
'
perf_test_6300
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_6300
'
+
'
start
'
);
let
datefmt
=
null
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
datefmt
=
new
Intl
.
DateTimeFormat
(
'
en-GB
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_6300--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6400
* @tc.name test the performance of DateTimeFormat.format
* @tc.desc check the performance of DateTimeFormat.format
*/
it
(
'
perf_test_6400
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_6400
'
+
'
start
'
);
let
date
=
new
Date
(
2021
,
11
,
17
,
3
,
24
,
0
);
let
datefmt
=
new
Intl
.
DateTimeFormat
(
'
zh
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
datefmt
.
format
(
date
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_6400--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6500
* @tc.name test the performance of DateTimeFormat.formatRange
* @tc.desc check the performance of DateTimeFormat.formatRange
*/
it
(
'
perf_test_6500
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_6500
'
+
'
start
'
);
let
startdate
=
new
Date
(
2020
,
11
,
20
,
14
,
23
,
16
);
let
enddate
=
new
Date
(
2020
,
11
,
21
,
14
,
23
,
16
);
let
datefmt
=
new
Intl
.
DateTimeFormat
(
'
en-GB
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
datefmt
.
formatRange
(
startdate
,
enddate
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_6500--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6600
* @tc.name test the performance of DateTimeFormat.resolvedOptions
* @tc.desc check the performance of DateTimeFormat.resolvedOptions
*/
it
(
'
perf_test_6600
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_6600
'
+
'
start
'
);
let
date
=
new
Date
(
2020
,
11
,
20
,
14
,
23
,
16
);
let
option
=
{
dateStyle
:
'
short
'
,
timeStyle
:
'
short
'
};
let
datefmt
=
new
Intl
.
DateTimeFormat
(
'
zh-CN
'
,
option
);
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
datefmt
.
resolvedOptions
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_6600--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6700
* @tc.name test the performance of NumberFormat
* @tc.desc check the performance of NumberFormat
*/
it
(
'
perf_test_6700
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_6700
'
+
'
start
'
);
let
numfmt
=
null
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
numfmt
=
new
Intl
.
NumberFormat
(
'
zh
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_6700--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6800
* @tc.name test the performance of NumberFormat.format
* @tc.desc check the performance of NumberFormat.format
*/
it
(
'
perf_test_6800
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_6800
'
+
'
start
'
);
let
numfmt
=
new
Intl
.
NumberFormat
(
'
zh-u-nu-latn
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
numfmt
.
format
(
123456.789
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_6800--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_6900
* @tc.name test the performance of NumberFormat.resolvedOptions
* @tc.desc check the performance of NumberFormat.resolvedOptions
*/
it
(
'
perf_test_6900
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_6900
'
+
'
start
'
);
let
numfmt
=
new
Intl
.
NumberFormat
(
'
ar
'
,
{
style
:
'
percent
'
,
minimumFractionDigits
:
1
,
maximumFractionDigits
:
2
,
minimumIntegerDigits
:
7
,
minimumSignificantDigits
:
5
,
maximumSignificantDigits
:
10
,
useGrouping
:
true
});
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
numfmt
.
resolvedOptions
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_6900--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7000
* @tc.name test the performance of PluralRules
* @tc.desc check the performance of PluralRules
*/
it
(
'
perf_test_7000
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_7000
'
+
'
start
'
);
let
pl
=
null
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
pl
=
new
Intl
.
PluralRules
(
'
zh
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_7000--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7100
* @tc.name test the performance of PluralRules.select
* @tc.desc check the performance of PluralRules.select
*/
it
(
'
perf_test_7100
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_7100
'
+
'
start
'
);
let
pl
=
new
Intl
.
PluralRules
(
'
zh
'
,
{
'
type
'
:
'
ordinal
'
});
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
pl
.
select
(
0
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_7100--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7200
* @tc.name test the performance of Collator
* @tc.desc check the performance of Collator
*/
it
(
'
perf_test_7200
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_7200
'
+
'
start
'
);
let
coll
=
null
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
coll
=
new
Intl
.
Collator
(
'
zh
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_7200--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7300
* @tc.name test the performance of Collator.compare
* @tc.desc check the performance of Collator.compare
*/
it
(
'
perf_test_7300
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_7300
'
+
'
start
'
);
let
coll
=
new
Intl
.
Collator
(
'
zh
'
,
{
'
sensitivity
'
:
'
base
'
});
let
value
=
0
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
coll
.
compare
(
'
a
'
,
'
b
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_7300--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7400
* @tc.name test the performance of Collator.compare
* @tc.desc check the performance of Collator.compare
*/
it
(
'
perf_test_7400
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_7400
'
+
'
start
'
);
let
coll
=
new
Intl
.
Collator
(
'
zh
'
,
{
'
sensitivity
'
:
'
base
'
});
let
value
=
0
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
coll
.
compare
(
'
a
'
,
'
b
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_7400--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7500
* @tc.name test the performance of Collator.resolvedOptions
* @tc.desc check the performance of Collator.resolvedOptions
*/
it
(
'
perf_test_7500
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_7500
'
+
'
start
'
);
let
coll
=
new
Intl
.
Collator
(
'
zh
'
,
{
'
sensitivity
'
:
'
base
'
});
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
coll
.
resolvedOptions
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_7500--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7600
* @tc.name test the performance of RelativeTimeFormat
* @tc.desc check the performance of RelativeTimeFormat
*/
it
(
'
perf_test_7600
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_7600
'
+
'
start
'
);
let
relativetimefmt
=
null
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
relativetimefmt
=
new
Intl
.
RelativeTimeFormat
(
'
en
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_7600--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7700
* @tc.name test the performance of RelativeTimeFormat.format
* @tc.desc check the performance of RelativeTimeFormat.format
*/
it
(
'
perf_test_7700
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_7700
'
+
'
start
'
);
let
relativetimefmt
=
new
Intl
.
RelativeTimeFormat
(
'
en
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
relativetimefmt
.
format
(
100
,
'
second
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_7700--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7800
* @tc.name test the performance of RelativeTimeFormat.formatToParts
* @tc.desc check the performance of RelativeTimeFormat.formatToParts
*/
it
(
'
perf_test_7800
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_7800
'
+
'
start
'
);
let
relativetimefmt
=
new
Intl
.
RelativeTimeFormat
(
'
en
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
relativetimefmt
.
formatToParts
(
100
,
'
second
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_7800--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_7900
* @tc.name test the performance of RelativeTimeFormat.resolvedOptions
* @tc.desc check the performance of RelativeTimeFormat.resolvedOptions
*/
it
(
'
perf_test_7900
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_7900
'
+
'
start
'
);
let
relativetimefmt
=
new
Intl
.
RelativeTimeFormat
(
'
en
'
,
{
localeMatcher
:
'
best fit
'
,
numeric
:
'
auto
'
,
style
:
'
narrow
'
});
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
relativetimefmt
.
resolvedOptions
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_7900--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
console
.
log
(
'
*************end PerfTest*************
'
);
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录