未验证 提交 ab5a9fcb 编写于 作者: O openharmony_ci 提交者: Gitee

!8109 Add ets_ Util XTS use case coverage

Merge pull request !8109 from 赵杜炜/cherry-pick-1679361446
......@@ -141,6 +141,16 @@ describe('ProcessTest', function () {
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.desc: Returns the running time of the system.
......
......@@ -683,6 +683,22 @@ describe('UrlFunTest', function () {
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.desc: Returns an iterator allowing to go through all keys contained in this object.
......@@ -1230,6 +1246,23 @@ describe('UrlFunTest', function () {
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.desc: Deletes the given search parameter and its associated value,from the list of all search parameters.
......@@ -1711,6 +1744,23 @@ describe('UrlFunTest', function () {
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.desc: Returns an iterator allowing to go through all keys contained in this object.
......@@ -1853,6 +1903,24 @@ describe('UrlFunTest', function () {
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.desc: Sort all key/value pairs contained in this object in place and return undefined.
......
......@@ -1637,6 +1637,21 @@ describe('LRUCacheTest', function () {
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.desc: Obtains the value associated with a specified key.
......@@ -1715,6 +1730,23 @@ describe('LRUCacheTest', function () {
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.desc: Adds a key-value pair to the buffer.
......@@ -1792,6 +1824,22 @@ describe('LRUCacheTest', function () {
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.desc: Obtains the number of times createDefault(Object) returned a value.
......@@ -2535,6 +2583,23 @@ describe('LRUCacheTest', function () {
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.desc: Deletes a specified key and its associated value from the current buffer.
......@@ -2604,6 +2669,23 @@ describe('LRUCacheTest', function () {
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.desc: Executes subsequent operations if miss to compute a value for the specific key.
......@@ -2656,6 +2738,22 @@ describe('LRUCacheTest', function () {
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.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.
先完成此消息的编辑!
想要评论请 注册