Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0e7c76b9
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看板
未验证
提交
0e7c76b9
编写于
3月 20, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 20, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8105 Add ets_ Util XTS use case coverage
Merge pull request !8105 from 赵杜炜/master
上级
f3da71a0
bb628dbc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
176 addition
and
0 deletion
+176
-0
commonlibrary/ets_utils/process_lib_standard/src/main/js/test/Process.test.js
...ils/process_lib_standard/src/main/js/test/Process.test.js
+10
-0
commonlibrary/ets_utils/url_lib_standard/src/main/js/test/url.test.js
...y/ets_utils/url_lib_standard/src/main/js/test/url.test.js
+68
-0
commonlibrary/ets_utils/util2_lib_standard/src/main/js/test/util.test.js
...ts_utils/util2_lib_standard/src/main/js/test/util.test.js
+98
-0
未找到文件。
commonlibrary/ets_utils/process_lib_standard/src/main/js/test/Process.test.js
浏览文件 @
0e7c76b9
...
@@ -141,6 +141,16 @@ describe('ProcessTest', function () {
...
@@ -141,6 +141,16 @@ describe('ProcessTest', function () {
expect
(
result
).
assertEqual
(
false
)
expect
(
result
).
assertEqual
(
false
)
})
})
/**
* @tc.name: testKill006
* @tc.desc: Return whether the signal was sent successfully.
*/
it
(
'
testKill006
'
,
0
,
function
()
{
let
pres
=
process
.
pid
let
result
=
process
.
kill
(
'
17
'
,
pres
)
expect
(
result
).
assertEqual
(
true
)
})
/**
/**
* @tc.name: testUptime001
* @tc.name: testUptime001
* @tc.desc: Returns the running time of the system.
* @tc.desc: Returns the running time of the system.
...
...
commonlibrary/ets_utils/url_lib_standard/src/main/js/test/url.test.js
浏览文件 @
0e7c76b9
...
@@ -683,6 +683,22 @@ describe('UrlFunTest', function () {
...
@@ -683,6 +683,22 @@ describe('UrlFunTest', function () {
expect
(
result
).
assertEqual
(
false
)
expect
(
result
).
assertEqual
(
false
)
})
})
/**
* @tc.name: testParamsHas006
* @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists.
*/
it
(
'
testParamsHas006
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLParams
(
"
小=value1&¥=value2&key3=大
"
)
try
{
var
a
=
1
;
params
.
has
(
a
);
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
`BusinessError: Parameter error.The type of
${
a
}
must be string`
);
expect
(
e
.
code
).
assertEqual
(
401
)
expect
(
e
.
message
).
assertEqual
(
`Parameter error.The type of
${
a
}
must be string`
);
}
})
/**
/**
* @tc.name: testParamsKeys001
* @tc.name: testParamsKeys001
* @tc.desc: Returns an iterator allowing to go through all keys contained in this object.
* @tc.desc: Returns an iterator allowing to go through all keys contained in this object.
...
@@ -1230,6 +1246,23 @@ describe('UrlFunTest', function () {
...
@@ -1230,6 +1246,23 @@ describe('UrlFunTest', function () {
expect
(
result
).
assertEqual
(
"
foo=1&bar=2&123=456
"
)
expect
(
result
).
assertEqual
(
"
foo=1&bar=2&123=456
"
)
})
})
/**
* @tc.name: testUrlAppend006
* @tc.desc: Appends a specified key/value pair as a new search parameter.
*/
it
(
'
testUrlAppend006
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
)
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
try
{
var
a
=
1
;
params
.
append
(
a
,
"
123
"
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
`BusinessError: Parameter error.The type of
${
a
}
must be string`
);
expect
(
e
.
code
).
assertEqual
(
401
)
expect
(
e
.
message
).
assertEqual
(
`Parameter error.The type of
${
a
}
must be string`
);
}
})
/**
/**
* @tc.name: testUrlDelete001
* @tc.name: testUrlDelete001
* @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters.
* @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters.
...
@@ -1711,6 +1744,23 @@ describe('UrlFunTest', function () {
...
@@ -1711,6 +1744,23 @@ describe('UrlFunTest', function () {
expect
(
result
).
assertEqual
(
false
)
expect
(
result
).
assertEqual
(
false
)
})
})
/**
* @tc.name: testUrlHas006
* @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists.
*/
it
(
'
testUrlHas006
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
小=value1&¥=value2&key3=大
"
)
params
.
append
(
"
¥
"
,
"
ACA
"
)
try
{
var
a
=
1
;
params
.
has
(
a
);
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
`BusinessError: Parameter error.The type of
${
a
}
must be string`
);
expect
(
e
.
code
).
assertEqual
(
401
)
expect
(
e
.
message
).
assertEqual
(
`Parameter error.The type of
${
a
}
must be string`
);
}
})
/**
/**
* @tc.name: testUrlKeys001
* @tc.name: testUrlKeys001
* @tc.desc: Returns an iterator allowing to go through all keys contained in this object.
* @tc.desc: Returns an iterator allowing to go through all keys contained in this object.
...
@@ -1853,6 +1903,24 @@ describe('UrlFunTest', function () {
...
@@ -1853,6 +1903,24 @@ describe('UrlFunTest', function () {
expect
(
res
).
assertEqual
(
"
1=value1&2=value2&key3=3&12=BBB
"
);
expect
(
res
).
assertEqual
(
"
1=value1&2=value2&key3=3&12=BBB
"
);
})
})
/**
* @tc.name: testUrlSet006
* @tc.desc: Sets the value associated with a given search parameter to the given value.
* If there were several matching values, this method deletes the others.
* If the search parameter doesn't exist, this method creates it.
*/
it
(
'
testUrlSet006
'
,
0
,
function
()
{
try
{
let
params
=
new
Url
.
URLSearchParams
(
"
1=value1&2=value2&key3=3
"
);
var
a
=
12
;
params
.
set
(
a
,
'
BBB
'
);
}
catch
(
err
)
{
expect
(
err
.
toString
()).
assertEqual
(
`BusinessError: Parameter error.The type of
${
a
}
must be string`
)
expect
(
err
.
code
).
assertEqual
(
401
)
expect
(
err
.
message
).
assertEqual
(
`Parameter error.The type of
${
a
}
must be string`
);
}
})
/**
/**
* @tc.name: testUrlSort001
* @tc.name: testUrlSort001
* @tc.desc: Sort all key/value pairs contained in this object in place and return undefined.
* @tc.desc: Sort all key/value pairs contained in this object in place and return undefined.
...
...
commonlibrary/ets_utils/util2_lib_standard/src/main/js/test/util.test.js
浏览文件 @
0e7c76b9
...
@@ -1633,6 +1633,21 @@ describe('LRUCacheTest', function () {
...
@@ -1633,6 +1633,21 @@ describe('LRUCacheTest', function () {
expect
(
result
).
assertEqual
(
100
)
expect
(
result
).
assertEqual
(
100
)
})
})
/**
* @tc.name: testLRUCacheUpdateGetCapacity006
* @tc.desc: Updates the buffer capacity to a specified capacity.
*/
it
(
'
testLRUCacheUpdateGetCapacity006
'
,
0
,
function
()
{
var
that
=
new
util
.
LRUCache
(
200
)
try
{
that
.
updateCapacity
(
'
a
'
);
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
'
BusinessError: Parameter error.The type of a must be number
'
);
expect
(
e
.
code
).
assertEqual
(
401
)
expect
(
e
.
message
).
assertEqual
(
"
Parameter error.The type of a must be number
"
);
}
})
/**
/**
* @tc.name: testLRUCacheGet001
* @tc.name: testLRUCacheGet001
* @tc.desc: Obtains the value associated with a specified key.
* @tc.desc: Obtains the value associated with a specified key.
...
@@ -1711,6 +1726,23 @@ describe('LRUCacheTest', function () {
...
@@ -1711,6 +1726,23 @@ describe('LRUCacheTest', function () {
expect
(
result4
).
assertEqual
(
undefined
)
expect
(
result4
).
assertEqual
(
undefined
)
})
})
/**
* @tc.name: testLRUCacheGet006
* @tc.desc: Obtains the value associated with a specified key.
*/
it
(
'
testLRUCacheGet006
'
,
0
,
function
()
{
var
that
=
new
util
.
LRUCache
()
let
un
=
undefined
;
that
.
put
(
20
,
'
cdjcaxb
'
)
try
{
var
result1
=
that
.
get
(
un
);
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
'
BusinessError: Parameter error.The type of undefined must be Object
'
);
expect
(
e
.
code
).
assertEqual
(
401
)
expect
(
e
.
message
).
assertEqual
(
"
Parameter error.The type of undefined must be Object
"
);
}
})
/**
/**
* @tc.name: testLRUCachePut001
* @tc.name: testLRUCachePut001
* @tc.desc: Adds a key-value pair to the buffer.
* @tc.desc: Adds a key-value pair to the buffer.
...
@@ -1788,6 +1820,22 @@ describe('LRUCacheTest', function () {
...
@@ -1788,6 +1820,22 @@ describe('LRUCacheTest', function () {
expect
(
temp5
).
assertEqual
(
22
)
expect
(
temp5
).
assertEqual
(
22
)
})
})
/**
* @tc.name: testLRUCachePut006
* @tc.desc: Adds a key-value pair to the buffer.
*/
it
(
'
testLRUCachePut006
'
,
0
,
function
()
{
var
that
=
new
util
.
LRUCache
()
let
un
=
undefined
;
try
{
that
.
put
(
un
,
'
bcjdshc
'
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
'
BusinessError: Parameter error.The type of undefined must be Object
'
);
expect
(
e
.
code
).
assertEqual
(
401
)
expect
(
e
.
message
).
assertEqual
(
"
Parameter error.The type of undefined must be Object
"
);
}
})
/**
/**
* @tc.name: testLRUCacheGetCreateCount001
* @tc.name: testLRUCacheGetCreateCount001
* @tc.desc: Obtains the number of times createDefault(Object) returned a value.
* @tc.desc: Obtains the number of times createDefault(Object) returned a value.
...
@@ -2531,6 +2579,23 @@ describe('LRUCacheTest', function () {
...
@@ -2531,6 +2579,23 @@ describe('LRUCacheTest', function () {
expect
(
result3
).
assertEqual
(
false
)
expect
(
result3
).
assertEqual
(
false
)
})
})
/**
* @tc.name: testLRUCacheContains006
* @tc.desc: Checks whether the current buffer contains a specified key.
*/
it
(
'
testLRUCacheContains006
'
,
0
,
function
()
{
var
that
=
new
util
.
LRUCache
()
that
.
put
(
'
abc
'
,
'
abc
'
)
let
un
=
undefined
;
try
{
that
.
contains
(
un
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
'
BusinessError: Parameter error.The type of undefined must be Object
'
);
expect
(
e
.
code
).
assertEqual
(
401
)
expect
(
e
.
message
).
assertEqual
(
"
Parameter error.The type of undefined must be Object
"
);
}
})
/**
/**
* @tc.name: testLRUCacheRemove001
* @tc.name: testLRUCacheRemove001
* @tc.desc: Deletes a specified key and its associated value from the current buffer.
* @tc.desc: Deletes a specified key and its associated value from the current buffer.
...
@@ -2600,6 +2665,23 @@ describe('LRUCacheTest', function () {
...
@@ -2600,6 +2665,23 @@ describe('LRUCacheTest', function () {
expect
(
result3
).
assertEqual
(
undefined
)
expect
(
result3
).
assertEqual
(
undefined
)
})
})
/**
* @tc.name: testLRUCacheRemove006
* @tc.desc: Deletes a specified key and its associated value from the current buffer.
*/
it
(
'
testLRUCacheRemove006
'
,
0
,
function
()
{
var
that
=
new
util
.
LRUCache
()
that
.
put
(
1
,
2
)
let
un
=
undefined
;
try
{
that
.
remove
(
un
)
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
'
BusinessError: Parameter error.The type of undefined must be Object
'
);
expect
(
e
.
code
).
assertEqual
(
401
)
expect
(
e
.
message
).
assertEqual
(
"
Parameter error.The type of undefined must be Object
"
);
}
})
/**
/**
* @tc.name: testLRUCacheCreateDefault001
* @tc.name: testLRUCacheCreateDefault001
* @tc.desc: Executes subsequent operations if miss to compute a value for the specific key.
* @tc.desc: Executes subsequent operations if miss to compute a value for the specific key.
...
@@ -2652,6 +2734,22 @@ describe('LRUCacheTest', function () {
...
@@ -2652,6 +2734,22 @@ describe('LRUCacheTest', function () {
expect
(
result2
).
assertEqual
(
undefined
)
expect
(
result2
).
assertEqual
(
undefined
)
})
})
/**
* @tc.name: testLRUCacheCreateDefault006
* @tc.desc: Executes subsequent operations if miss to compute a value for the specific key.
*/
it
(
'
testLRUCacheCreateDefault006
'
,
0
,
function
()
{
var
that
=
new
util
.
LRUCache
()
let
un
=
undefined
;
try
{
that
.
createDefault
(
un
);
}
catch
(
e
)
{
expect
(
e
.
toString
()).
assertEqual
(
'
BusinessError: Parameter error.The type of undefined must be Object
'
);
expect
(
e
.
code
).
assertEqual
(
401
)
expect
(
e
.
message
).
assertEqual
(
"
Parameter error.The type of undefined must be Object
"
);
}
})
/**
/**
* @tc.name: testLRUCacheKeys001
* @tc.name: testLRUCacheKeys001
* @tc.desc: Obtains a list of keys for the values in the current buffer.
* @tc.desc: Obtains a list of keys for the values in the current buffer.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录