Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
87abd40c
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看板
未验证
提交
87abd40c
编写于
3月 04, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 04, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2189 modify testcases on 20220304
Merge pull request !2189 from 杨清/1228
上级
18c54db7
85aad14d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
435 addition
and
13 deletion
+435
-13
global/i18n_standard/intljs/src/main/js/default/test/Lang.test.js
...18n_standard/intljs/src/main/js/default/test/Lang.test.js
+40
-13
global/perf/perfjs/src/main/js/default/test/Perf.test.js
global/perf/perfjs/src/main/js/default/test/Perf.test.js
+395
-0
未找到文件。
global/i18n_standard/intljs/src/main/js/default/test/Lang.test.js
浏览文件 @
87abd40c
...
...
@@ -203,12 +203,19 @@ describe('LangTest', function () {
*/
it
(
'
i18n_test_preferredlanguage_0300
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0300
'
+
'
start
'
);
let
value
=
I18n
.
addPreferredLanguage
(
'
en
'
,
0
);
console
.
log
(
'
i18n_test_preferredlanguage_0300
'
+
value
);
expect
(
value
).
assertTrue
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0300
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
if
(
list
[
0
]
!=
'
en
'
){
let
value
=
I18n
.
addPreferredLanguage
(
'
en
'
,
0
);
console
.
log
(
'
i18n_test_preferredlanguage_0300
'
+
value
);
expect
(
value
).
assertTrue
();
}
else
{
let
value
=
I18n
.
addPreferredLanguage
(
'
zh
'
,
0
);
console
.
log
(
'
i18n_test_preferredlanguage_0300
'
+
value
);
expect
(
value
).
assertTrue
();
}
})
/* *
...
...
@@ -233,12 +240,19 @@ describe('LangTest', function () {
*/
it
(
'
i18n_test_preferredlanguage_0340
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0340
'
+
'
start
'
);
let
value
=
I18n
.
addPreferredLanguage
(
'
en
'
,
1.5
);
console
.
log
(
'
i18n_test_preferredlanguage_0340
'
+
value
);
expect
(
value
).
assertTrue
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0340
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
if
(
list
[
0
]
!=
'
en
'
){
let
value
=
I18n
.
addPreferredLanguage
(
'
en
'
,
1.5
);
console
.
log
(
'
i18n_test_preferredlanguage_0340
'
+
value
);
expect
(
value
).
assertTrue
();
}
else
{
let
value
=
I18n
.
addPreferredLanguage
(
'
zh
'
,
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0340
'
+
value
);
expect
(
value
).
assertTrue
();
}
})
/* *
...
...
@@ -248,12 +262,19 @@ describe('LangTest', function () {
*/
it
(
'
i18n_test_preferredlanguage_0400
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0400
'
+
'
start
'
);
let
value
=
I18n
.
addPreferredLanguage
(
'
en
'
,
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0400
'
+
value
);
expect
(
value
).
assertTrue
();
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0400
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
if
(
list
[
0
]
!=
'
en
'
){
let
value
=
I18n
.
addPreferredLanguage
(
'
en
'
,
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0400
'
+
value
);
expect
(
value
).
assertTrue
();
}
else
{
let
value
=
I18n
.
addPreferredLanguage
(
'
zh
'
,
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0400
'
+
value
);
expect
(
value
).
assertTrue
();
}
})
/* *
...
...
@@ -397,13 +418,14 @@ describe('LangTest', function () {
* @tc.desc check the value of preferredLanguage method
*/
it
(
'
i18n_test_preferredlanguage_0940
'
,
0
,
function
()
{
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
'
start
'
);
let
value
=
I18n
.
addPreferredLanguage
(
'
it
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
value
);
expect
(
value
).
assertTrue
();
let
value2
=
I18n
.
addPreferredLanguage
(
'
ko
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
value2
);
expect
(
value2
).
assertTrue
();
let
value3
=
I18n
.
addPreferredLanguage
(
'
en
'
);
let
value3
=
I18n
.
addPreferredLanguage
(
'
th
'
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
value3
);
expect
(
value3
).
assertTrue
();
let
list1
=
I18n
.
getPreferredLanguageList
();
...
...
@@ -414,12 +436,12 @@ describe('LangTest', function () {
let
value5
=
I18n
.
addPreferredLanguage
(
'
ko
'
,
2
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
value5
);
expect
(
value5
).
assertTrue
();
let
value6
=
I18n
.
addPreferredLanguage
(
'
en
'
,
1
);
let
value6
=
I18n
.
addPreferredLanguage
(
'
th
'
,
1
);
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
value6
);
expect
(
value6
).
assertFalse
();
let
list2
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_0940
'
+
list2
);
expect
(
list2
[
1
]).
assertEqual
(
'
en
'
);
expect
(
list2
[
1
]).
assertEqual
(
'
th
'
);
expect
(
list2
[
2
]).
assertEqual
(
'
ko
'
);
expect
(
list2
[
3
]).
assertEqual
(
'
it
'
);
let
remove1
=
I18n
.
removePreferredLanguage
(
1
);
...
...
@@ -446,10 +468,15 @@ describe('LangTest', function () {
console
.
log
(
'
i18n_test_preferredlanguage_1000
'
+
'
start
'
);
let
value
=
I18n
.
getFirstPreferredLanguage
();
console
.
log
(
'
i18n_test_preferredlanguage_1000
'
+
value
);
expect
(
value
).
assertEqual
(
'
zh-Hans
'
);
let
list
=
I18n
.
getPreferredLanguageList
();
console
.
log
(
'
i18n_test_preferredlanguage_1000
'
+
list
);
expect
(
list
.
length
).
assertLarger
(
0
);
if
(
list
[
0
]
==
'
zh-Hans
'
){
expect
(
value
).
assertEqual
(
'
zh-Hans
'
);
}
else
if
(
list
[
0
]
==
'
en
'
){
expect
(
value
).
assertEqual
(
'
en
'
);
}
})
/* *
...
...
global/perf/perfjs/src/main/js/default/test/Perf.test.js
浏览文件 @
87abd40c
...
...
@@ -1017,5 +1017,400 @@ describe('PerfTest', function () {
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_3800
* @tc.name test the performance of getLineBreakText
* @tc.desc check the performance of getLineBreakText
*/
it
(
'
perf_test_3800
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_3800
'
+
'
start
'
);
let
iterator
=
I18n
.
getLineInstance
(
'
en
'
);
iterator
.
setLineBreakText
(
'
My name is Tom.Welcome to the sky world.
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
iterator
.
getLineBreakText
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_3800--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_3900
* @tc.name test the performance of isBoundary
* @tc.desc check the performance of isBoundary
*/
it
(
'
perf_test_3900
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_3900
'
+
'
start
'
);
let
iterator
=
I18n
.
getLineInstance
(
'
en
'
);
iterator
.
setLineBreakText
(
'
My name is Tom.Welcome to the sky world.
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
iterator
.
isBoundary
(
10
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_3900--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_4000
* @tc.name test the performance of getInstance
* @tc.desc check the performance of getInstance
*/
it
(
'
perf_test_4000
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_4000
'
+
'
start
'
);
let
index
=
null
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
index
=
I18n
.
getInstance
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_4000--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_4100
* @tc.name test the performance of getIndex
* @tc.desc check the performance of getIndex
*/
it
(
'
perf_test_4100
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_4100
'
+
'
start
'
);
let
index
=
I18n
.
getInstance
();
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
index
.
getIndex
(
'
a
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_4100--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_4200
* @tc.name test the performance of getIndexList
* @tc.desc check the performance of getIndexList
*/
it
(
'
perf_test_4200
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_4200
'
+
'
start
'
);
let
index
=
I18n
.
getInstance
();
let
value
=
new
Array
();
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
index
.
getIndexList
();
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_4200--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_4300
* @tc.name test the performance of addLocale
* @tc.desc check the performance of addLocale
*/
it
(
'
perf_test_4300
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_4300
'
+
'
start
'
);
let
index
=
I18n
.
getInstance
();
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
index
.
addLocale
(
'
en
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_4300--
'
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_4400
* @tc.name test the performance of isDigit
* @tc.desc check the performance of isDigit
*/
it
(
'
perf_test_4400
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_4400
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
Character
.
isDigit
(
'
abc
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_4400--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_4500
* @tc.name test the performance of isSpaceChar
* @tc.desc check the performance of isSpaceChar
*/
it
(
'
perf_test_4500
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_4500
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
Character
.
isSpaceChar
(
'
abc
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_4500--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_4600
* @tc.name test the performance of isWhitespace
* @tc.desc check the performance of isWhitespace
*/
it
(
'
perf_test_4600
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_4600
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
Character
.
isWhitespace
(
'
abc
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_4600--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_4700
* @tc.name test the performance of isRTL
* @tc.desc check the performance of isRTL
*/
it
(
'
perf_test_4700
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_4700
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
Character
.
isRTL
(
'
abc
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_4700--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_4800
* @tc.name test the performance of isIdeograph
* @tc.desc check the performance of isIdeograph
*/
it
(
'
perf_test_4800
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_4800
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
Character
.
isIdeograph
(
'
abc
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_4800--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_4900
* @tc.name test the performance of isLetter
* @tc.desc check the performance of isLetter
*/
it
(
'
perf_test_4900
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_4900
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
Character
.
isLetter
(
'
abc
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_4900--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5000
* @tc.name test the performance of isLowerCase
* @tc.desc check the performance of isLowerCase
*/
it
(
'
perf_test_5000
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5000
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
Character
.
isLowerCase
(
'
abc
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5000--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5100
* @tc.name test the performance of isUpperCase
* @tc.desc check the performance of isUpperCase
*/
it
(
'
perf_test_5100
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5100
'
+
'
start
'
);
let
value
=
false
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
Character
.
isUpperCase
(
'
ABC
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5100--
'
+
'
value:
'
+
value
+
'
exeTime:
'
+
exeTime
+
'
avgTime:
'
+
avgTime
);
if
(
avgTime
<
10
){
expect
(
true
).
assertTrue
();
}
else
{
expect
(
false
).
assertTrue
();
}
})
/* *
* @tc.number SUB_GLOBAL_PERF_JS_5200
* @tc.name test the performance of getType
* @tc.desc check the performance of getType
*/
it
(
'
perf_test_5200
'
,
0
,
function
()
{
console
.
log
(
'
perf_test_5200
'
+
'
start
'
);
let
value
=
'
test
'
;
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
EXETIME
;
i
++
){
value
=
I18n
.
Character
.
getType
(
'
a
'
);
}
let
exeTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
exeTime
/
EXETIME
;
console
.
log
(
'
perf_test_5200--
'
+
'
value:
'
+
value
+
'
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录