Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e04ff3e7
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
接近 2 年 前同步成功
通知
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看板
未验证
提交
e04ff3e7
编写于
3月 10, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 10, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2274 update container XTS test of cases
Merge pull request !2274 from 刘甘霖/merge_xts
上级
1e45a1fa
192a52e1
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
576 addition
and
690 deletion
+576
-690
compileruntime/containerLine_lib_standard/BUILD.gn
compileruntime/containerLine_lib_standard/BUILD.gn
+1
-1
compileruntime/containerLine_lib_standard/src/main/js/default/app.js
...ime/containerLine_lib_standard/src/main/js/default/app.js
+1
-1
compileruntime/containerLine_lib_standard/src/main/js/default/pages/index/index.js
...ine_lib_standard/src/main/js/default/pages/index/index.js
+1
-1
compileruntime/containerLine_lib_standard/src/main/js/test/ArrayList.test.js
...ainerLine_lib_standard/src/main/js/test/ArrayList.test.js
+57
-11
compileruntime/containerLine_lib_standard/src/main/js/test/Deque.test.js
...containerLine_lib_standard/src/main/js/test/Deque.test.js
+24
-13
compileruntime/containerLine_lib_standard/src/main/js/test/ExampleJsunit.test.js
...rLine_lib_standard/src/main/js/test/ExampleJsunit.test.js
+1
-1
compileruntime/containerLine_lib_standard/src/main/js/test/LinkedList.test.js
...inerLine_lib_standard/src/main/js/test/LinkedList.test.js
+32
-57
compileruntime/containerLine_lib_standard/src/main/js/test/List.test.js
.../containerLine_lib_standard/src/main/js/test/List.test.js
+44
-69
compileruntime/containerLine_lib_standard/src/main/js/test/Main.test.js
.../containerLine_lib_standard/src/main/js/test/Main.test.js
+1
-1
compileruntime/containerLine_lib_standard/src/main/js/test/Queue.test.js
...containerLine_lib_standard/src/main/js/test/Queue.test.js
+9
-16
compileruntime/containerLine_lib_standard/src/main/js/test/Stack.test.js
...containerLine_lib_standard/src/main/js/test/Stack.test.js
+37
-50
compileruntime/containerLine_lib_standard/src/main/js/test/Vector.test.js
...ontainerLine_lib_standard/src/main/js/test/Vector.test.js
+45
-62
compileruntime/containerRelation_lib_standard/BUILD.gn
compileruntime/containerRelation_lib_standard/BUILD.gn
+1
-1
compileruntime/containerRelation_lib_standard/src/main/js/default/app.js
...containerRelation_lib_standard/src/main/js/default/app.js
+1
-1
compileruntime/containerRelation_lib_standard/src/main/js/default/pages/index/index.js
...ion_lib_standard/src/main/js/default/pages/index/index.js
+1
-1
compileruntime/containerRelation_lib_standard/src/main/js/test/ExampleJsunit.test.js
...ation_lib_standard/src/main/js/test/ExampleJsunit.test.js
+1
-1
compileruntime/containerRelation_lib_standard/src/main/js/test/HashMap.test.js
...nerRelation_lib_standard/src/main/js/test/HashMap.test.js
+69
-88
compileruntime/containerRelation_lib_standard/src/main/js/test/HashSet.test.js
...nerRelation_lib_standard/src/main/js/test/HashSet.test.js
+3
-2
compileruntime/containerRelation_lib_standard/src/main/js/test/LightWeightMap.test.js
...tion_lib_standard/src/main/js/test/LightWeightMap.test.js
+28
-41
compileruntime/containerRelation_lib_standard/src/main/js/test/LightWeightSet.test.js
...tion_lib_standard/src/main/js/test/LightWeightSet.test.js
+34
-13
compileruntime/containerRelation_lib_standard/src/main/js/test/Main.test.js
...tainerRelation_lib_standard/src/main/js/test/Main.test.js
+1
-1
compileruntime/containerRelation_lib_standard/src/main/js/test/PlainArray.test.js
...Relation_lib_standard/src/main/js/test/PlainArray.test.js
+55
-91
compileruntime/containerRelation_lib_standard/src/main/js/test/TreeMap.test.js
...nerRelation_lib_standard/src/main/js/test/TreeMap.test.js
+76
-93
compileruntime/containerRelation_lib_standard/src/main/js/test/TreeSet.test.js
...nerRelation_lib_standard/src/main/js/test/TreeSet.test.js
+53
-74
未找到文件。
compileruntime/containerLine_lib_standard/BUILD.gn
浏览文件 @
e04ff3e7
# Copyright (C) 202
1
Huawei Device Co., Ltd.
# Copyright (C) 202
2
Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# You may obtain a copy of the License at
...
...
compileruntime/containerLine_lib_standard/src/main/js/default/app.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
...
compileruntime/containerLine_lib_standard/src/main/js/default/pages/index/index.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
...
compileruntime/containerLine_lib_standard/src/main/js/test/ArrayList.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -21,7 +21,8 @@ describe("ArraylistTest", function () {
...
@@ -21,7 +21,8 @@ describe("ArraylistTest", function () {
let
arrayList
=
new
ArrayList
();
let
arrayList
=
new
ArrayList
();
expect
(
arrayList
!=
undefined
).
assertEqual
(
true
);
expect
(
arrayList
!=
undefined
).
assertEqual
(
true
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Cannot create new arrayList
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new arrayList
"
);
}
}
});
});
it
(
"
SR000GGR44_testAdd002
"
,
0
,
function
()
{
it
(
"
SR000GGR44_testAdd002
"
,
0
,
function
()
{
...
@@ -348,7 +349,12 @@ describe("ArraylistTest", function () {
...
@@ -348,7 +349,12 @@ describe("ArraylistTest", function () {
try
{
try
{
let
res
=
arrayList
.
insert
(
8
,
-
1
);
let
res
=
arrayList
.
insert
(
8
,
-
1
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
RangeError: ArrayList: set out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
if
(
err
.
message
!=
"
the index is out-of-bounds
"
)
{
expect
(
err
.
message
).
assertEqual
(
"
ArrayList: set out-of-bounds
"
);
}
else
{
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
}
});
});
it
(
"
SR000GGR44_testInsert0028
"
,
0
,
function
()
{
it
(
"
SR000GGR44_testInsert0028
"
,
0
,
function
()
{
...
@@ -360,7 +366,12 @@ describe("ArraylistTest", function () {
...
@@ -360,7 +366,12 @@ describe("ArraylistTest", function () {
try
{
try
{
let
res
=
arrayList
.
insert
(
8
,
10
);
let
res
=
arrayList
.
insert
(
8
,
10
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
RangeError: ArrayList: set out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
if
(
err
.
message
!=
"
the index is out-of-bounds
"
)
{
expect
(
err
.
message
).
assertEqual
(
"
ArrayList: set out-of-bounds
"
);
}
else
{
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
}
});
});
it
(
"
SR000GGR44_testInsert029
"
,
0
,
function
()
{
it
(
"
SR000GGR44_testInsert029
"
,
0
,
function
()
{
...
@@ -372,7 +383,12 @@ describe("ArraylistTest", function () {
...
@@ -372,7 +383,12 @@ describe("ArraylistTest", function () {
try
{
try
{
let
res
=
arrayList
.
insert
(
8
,
11
);
let
res
=
arrayList
.
insert
(
8
,
11
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
RangeError: ArrayList: set out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
if
(
err
.
message
!=
"
the index is out-of-bounds
"
)
{
expect
(
err
.
message
).
assertEqual
(
"
ArrayList: set out-of-bounds
"
);
}
else
{
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
}
});
});
it
(
"
SR000GGR44_testisEmpty030
"
,
0
,
function
()
{
it
(
"
SR000GGR44_testisEmpty030
"
,
0
,
function
()
{
...
@@ -457,7 +473,12 @@ describe("ArraylistTest", function () {
...
@@ -457,7 +473,12 @@ describe("ArraylistTest", function () {
try
{
try
{
let
res
=
arrayList
.
removeByIndex
(
5
);
let
res
=
arrayList
.
removeByIndex
(
5
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
RangeError: removeByIndex is out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
if
(
err
.
message
!=
"
the index is out-of-bounds
"
)
{
expect
(
err
.
message
).
assertEqual
(
"
removeByIndex is out-of-bounds
"
);
}
else
{
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
}
});
});
it
(
"
SR000GGR44_testRemoveByRange037
"
,
0
,
function
()
{
it
(
"
SR000GGR44_testRemoveByRange037
"
,
0
,
function
()
{
...
@@ -473,7 +494,12 @@ describe("ArraylistTest", function () {
...
@@ -473,7 +494,12 @@ describe("ArraylistTest", function () {
try
{
try
{
let
res
=
arrayList
.
removeByRange
(
3
,
1
);
let
res
=
arrayList
.
removeByRange
(
3
,
1
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
RangeError: fromIndex cannot be less than or equal to toIndex
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
if
(
err
.
message
!=
"
the fromIndex cannot be less than or equal to toIndex
"
)
{
expect
(
err
.
message
).
assertEqual
(
"
fromIndex cannot be less than or equal to toIndex
"
);
}
else
{
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex cannot be less than or equal to toIndex
"
);
}
}
}
});
});
it
(
"
SR000GGR44_testRemoveByRange038
"
,
0
,
function
()
{
it
(
"
SR000GGR44_testRemoveByRange038
"
,
0
,
function
()
{
...
@@ -486,7 +512,12 @@ describe("ArraylistTest", function () {
...
@@ -486,7 +512,12 @@ describe("ArraylistTest", function () {
try
{
try
{
let
res
=
arrayList
.
removeByRange
(
6
,
8
);
let
res
=
arrayList
.
removeByRange
(
6
,
8
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
RangeError: ArrayList: set out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
if
(
err
.
message
!=
"
the fromIndex or the toIndex is out-of-bounds
"
)
{
expect
(
err
.
message
).
assertEqual
(
"
ArrayList: set out-of-bounds
"
);
}
else
{
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex or the toIndex is out-of-bounds
"
);
}
}
}
});
});
it
(
"
SR000GGR44_testRemoveByRange039
"
,
0
,
function
()
{
it
(
"
SR000GGR44_testRemoveByRange039
"
,
0
,
function
()
{
...
@@ -515,7 +546,12 @@ describe("ArraylistTest", function () {
...
@@ -515,7 +546,12 @@ describe("ArraylistTest", function () {
try
{
try
{
let
subArr
=
arrayList
.
subArrayList
(
4
,
2
);
let
subArr
=
arrayList
.
subArrayList
(
4
,
2
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
RangeError: fromIndex cannot be less than or equal to toIndex
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
if
(
err
.
message
!=
"
the fromIndex cannot be less than or equal to toIndex
"
)
{
expect
(
err
.
message
).
assertEqual
(
"
fromIndex cannot be less than or equal to toIndex
"
);
}
else
{
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex cannot be less than or equal to toIndex
"
);
}
}
}
});
});
it
(
"
SR000GGR44_testSubArrayList041
"
,
0
,
function
()
{
it
(
"
SR000GGR44_testSubArrayList041
"
,
0
,
function
()
{
...
@@ -545,7 +581,12 @@ describe("ArraylistTest", function () {
...
@@ -545,7 +581,12 @@ describe("ArraylistTest", function () {
try
{
try
{
let
subArr
=
arrayList
.
subArrayList
(
6
,
9
);
let
subArr
=
arrayList
.
subArrayList
(
6
,
9
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
RangeError: fromIndex or toIndex is out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
if
(
err
.
message
!=
"
the fromIndex or the toIndex is out-of-bounds
"
)
{
expect
(
err
.
message
).
assertEqual
(
"
fromIndex or toIndex is out-of-bounds
"
);
}
else
{
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex or the toIndex is out-of-bounds
"
);
}
}
}
});
});
it
(
"
SR000GGR44_testIncreaseCapacityTo043
"
,
0
,
function
()
{
it
(
"
SR000GGR44_testIncreaseCapacityTo043
"
,
0
,
function
()
{
...
@@ -569,7 +610,12 @@ describe("ArraylistTest", function () {
...
@@ -569,7 +610,12 @@ describe("ArraylistTest", function () {
try
{
try
{
let
res
=
arrayList
.
increaseCapacityTo
();
let
res
=
arrayList
.
increaseCapacityTo
();
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: newCapacity is not Integer
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
if
(
err
.
message
!=
"
index is not integer
"
)
{
expect
(
err
.
message
).
assertEqual
(
"
newCapacity is not Integer
"
);
}
else
{
expect
(
err
.
message
).
assertEqual
(
"
index is not integer
"
);
}
}
}
});
});
it
(
"
SR000GGR44_testAdd045
"
,
0
,
function
()
{
it
(
"
SR000GGR44_testAdd045
"
,
0
,
function
()
{
...
...
compileruntime/containerLine_lib_standard/src/main/js/test/Deque.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -20,7 +20,8 @@ describe("DequeTest", function () {
...
@@ -20,7 +20,8 @@ describe("DequeTest", function () {
try
{
try
{
let
deque
=
new
Deque
();
let
deque
=
new
Deque
();
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error:Cannot create new deque
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new deque
"
);
}
}
});
});
it
(
"
SR000GGR3K_testInsertFront001
"
,
0
,
function
()
{
it
(
"
SR000GGR3K_testInsertFront001
"
,
0
,
function
()
{
...
@@ -215,7 +216,7 @@ describe("DequeTest", function () {
...
@@ -215,7 +216,7 @@ describe("DequeTest", function () {
let
res
=
deque
.
getLast
();
let
res
=
deque
.
getLast
();
expect
(
res
).
assertEqual
(
i
);
expect
(
res
).
assertEqual
(
i
);
}
}
let
res1
=
deque
.
length
;
let
res1
=
deque
.
length
;
expect
(
res1
).
assertEqual
(
100
);
expect
(
res1
).
assertEqual
(
100
);
});
});
it
(
"
SR000GGR3K_testHas025
"
,
0
,
function
()
{
it
(
"
SR000GGR3K_testHas025
"
,
0
,
function
()
{
...
@@ -235,19 +236,13 @@ describe("DequeTest", function () {
...
@@ -235,19 +236,13 @@ describe("DequeTest", function () {
});
});
it
(
"
SR000GGR3K_testPopLast028
"
,
0
,
function
()
{
it
(
"
SR000GGR3K_testPopLast028
"
,
0
,
function
()
{
let
deque
=
new
Deque
();
let
deque
=
new
Deque
();
try
{
let
res
=
deque
.
popLast
();
let
res
=
deque
.
popLast
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Deque: get out-of-bounds
"
);
}
});
});
it
(
"
SR000GGR3K_testGetLast029
"
,
0
,
function
()
{
it
(
"
SR000GGR3K_testGetLast029
"
,
0
,
function
()
{
let
deque
=
new
Deque
();
let
deque
=
new
Deque
();
try
{
let
res
=
deque
.
getLast
();
let
res
=
deque
.
getLast
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Deque: get out-of-bounds
"
);
}
});
});
it
(
"
SR000GGR3K_testForEach030
"
,
0
,
function
()
{
it
(
"
SR000GGR3K_testForEach030
"
,
0
,
function
()
{
let
deque
=
new
Deque
();
let
deque
=
new
Deque
();
...
@@ -318,4 +313,20 @@ describe("DequeTest", function () {
...
@@ -318,4 +313,20 @@ describe("DequeTest", function () {
expect
(
arr
[
i
]).
assertEqual
(
a
[
i
]);
expect
(
arr
[
i
]).
assertEqual
(
a
[
i
]);
}
}
});
});
it
(
"
SR000GGR3K_testLength033
"
,
0
,
function
()
{
let
deque
=
new
Deque
();
deque
.
insertEnd
(
8
);
deque
.
insertFront
(
"
a
"
);
deque
.
insertFront
(
"
b
"
);
deque
.
insertEnd
(
5
);
deque
.
insertEnd
(
6
);
deque
.
insertFront
(
"
s
"
);
deque
.
insertFront
(
"
z
"
);
deque
.
popFirst
();
deque
.
popLast
();
deque
.
insertFront
(
"
g
"
);
deque
.
insertEnd
(
6
);
let
size
=
deque
.
length
;
expect
(
size
).
assertEqual
(
7
);
});
});
});
compileruntime/containerLine_lib_standard/src/main/js/test/ExampleJsunit.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
...
compileruntime/containerLine_lib_standard/src/main/js/test/LinkedList.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -20,7 +20,8 @@ describe("LinkedListTest", function () {
...
@@ -20,7 +20,8 @@ describe("LinkedListTest", function () {
try
{
try
{
let
linkedList
=
new
LinkedList
();
let
linkedList
=
new
LinkedList
();
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error:Cannot create new linkedList
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new linkedList
"
);
}
}
});
});
it
(
"
SR000GGR46_testAdd002
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testAdd002
"
,
0
,
function
()
{
...
@@ -181,11 +182,8 @@ describe("LinkedListTest", function () {
...
@@ -181,11 +182,8 @@ describe("LinkedListTest", function () {
list
.
add
(
"
a
"
);
list
.
add
(
"
a
"
);
list
.
add
(
"
b
"
);
list
.
add
(
"
b
"
);
list
.
add
(
"
b
"
);
list
.
add
(
"
b
"
);
try
{
let
res
=
list
.
getIndexOf
(
"
f
"
);
let
res
=
list
.
getIndexOf
(
"
f
"
);
expect
(
res
).
assertEqual
(
-
1
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
""
);
}
});
});
it
(
"
SR000GGR46_testRemoveByIndex019
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testRemoveByIndex019
"
,
0
,
function
()
{
let
list
=
new
LinkedList
();
let
list
=
new
LinkedList
();
...
@@ -214,7 +212,8 @@ describe("LinkedListTest", function () {
...
@@ -214,7 +212,8 @@ describe("LinkedListTest", function () {
try
{
try
{
let
res
=
list
.
removeByIndex
(
10
);
let
res
=
list
.
removeByIndex
(
10
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: removeByIndex is out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR46_testRemove0021
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testRemove0021
"
,
0
,
function
()
{
...
@@ -364,9 +363,8 @@ describe("LinkedListTest", function () {
...
@@ -364,9 +363,8 @@ describe("LinkedListTest", function () {
try
{
try
{
let
res
=
list
.
insert
(
8
,
"
d
"
);
let
res
=
list
.
insert
(
8
,
"
d
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
"
Error: index cannot Less than 0 and more than this length
"
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
);
}
}
});
});
it
(
"
SR000GGR46_testSet032
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testSet032
"
,
0
,
function
()
{
...
@@ -488,11 +486,8 @@ describe("LinkedListTest", function () {
...
@@ -488,11 +486,8 @@ describe("LinkedListTest", function () {
list
.
add
(
"
c
"
);
list
.
add
(
"
c
"
);
list
.
add
(
"
a
"
);
list
.
add
(
"
a
"
);
list
.
add
(
"
b
"
);
list
.
add
(
"
b
"
);
try
{
let
res
=
list
.
get
(
10
);
let
res
=
list
.
get
(
10
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
});
});
it
(
"
SR000GGR46_testListGet041
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testListGet041
"
,
0
,
function
()
{
let
list
=
new
LinkedList
();
let
list
=
new
LinkedList
();
...
@@ -534,16 +529,20 @@ describe("LinkedListTest", function () {
...
@@ -534,16 +529,20 @@ describe("LinkedListTest", function () {
try
{
try
{
let
res
=
linkedList
.
removeByIndex
(
1
);
let
res
=
linkedList
.
removeByIndex
(
1
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: removeByIndex is out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR46_testClone045
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testClone045
"
,
0
,
function
()
{
let
linkedList
=
new
LinkedList
();
let
linkedList
=
new
LinkedList
();
try
{
let
newlist
=
linkedList
.
clone
();
let
newlist
=
linkedList
.
clone
();
let
res
=
true
}
catch
(
err
)
{
for
(
let
i
=
0
;
i
<
linkedList
.
length
;
i
++
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
if
(
linkedList
[
i
]
!==
newlist
[
i
])
{
res
=
false
}
}
}
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR46_testGetIndexOf046
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testGetIndexOf046
"
,
0
,
function
()
{
let
linkedList
=
new
LinkedList
();
let
linkedList
=
new
LinkedList
();
...
@@ -553,38 +552,20 @@ describe("LinkedListTest", function () {
...
@@ -553,38 +552,20 @@ describe("LinkedListTest", function () {
it
(
"
SR000GGR46_testForEach047
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testForEach047
"
,
0
,
function
()
{
let
linkedList
=
new
LinkedList
();
let
linkedList
=
new
LinkedList
();
let
num
=
0
;
let
num
=
0
;
try
{
linkedList
.
forEach
((
item
,
index
)
=>
{
linkedList
.
forEach
((
item
,
index
)
=>
{
num
++
;
num
++
;
});
});
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
expect
(
num
).
assertEqual
(
0
);
expect
(
num
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR46_test
IsEmpty
048
"
,
0
,
function
()
{
it
(
"
SR000GGR46_test
Has
048
"
,
0
,
function
()
{
let
linkedList
=
new
LinkedList
();
let
linkedList
=
new
LinkedList
();
try
{
let
res
=
linkedList
.
has
(
1
);
let
res
=
linkedList
.
isEmpty
();
expect
(
res
).
assertEqual
(
false
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: is not callable
"
);
}
});
it
(
"
SR000GGR46_testHas049
"
,
0
,
function
()
{
let
linkedList
=
new
LinkedList
();
try
{
let
res
=
linkedList
.
has
(
1
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
});
});
it
(
"
SR000GGR46_testGet050
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testGet050
"
,
0
,
function
()
{
let
linkedList
=
new
LinkedList
();
let
linkedList
=
new
LinkedList
();
try
{
let
res
=
linkedList
.
get
(
1
);
let
res
=
linkedList
.
get
(
1
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
});
});
it
(
"
SR000GGR46_testClear051
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testClear051
"
,
0
,
function
()
{
let
linkedList
=
new
LinkedList
();
let
linkedList
=
new
LinkedList
();
...
@@ -594,19 +575,13 @@ describe("LinkedListTest", function () {
...
@@ -594,19 +575,13 @@ describe("LinkedListTest", function () {
});
});
it
(
"
SR000GGR46_testGetLast052
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testGetLast052
"
,
0
,
function
()
{
let
linkedList
=
new
LinkedList
();
let
linkedList
=
new
LinkedList
();
try
{
let
res
=
linkedList
.
getLast
();
let
res
=
linkedList
.
getLast
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
});
});
it
(
"
SR000GGR46_testGetFirst053
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testGetFirst053
"
,
0
,
function
()
{
let
linkedList
=
new
LinkedList
();
let
linkedList
=
new
LinkedList
();
try
{
let
res
=
linkedList
.
getFirst
();
let
res
=
linkedList
.
getFirst
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
});
});
it
(
"
SR000GGR46_testAdd054
"
,
0
,
function
()
{
it
(
"
SR000GGR46_testAdd054
"
,
0
,
function
()
{
let
linkedList
=
new
LinkedList
();
let
linkedList
=
new
LinkedList
();
...
...
compileruntime/containerLine_lib_standard/src/main/js/test/List.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -21,7 +21,8 @@ describe("ListTest", function () {
...
@@ -21,7 +21,8 @@ describe("ListTest", function () {
let
list
=
new
List
();
let
list
=
new
List
();
expect
(
list
!=
undefined
).
assertEqual
(
true
);
expect
(
list
!=
undefined
).
assertEqual
(
true
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error:Cannot create new list
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
cannot create new list
"
);
}
}
});
});
it
(
"
SR000GGR4A_testGet002
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testGet002
"
,
0
,
function
()
{
...
@@ -230,7 +231,7 @@ describe("ListTest", function () {
...
@@ -230,7 +231,7 @@ describe("ListTest", function () {
list
.
add
(
"
c
"
);
list
.
add
(
"
c
"
);
list
.
add
(
"
a
"
);
list
.
add
(
"
a
"
);
let
res
=
list
.
set
(
2
,
"
d
"
);
let
res
=
list
.
set
(
2
,
"
d
"
);
let
res1
=
list
.
get
Node
(
2
).
element
;
let
res1
=
list
.
get
(
2
)
;
expect
(
res1
).
assertEqual
(
"
d
"
);
expect
(
res1
).
assertEqual
(
"
d
"
);
});
});
it
(
"
SR000GGR4A_testSort020
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testSort020
"
,
0
,
function
()
{
...
@@ -363,11 +364,8 @@ describe("ListTest", function () {
...
@@ -363,11 +364,8 @@ describe("ListTest", function () {
list
.
add
(
"
a
"
);
list
.
add
(
"
a
"
);
list
.
add
(
"
b
"
);
list
.
add
(
"
b
"
);
list
.
add
(
"
b
"
);
list
.
add
(
"
b
"
);
try
{
let
res
=
list
.
get
(
6
);
let
res
=
list
.
get
(
6
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
});
});
it
(
"
SR000GGR4A_testGetLastIndexOf029
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testGetLastIndexOf029
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
...
@@ -390,7 +388,8 @@ describe("ListTest", function () {
...
@@ -390,7 +388,8 @@ describe("ListTest", function () {
try
{
try
{
let
res
=
list
.
removeByIndex
(
5
);
let
res
=
list
.
removeByIndex
(
5
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: removeByIndex is out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR4A_testRemove031
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testRemove031
"
,
0
,
function
()
{
...
@@ -406,8 +405,12 @@ describe("ListTest", function () {
...
@@ -406,8 +405,12 @@ describe("ListTest", function () {
list
.
add
(
"
c
"
);
list
.
add
(
"
c
"
);
list
.
add
(
"
a
"
);
list
.
add
(
"
a
"
);
list
.
add
(
"
b
"
);
list
.
add
(
"
b
"
);
let
res
=
list
.
insert
(
"
d
"
,
8
);
try
{
expect
(
res
).
assertEqual
(
undefined
);
let
res
=
list
.
insert
(
"
d
"
,
8
);
}
catch
(
err
)
{
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
});
});
it
(
"
SR000GGR4A_testSort033
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testSort033
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
...
@@ -434,14 +437,11 @@ describe("ListTest", function () {
...
@@ -434,14 +437,11 @@ describe("ListTest", function () {
list
.
add
(
"
1
"
);
list
.
add
(
"
1
"
);
list
.
add
(
"
2
"
);
list
.
add
(
"
2
"
);
list
.
add
(
"
14
"
);
list
.
add
(
"
14
"
);
let
res
=
list
.
getSubList
(
2
,
8
);
try
{
let
arr
=
[];
list
.
getSubList
(
2
,
8
);
res
.
forEach
((
item
,
index
)
=>
{
}
catch
(
err
)
{
arr
.
push
(
item
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
});
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex or the toIndex is out-of-bounds
"
);
let
a
=
[
"
1
"
,
"
2
"
];
for
(
let
i
=
0
;
i
<
a
.
length
;
i
++
)
{
expect
(
arr
[
i
]).
assertEqual
(
a
[
i
]);
}
}
});
});
it
(
"
SR000GGR4A_testGetSubList035
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testGetSubList035
"
,
0
,
function
()
{
...
@@ -454,7 +454,8 @@ describe("ListTest", function () {
...
@@ -454,7 +454,8 @@ describe("ListTest", function () {
try
{
try
{
let
res
=
list
.
getSubList
(
6
,
8
);
let
res
=
list
.
getSubList
(
6
,
8
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: fromIndex or toIndex is out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex or the toIndex is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR4A_testGetSubList036
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testGetSubList036
"
,
0
,
function
()
{
...
@@ -467,9 +468,8 @@ describe("ListTest", function () {
...
@@ -467,9 +468,8 @@ describe("ListTest", function () {
try
{
try
{
let
res
=
list
.
getSubList
(
6
,
2
);
let
res
=
list
.
getSubList
(
6
,
2
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
"
Error: toIndex cannot be less than or equal to fromIndex
"
expect
(
err
.
message
).
assertEqual
(
"
the toIndex cannot be less than or equal to fromIndex
"
);
);
}
}
});
});
it
(
"
SR000GGR4A_testAdd037
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testAdd037
"
,
0
,
function
()
{
...
@@ -573,17 +573,15 @@ describe("ListTest", function () {
...
@@ -573,17 +573,15 @@ describe("ListTest", function () {
try
{
try
{
let
res
=
list
.
removeByIndex
(
1
);
let
res
=
list
.
removeByIndex
(
1
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: removeByIndex is out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR4A_testEqual050
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testEqual050
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
let
list1
=
new
List
();
let
list1
=
new
List
();
try
{
let
res
=
list
.
equal
(
list1
);
let
res
=
list
.
equal
(
list1
);
expect
(
res
).
assertEqual
(
true
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
});
});
it
(
"
SR000GGR4A_testGetIndexOf051
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testGetIndexOf051
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
...
@@ -593,38 +591,25 @@ describe("ListTest", function () {
...
@@ -593,38 +591,25 @@ describe("ListTest", function () {
it
(
"
SR000GGR4A_testForEach052
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testForEach052
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
let
num
=
0
;
let
num
=
0
;
try
{
list
.
forEach
((
item
,
index
)
=>
{
list
.
forEach
((
item
,
index
)
=>
{
num
++
;
num
++
;
});
});
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
expect
(
num
).
assertEqual
(
0
);
expect
(
num
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR4A_testIsEmpty053
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testIsEmpty053
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
try
{
let
res
=
list
.
isEmpty
();
let
res
=
list
.
isEmpty
();
expect
(
res
).
assertEqual
(
true
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: is not callable
"
);
}
});
});
it
(
"
SR000GGR4A_testHas054
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testHas054
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
try
{
let
res
=
list
.
has
(
1
);
let
res
=
list
.
has
(
1
);
expect
(
res
).
assertEqual
(
false
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
});
});
it
(
"
SR000GGR4A_testGet055
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testGet055
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
try
{
let
res
=
list
.
get
(
1
);
let
res
=
list
.
get
(
1
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
});
});
it
(
"
SR000GGR4A_testClear056
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testClear056
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
...
@@ -634,22 +619,15 @@ describe("ListTest", function () {
...
@@ -634,22 +619,15 @@ describe("ListTest", function () {
});
});
it
(
"
SR000GGR4A_testGetLast057
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testGetLast057
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
try
{
let
res
=
list
.
getLast
();
let
res
=
list
.
getLast
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
});
});
it
(
"
SR000GGR4A_testReplaceAllElements058
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testReplaceAllElements058
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
let
num
=
0
;
let
num
=
0
;
try
{
list
.
replaceAllElements
((
item
,
index
)
=>
{
list
.
replaceAllElements
((
item
,
index
)
=>
{
num
++
;
num
++
;
});
});
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
expect
(
num
).
assertEqual
(
0
);
expect
(
num
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR4A_testConvertToArray059
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testConvertToArray059
"
,
0
,
function
()
{
...
@@ -675,11 +653,8 @@ describe("ListTest", function () {
...
@@ -675,11 +653,8 @@ describe("ListTest", function () {
});
});
it
(
"
SR000GGR4A_testGetFirst062
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testGetFirst062
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
try
{
let
res
=
list
.
getFirst
();
let
res
=
list
.
getFirst
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
TypeError: Obj is not a valid object
"
);
}
});
});
it
(
"
SR000GGR4A_testIterator063
"
,
0
,
function
()
{
it
(
"
SR000GGR4A_testIterator063
"
,
0
,
function
()
{
let
list
=
new
List
();
let
list
=
new
List
();
...
@@ -701,4 +676,4 @@ describe("ListTest", function () {
...
@@ -701,4 +676,4 @@ describe("ListTest", function () {
expect
(
arr
[
i
]).
assertEqual
(
a
[
i
]);
expect
(
arr
[
i
]).
assertEqual
(
a
[
i
]);
}
}
});
});
});
});
compileruntime/containerLine_lib_standard/src/main/js/test/Main.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
...
compileruntime/containerLine_lib_standard/src/main/js/test/Queue.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -20,7 +20,8 @@ describe("QueueTest", function () {
...
@@ -20,7 +20,8 @@ describe("QueueTest", function () {
try
{
try
{
let
queue
=
new
Queue
();
let
queue
=
new
Queue
();
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error:Cannot create new queue
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new queue
"
);
}
}
});
});
it
(
"
SR000GGR48_testAdd002
"
,
0
,
function
()
{
it
(
"
SR000GGR48_testAdd002
"
,
0
,
function
()
{
...
@@ -157,24 +158,16 @@ describe("QueueTest", function () {
...
@@ -157,24 +158,16 @@ describe("QueueTest", function () {
it
(
"
SR000GGR48_testForEach017
"
,
0
,
function
()
{
it
(
"
SR000GGR48_testForEach017
"
,
0
,
function
()
{
let
queue
=
new
Queue
();
let
queue
=
new
Queue
();
let
arr
=
[];
let
arr
=
[];
try
{
queue
.
forEach
((
item
,
index
)
=>
{
queue
.
forEach
((
item
,
index
)
=>
{
arr
.
push
(
item
);
arr
.
push
(
item
);
});
});
expect
(
arr
.
length
).
assertEqual
(
0
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Queue: get out-of-bounds
"
);
}
expect
(
arr
.
length
).
assertEqual
(
1
);
});
});
it
(
"
SR000GGR48_testIterator018
"
,
0
,
function
()
{
it
(
"
SR000GGR48_testIterator018
"
,
0
,
function
()
{
let
queue
=
new
Queue
();
let
queue
=
new
Queue
();
let
arr
=
[];
let
arr
=
[];
try
{
for
(
let
item
of
queue
)
{
for
(
let
item
of
queue
)
{
arr
.
push
(
item
);
arr
.
push
(
item
);
}
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error:Cannot create new stack
"
);
}
}
expect
(
arr
.
length
).
assertEqual
(
0
);
expect
(
arr
.
length
).
assertEqual
(
0
);
});
});
...
...
compileruntime/containerLine_lib_standard/src/main/js/test/Stack.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -21,7 +21,8 @@ describe("StackTest", function () {
...
@@ -21,7 +21,8 @@ describe("StackTest", function () {
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
expect
(
stack
!=
undefined
).
assertEqual
(
true
);
expect
(
stack
!=
undefined
).
assertEqual
(
true
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Cannot create new stack
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new stack
"
);
}
}
});
});
it
(
"
SR000GGR49_testPush002
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush002
"
,
0
,
function
()
{
...
@@ -120,7 +121,7 @@ describe("StackTest", function () {
...
@@ -120,7 +121,7 @@ describe("StackTest", function () {
expect
(
arr
[
i
]).
assertEqual
(
a
[
i
]);
expect
(
arr
[
i
]).
assertEqual
(
a
[
i
]);
}
}
});
});
it
(
"
SR000GGR49_testLength011
_1
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testLength011
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
8
);
stack
.
push
(
8
);
stack
.
push
(
"
一
"
);
stack
.
push
(
"
一
"
);
...
@@ -129,12 +130,12 @@ describe("StackTest", function () {
...
@@ -129,12 +130,12 @@ describe("StackTest", function () {
let
res
=
stack
.
length
;
let
res
=
stack
.
length
;
expect
(
4
).
assertEqual
(
res
);
expect
(
4
).
assertEqual
(
res
);
});
});
it
(
"
SR000GGR49_testLength01
1_
2
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testLength012
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
let
res
=
stack
.
length
;
let
res
=
stack
.
length
;
expect
(
0
).
assertEqual
(
res
);
expect
(
0
).
assertEqual
(
res
);
});
});
it
(
"
SR000GGR49_testIsEmpty01
2_1
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testIsEmpty01
3
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
8
);
stack
.
push
(
8
);
stack
.
push
(
"
一
"
);
stack
.
push
(
"
一
"
);
...
@@ -143,42 +144,42 @@ describe("StackTest", function () {
...
@@ -143,42 +144,42 @@ describe("StackTest", function () {
let
res
=
stack
.
isEmpty
();
let
res
=
stack
.
isEmpty
();
expect
(
res
).
assertEqual
(
false
);
expect
(
res
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR49_testIsEmpty01
2_2
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testIsEmpty01
4
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
let
res
=
stack
.
isEmpty
();
let
res
=
stack
.
isEmpty
();
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR49_testPush01
3
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush01
5
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
"
你好世界
"
);
stack
.
push
(
"
你好世界
"
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
"
你好世界
"
);
expect
(
res
).
assertEqual
(
"
你好世界
"
);
});
});
it
(
"
SR000GGR49_testPush01
4
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush01
6
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
1234
);
stack
.
push
(
1234
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
1234
);
expect
(
res
).
assertEqual
(
1234
);
});
});
it
(
"
SR000GGR49_testPush01
5
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush01
7
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
1.234
);
stack
.
push
(
1.234
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
1.234
);
expect
(
res
).
assertEqual
(
1.234
);
});
});
it
(
"
SR000GGR49_testPush01
6
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush01
8
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
-
1234
);
stack
.
push
(
-
1234
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
-
1234
);
expect
(
res
).
assertEqual
(
-
1234
);
});
});
it
(
"
SR000GGR49_testPush01
7
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush01
9
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
0
);
stack
.
push
(
0
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
0
);
expect
(
res
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR49_testPush0
18
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush0
20
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
10
);
stack
.
push
(
10
);
stack
.
push
(
3.14
);
stack
.
push
(
3.14
);
...
@@ -188,103 +189,89 @@ describe("StackTest", function () {
...
@@ -188,103 +189,89 @@ describe("StackTest", function () {
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
"
*
"
);
expect
(
res
).
assertEqual
(
"
*
"
);
});
});
it
(
"
SR000GGR49_testPush0
19
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush0
21
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
let
arr
=
{};
let
arr
=
{};
stack
.
push
(
arr
);
stack
.
push
(
arr
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
arr
);
expect
(
res
).
assertEqual
(
arr
);
});
});
it
(
"
SR000GGR49_testPush02
0
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush02
2
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
let
arr
=
[];
let
arr
=
[];
stack
.
push
(
arr
);
stack
.
push
(
arr
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
arr
);
expect
(
res
).
assertEqual
(
arr
);
});
});
it
(
"
SR000GGR49_testPush02
1
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush02
3
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
"
hello world
"
);
stack
.
push
(
"
hello world
"
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
"
hello world
"
);
expect
(
res
).
assertEqual
(
"
hello world
"
);
});
});
it
(
"
SR000GGR49_testPush02
2
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush02
4
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
"
~!@#$^&*()_+-*/=.?<>:;|{}[]
"
);
stack
.
push
(
"
~!@#$^&*()_+-*/=.?<>:;|{}[]
"
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
"
~!@#$^&*()_+-*/=.?<>:;|{}[]
"
);
expect
(
res
).
assertEqual
(
"
~!@#$^&*()_+-*/=.?<>:;|{}[]
"
);
});
});
it
(
"
SR000GGR49_testPush02
3
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush02
5
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
""
);
stack
.
push
(
""
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
""
);
expect
(
res
).
assertEqual
(
""
);
});
});
it
(
"
SR000GGR49_testPush02
4
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush02
6
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
true
);
stack
.
push
(
true
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR49_testPush02
5
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush02
7
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
false
);
stack
.
push
(
false
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
false
);
expect
(
res
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR49_testPush02
6
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush02
8
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
null
);
stack
.
push
(
null
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
null
);
expect
(
res
).
assertEqual
(
null
);
});
});
it
(
"
SR000GGR49_testPush02
7
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush02
9
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
undefined
);
stack
.
push
(
undefined
);
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
undefined
);
expect
(
res
).
assertEqual
(
undefined
);
});
});
it
(
"
SR000GGR49_testPeek0
28
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPeek0
30
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
try
{
let
res
=
stack
.
peek
();
let
res
=
stack
.
peek
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Stack: get out-of-bounds
"
);
}
});
});
it
(
"
SR000GGR49_testPop0
29
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPop0
31
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
try
{
let
res
=
stack
.
pop
();
let
res
=
stack
.
pop
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Stack: get out-of-bounds
"
);
}
});
});
it
(
"
SR000GGR49_testForEach03
0
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testForEach03
2
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
let
arr
=
[];
let
arr
=
[];
try
{
stack
.
forEach
((
item
,
index
)
=>
{
stack
.
forEach
((
item
,
index
)
=>
{
arr
.
push
(
item
);
arr
.
push
(
item
);
});
});
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error:Cannot create new stack
"
);
}
expect
(
arr
.
length
).
assertEqual
(
0
);
expect
(
arr
.
length
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR49_testIterator03
1
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testIterator03
3
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
let
arr
=
[];
let
arr
=
[];
try
{
for
(
let
item
of
stack
)
{
for
(
let
item
of
stack
)
{
arr
.
push
(
item
);
arr
.
push
(
item
);
}
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error:Cannot create new stack
"
);
}
}
expect
(
arr
.
length
).
assertEqual
(
0
);
expect
(
arr
.
length
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR49_testPush03
2
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testPush03
4
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
for
(
let
i
=
0
;
i
<
1000
;
i
++
)
{
stack
.
push
(
i
);
stack
.
push
(
i
);
...
@@ -294,7 +281,7 @@ describe("StackTest", function () {
...
@@ -294,7 +281,7 @@ describe("StackTest", function () {
let
res1
=
stack
.
peek
();
let
res1
=
stack
.
peek
();
expect
(
res1
).
assertEqual
(
999
);
expect
(
res1
).
assertEqual
(
999
);
});
});
it
(
"
SR000GGR49_testIterator03
3
"
,
0
,
function
()
{
it
(
"
SR000GGR49_testIterator03
5
"
,
0
,
function
()
{
let
stack
=
new
Stack
();
let
stack
=
new
Stack
();
stack
.
push
(
8
);
stack
.
push
(
8
);
stack
.
push
(
"
一
"
);
stack
.
push
(
"
一
"
);
...
...
compileruntime/containerLine_lib_standard/src/main/js/test/Vector.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -20,7 +20,8 @@ describe("VectorTest", function () {
...
@@ -20,7 +20,8 @@ describe("VectorTest", function () {
try
{
try
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Cannot create new vector
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new vector
"
);
}
}
});
});
it
(
"
SR000GGR47_testAdd002
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testAdd002
"
,
0
,
function
()
{
...
@@ -68,7 +69,8 @@ describe("VectorTest", function () {
...
@@ -68,7 +69,8 @@ describe("VectorTest", function () {
try
{
try
{
vector
.
insert
(
-
1
,
2
);
vector
.
insert
(
-
1
,
2
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Vector: get out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR47_testInsert008
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testInsert008
"
,
0
,
function
()
{
...
@@ -78,11 +80,9 @@ describe("VectorTest", function () {
...
@@ -78,11 +80,9 @@ describe("VectorTest", function () {
vector
.
add
(
1
);
vector
.
add
(
1
);
vector
.
add
(
"
a
"
);
vector
.
add
(
"
a
"
);
let
capacity
=
vector
.
getCapacity
();
let
capacity
=
vector
.
getCapacity
();
try
{
vector
.
insert
(
capacity
,
2
);
vector
.
insert
(
capacity
,
2
);
let
res
=
vector
.
get
(
2
);
}
catch
(
err
)
{
expect
(
res
).
assertEqual
(
10
);
expect
(
err
).
assertEqual
(
"
Vector: get out-of-bounds
"
);
}
});
});
it
(
"
SR000GGR47_testInsert009
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testInsert009
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
...
@@ -92,9 +92,10 @@ describe("VectorTest", function () {
...
@@ -92,9 +92,10 @@ describe("VectorTest", function () {
vector
.
add
(
"
a
"
);
vector
.
add
(
"
a
"
);
let
capacity
=
vector
.
getCapacity
();
let
capacity
=
vector
.
getCapacity
();
try
{
try
{
vector
.
insert
(
capacity
+
1
,
2
);
vector
.
insert
(
2
,
capacity
+
1
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Vector: get out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR47_testLength010
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testLength010
"
,
0
,
function
()
{
...
@@ -146,7 +147,8 @@ describe("VectorTest", function () {
...
@@ -146,7 +147,8 @@ describe("VectorTest", function () {
try
{
try
{
let
res
=
vector
.
get
(
10
);
let
res
=
vector
.
get
(
10
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Vector: get out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR47_testGetIndexOf015
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testGetIndexOf015
"
,
0
,
function
()
{
...
@@ -166,19 +168,13 @@ describe("VectorTest", function () {
...
@@ -166,19 +168,13 @@ describe("VectorTest", function () {
vector
.
add
(
1
);
vector
.
add
(
1
);
vector
.
add
(
"
a
"
);
vector
.
add
(
"
a
"
);
vector
.
insert
(
8
,
2
);
vector
.
insert
(
8
,
2
);
try
{
let
res
=
vector
.
getFirstElement
();
let
res
=
vector
.
getFirstElement
();
expect
(
res
).
assertEqual
(
"
四
"
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Vector: get out-of-bounds
"
);
}
});
});
it
(
"
SR000GGR47_testGetFirstElement017
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testGetFirstElement017
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
try
{
let
res
=
vector
.
getFirstElement
();
let
res
=
vector
.
getFirstElement
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Vector: get out-of-bounds
"
);
}
});
});
it
(
"
SR000GGR47_testSet018
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testSet018
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
...
@@ -232,12 +228,8 @@ describe("VectorTest", function () {
...
@@ -232,12 +228,8 @@ describe("VectorTest", function () {
});
});
it
(
"
SR000GGR47_testGetLastElement023
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testGetLastElement023
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
let
res1
=
vector
.
length
;
let
res
=
vector
.
getLastElement
();
try
{
expect
(
res
).
assertEqual
(
undefined
);
let
res
=
vector
.
getLastElement
();
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Vector: get out-of-bounds
"
);
}
});
});
it
(
"
SR000GGR47_testGetLastIndexOf024
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testGetLastIndexOf024
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
...
@@ -309,7 +301,8 @@ describe("VectorTest", function () {
...
@@ -309,7 +301,8 @@ describe("VectorTest", function () {
try
{
try
{
vector
.
removeByRange
(
3
,
1
);
vector
.
removeByRange
(
3
,
1
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: fromIndex cannot be less than or equal to toIndex
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex cannot be less than or equal to toIndex
"
);
}
}
});
});
it
(
"
SR000GGR47_testRemoveByRange029
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testRemoveByRange029
"
,
0
,
function
()
{
...
@@ -321,7 +314,8 @@ describe("VectorTest", function () {
...
@@ -321,7 +314,8 @@ describe("VectorTest", function () {
try
{
try
{
vector
.
removeByRange
(
length
+
1
,
7
);
vector
.
removeByRange
(
length
+
1
,
7
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Vector: set out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex or the toIndex is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR47_testRemoveByRange030
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testRemoveByRange030
"
,
0
,
function
()
{
...
@@ -333,7 +327,8 @@ describe("VectorTest", function () {
...
@@ -333,7 +327,8 @@ describe("VectorTest", function () {
try
{
try
{
vector
.
removeByRange
(
1
,
7
);
vector
.
removeByRange
(
1
,
7
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
vector: deleteProperty out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR47_testRemoveByRange031
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testRemoveByRange031
"
,
0
,
function
()
{
...
@@ -347,16 +342,12 @@ describe("VectorTest", function () {
...
@@ -347,16 +342,12 @@ describe("VectorTest", function () {
vector
.
add
(
"
c
"
);
vector
.
add
(
"
c
"
);
vector
.
add
(
1
);
vector
.
add
(
1
);
let
capacity
=
vector
.
getCapacity
();
let
capacity
=
vector
.
getCapacity
();
try
{
vector
.
removeByRange
(
0
,
capacity
);
vector
.
removeByRange
(
0
,
capacity
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Vector: set out-of-bounds
"
);
}
let
arr
=
[];
let
arr
=
[];
vector
.
forEach
((
item
,
index
)
=>
{
vector
.
forEach
((
item
,
index
)
=>
{
arr
.
push
(
item
);
arr
.
push
(
item
);
});
});
expect
(
arr
.
length
).
assertEqual
(
1
);
expect
(
arr
.
length
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR47_testRemoveByRange032
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testRemoveByRange032
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
...
@@ -372,7 +363,8 @@ describe("VectorTest", function () {
...
@@ -372,7 +363,8 @@ describe("VectorTest", function () {
try
{
try
{
vector
.
removeByRange
(
-
1
,
capacity
);
vector
.
removeByRange
(
-
1
,
capacity
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Vector: set out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex or the toIndex is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR47_testRemoveByRange033
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testRemoveByRange033
"
,
0
,
function
()
{
...
@@ -388,7 +380,7 @@ describe("VectorTest", function () {
...
@@ -388,7 +380,7 @@ describe("VectorTest", function () {
let
capacity
=
vector
.
getCapacity
();
let
capacity
=
vector
.
getCapacity
();
vector
.
removeByRange
(
0
,
capacity
+
1
);
vector
.
removeByRange
(
0
,
capacity
+
1
);
let
length
=
vector
.
length
;
let
length
=
vector
.
length
;
expect
(
length
).
assertEqual
(
1
);
expect
(
length
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR47_testSetLength034
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testSetLength034
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
...
@@ -448,7 +440,7 @@ describe("VectorTest", function () {
...
@@ -448,7 +440,7 @@ describe("VectorTest", function () {
let
a
=
[
4
,
3
,
1
,
2
,
14
];
let
a
=
[
4
,
3
,
1
,
2
,
14
];
expect
(
arr
.
length
).
assertEqual
(
0
);
expect
(
arr
.
length
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR47_test
Constru
ctor038
"
,
0
,
function
()
{
it
(
"
SR000GGR47_test
SubVe
ctor038
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
vector
.
add
(
4
);
vector
.
add
(
4
);
vector
.
add
(
3
);
vector
.
add
(
3
);
...
@@ -465,7 +457,7 @@ describe("VectorTest", function () {
...
@@ -465,7 +457,7 @@ describe("VectorTest", function () {
expect
(
arr
[
i
]).
assertEqual
(
a
[
i
]);
expect
(
arr
[
i
]).
assertEqual
(
a
[
i
]);
}
}
});
});
it
(
"
SR000GGR47_test
Constru
ctor039
"
,
0
,
function
()
{
it
(
"
SR000GGR47_test
SubVe
ctor039
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
vector
.
add
(
4
);
vector
.
add
(
4
);
vector
.
add
(
3
);
vector
.
add
(
3
);
...
@@ -475,12 +467,11 @@ describe("VectorTest", function () {
...
@@ -475,12 +467,11 @@ describe("VectorTest", function () {
try
{
try
{
let
res
=
vector
.
subVector
(
4
,
2
);
let
res
=
vector
.
subVector
(
4
,
2
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
"
Error: fromIndex cannot be less than or equal to toIndex
"
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex cannot be less than or equal to toIndex
"
);
);
}
}
});
});
it
(
"
SR000GGR47_test
Constru
ctor040
"
,
0
,
function
()
{
it
(
"
SR000GGR47_test
SubVe
ctor040
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
vector
.
add
(
4
);
vector
.
add
(
4
);
vector
.
add
(
3
);
vector
.
add
(
3
);
...
@@ -489,12 +480,13 @@ describe("VectorTest", function () {
...
@@ -489,12 +480,13 @@ describe("VectorTest", function () {
vector
.
add
(
14
);
vector
.
add
(
14
);
let
length
=
vector
.
length
;
let
length
=
vector
.
length
;
try
{
try
{
let
res
=
vector
.
subVector
(
length
+
1
,
length
+
3
);
vector
.
subVector
(
length
+
1
,
length
+
3
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: fromIndex or toIndex is out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex or the toIndex is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR47_test
Constru
ctor041
"
,
0
,
function
()
{
it
(
"
SR000GGR47_test
SubVe
ctor041
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
vector
.
add
(
4
);
vector
.
add
(
4
);
vector
.
add
(
3
);
vector
.
add
(
3
);
...
@@ -505,7 +497,8 @@ describe("VectorTest", function () {
...
@@ -505,7 +497,8 @@ describe("VectorTest", function () {
try
{
try
{
let
res
=
vector
.
subVector
(
1
,
length
+
1
);
let
res
=
vector
.
subVector
(
1
,
length
+
1
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Vector: get out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the fromIndex or the toIndex is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR47_testClear042
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testClear042
"
,
0
,
function
()
{
...
@@ -739,18 +732,6 @@ describe("VectorTest", function () {
...
@@ -739,18 +732,6 @@ describe("VectorTest", function () {
let
res
=
vector
.
isEmpty
();
let
res
=
vector
.
isEmpty
();
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR47_testFor059
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
vector
.
add
(
"
四
"
);
let
length
=
vector
.
length
;
try
{
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
console
.
log
(
vector
[
i
]);
}
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Cannot create new vector
"
);
}
});
it
(
"
SR000GGR47_testAdd060
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testAdd060
"
,
0
,
function
()
{
let
vector
=
new
Vector
();
let
vector
=
new
Vector
();
for
(
let
i
=
0
;
i
<
100
;
i
++
)
{
for
(
let
i
=
0
;
i
<
100
;
i
++
)
{
...
@@ -800,7 +781,8 @@ describe("VectorTest", function () {
...
@@ -800,7 +781,8 @@ describe("VectorTest", function () {
try
{
try
{
vector
.
set
(
12
,
"
二
"
);
vector
.
set
(
12
,
"
二
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Vector: set out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR47_testRemoveByIndex067
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testRemoveByIndex067
"
,
0
,
function
()
{
...
@@ -810,7 +792,8 @@ describe("VectorTest", function () {
...
@@ -810,7 +792,8 @@ describe("VectorTest", function () {
try
{
try
{
vector
.
removeByIndex
(
12
);
vector
.
removeByIndex
(
12
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Vector: get out-of-bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR47_testGetLastIndexOf068
"
,
0
,
function
()
{
it
(
"
SR000GGR47_testGetLastIndexOf068
"
,
0
,
function
()
{
...
...
compileruntime/containerRelation_lib_standard/BUILD.gn
浏览文件 @
e04ff3e7
# Copyright (C) 202
1
Huawei Device Co., Ltd.
# Copyright (C) 202
2
Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# You may obtain a copy of the License at
...
...
compileruntime/containerRelation_lib_standard/src/main/js/default/app.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
...
compileruntime/containerRelation_lib_standard/src/main/js/default/pages/index/index.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
...
compileruntime/containerRelation_lib_standard/src/main/js/test/ExampleJsunit.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
...
compileruntime/containerRelation_lib_standard/src/main/js/test/HashMap.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -21,110 +21,111 @@ describe("HashMapTest", function () {
...
@@ -21,110 +21,111 @@ describe("HashMapTest", function () {
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
expect
(
hashMap
!=
undefined
).
assertEqual
(
true
);
expect
(
hashMap
!=
undefined
).
assertEqual
(
true
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Cannot create new HashMap
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new HashMap
"
);
}
}
});
});
it
(
"
SR000GGR4B_testSet002
_1
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet002
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
let
res
=
hashMap
.
get
(
1
);
let
res
=
hashMap
.
get
(
1
);
expect
(
res
).
assertEqual
(
"
A
"
);
expect
(
res
).
assertEqual
(
"
A
"
);
});
});
it
(
"
SR000GGR4B_testSet00
2_2
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet00
3
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
2
);
hashMap
.
set
(
1
,
2
);
let
res
=
hashMap
.
get
(
1
);
let
res
=
hashMap
.
get
(
1
);
expect
(
res
).
assertEqual
(
2
);
expect
(
res
).
assertEqual
(
2
);
});
});
it
(
"
SR000GGR4B_testSet00
2_3
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet00
4
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
c
=
[
1
,
2
,
3
];
let
c
=
[
1
,
2
,
3
];
hashMap
.
set
(
1
,
c
);
hashMap
.
set
(
1
,
c
);
let
res
=
hashMap
.
get
(
1
);
let
res
=
hashMap
.
get
(
1
);
expect
(
res
).
assertEqual
(
c
);
expect
(
res
).
assertEqual
(
c
);
});
});
it
(
"
SR000GGR4B_testSet00
2_4
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet00
5
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
c
=
{
name
:
"
lili
"
,
age
:
"
13
"
};
let
c
=
{
name
:
"
lili
"
,
age
:
"
13
"
};
hashMap
.
set
(
1
,
c
);
hashMap
.
set
(
1
,
c
);
let
res
=
hashMap
.
get
(
1
);
let
res
=
hashMap
.
get
(
1
);
expect
(
res
).
assertEqual
(
c
);
expect
(
res
).
assertEqual
(
c
);
});
});
it
(
"
SR000GGR4B_testSet00
2_5
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet00
6
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
"
a
"
,
"
A
"
);
hashMap
.
set
(
"
a
"
,
"
A
"
);
let
res
=
hashMap
.
get
(
"
a
"
);
let
res
=
hashMap
.
get
(
"
a
"
);
expect
(
res
).
assertEqual
(
"
A
"
);
expect
(
res
).
assertEqual
(
"
A
"
);
});
});
it
(
"
SR000GGR4B_testSet00
2_6
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet00
7
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
""
,
"
A
"
);
hashMap
.
set
(
""
,
"
A
"
);
let
res
=
hashMap
.
get
(
""
);
let
res
=
hashMap
.
get
(
""
);
expect
(
res
).
assertEqual
(
"
A
"
);
expect
(
res
).
assertEqual
(
"
A
"
);
});
});
it
(
"
SR000GGR4B_testSet00
2_7
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet00
8
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
"
$
"
,
"
A
"
);
hashMap
.
set
(
"
$
"
,
"
A
"
);
let
res
=
hashMap
.
get
(
"
$
"
);
let
res
=
hashMap
.
get
(
"
$
"
);
expect
(
res
).
assertEqual
(
"
A
"
);
expect
(
res
).
assertEqual
(
"
A
"
);
});
});
it
(
"
SR000GGR4B_testSet00
2_8
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet00
9
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
3.14
,
"
A
"
);
hashMap
.
set
(
3.14
,
"
A
"
);
let
res
=
hashMap
.
get
(
3.14
);
let
res
=
hashMap
.
get
(
3.14
);
expect
(
res
).
assertEqual
(
"
A
"
);
expect
(
res
).
assertEqual
(
"
A
"
);
});
});
it
(
"
SR000GGR4B_testSet0
02_9
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet0
10
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
0.3
,
"
A
"
);
hashMap
.
set
(
0.3
,
"
A
"
);
let
res
=
hashMap
.
get
(
0.3
);
let
res
=
hashMap
.
get
(
0.3
);
expect
(
res
).
assertEqual
(
"
A
"
);
expect
(
res
).
assertEqual
(
"
A
"
);
});
});
it
(
"
SR000GGR4B_testSet0
02_10
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet0
11
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
-
1
,
"
A
"
);
hashMap
.
set
(
-
1
,
"
A
"
);
let
res
=
hashMap
.
get
(
-
1
);
let
res
=
hashMap
.
get
(
-
1
);
expect
(
res
).
assertEqual
(
"
A
"
);
expect
(
res
).
assertEqual
(
"
A
"
);
});
});
it
(
"
SR000GGR4B_testSet0
02_11
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet0
12
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
a
=
{};
let
a
=
{};
hashMap
.
set
(
a
,
"
A
"
);
hashMap
.
set
(
a
,
"
A
"
);
let
res
=
hashMap
.
get
(
a
);
let
res
=
hashMap
.
get
(
a
);
expect
(
res
).
assertEqual
(
"
A
"
);
expect
(
res
).
assertEqual
(
"
A
"
);
});
});
it
(
"
SR000GGR4B_testSet0
02_12
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet0
13
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
undefined
);
hashMap
.
set
(
1
,
null
);
let
res
=
hashMap
.
get
(
1
);
let
res
=
hashMap
.
get
(
1
);
expect
(
res
).
assertEqual
(
undefined
);
expect
(
res
).
assertEqual
(
null
);
});
});
it
(
"
SR000GGR4B_testSet0
02_13
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet0
14
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
$
"
);
hashMap
.
set
(
1
,
"
$
"
);
let
res
=
hashMap
.
get
(
1
);
let
res
=
hashMap
.
get
(
1
);
expect
(
res
).
assertEqual
(
"
$
"
);
expect
(
res
).
assertEqual
(
"
$
"
);
});
});
it
(
"
SR000GGR4B_testSet0
02_14
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet0
15
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
3.14
);
hashMap
.
set
(
1
,
3.14
);
let
res
=
hashMap
.
get
(
1
);
let
res
=
hashMap
.
get
(
1
);
expect
(
res
).
assertEqual
(
3.14
);
expect
(
res
).
assertEqual
(
3.14
);
});
});
it
(
"
SR000GGR4B_testSet0
02_15
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet0
16
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
-
1
);
hashMap
.
set
(
1
,
-
1
);
let
res
=
hashMap
.
get
(
1
);
let
res
=
hashMap
.
get
(
1
);
expect
(
res
).
assertEqual
(
-
1
);
expect
(
res
).
assertEqual
(
-
1
);
});
});
it
(
"
SR000GGR4B_testSet0
02_16
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet0
17
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
a
=
{};
let
a
=
{};
hashMap
.
set
(
1
,
a
);
hashMap
.
set
(
1
,
a
);
let
res
=
hashMap
.
get
(
1
);
let
res
=
hashMap
.
get
(
1
);
expect
(
res
).
assertEqual
(
a
);
expect
(
res
).
assertEqual
(
a
);
});
});
it
(
"
SR000GGR4B_testSet0
02_17
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet0
18
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
for
(
let
i
=
0
;
i
<
100
;
i
++
)
{
for
(
let
i
=
0
;
i
<
100
;
i
++
)
{
hashMap
.
set
(
1
,
i
);
hashMap
.
set
(
1
,
i
);
...
@@ -134,7 +135,7 @@ describe("HashMapTest", function () {
...
@@ -134,7 +135,7 @@ describe("HashMapTest", function () {
expect
(
res
).
assertEqual
(
99
);
expect
(
res
).
assertEqual
(
99
);
expect
(
res1
).
assertEqual
(
1
);
expect
(
res1
).
assertEqual
(
1
);
});
});
it
(
"
SR000GGR4B_testSet0
02_18
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSet0
19
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
for
(
let
i
=
0
;
i
<
100
;
i
++
)
{
for
(
let
i
=
0
;
i
<
100
;
i
++
)
{
hashMap
.
set
(
i
,
1
);
hashMap
.
set
(
i
,
1
);
...
@@ -144,7 +145,7 @@ describe("HashMapTest", function () {
...
@@ -144,7 +145,7 @@ describe("HashMapTest", function () {
let
res1
=
hashMap
.
length
;
let
res1
=
hashMap
.
length
;
expect
(
res1
).
assertEqual
(
100
);
expect
(
res1
).
assertEqual
(
100
);
});
});
it
(
"
SR000GGR4B_testLength0
03
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testLength0
20
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -154,7 +155,7 @@ describe("HashMapTest", function () {
...
@@ -154,7 +155,7 @@ describe("HashMapTest", function () {
let
res
=
hashMap
.
length
;
let
res
=
hashMap
.
length
;
expect
(
res
).
assertEqual
(
5
);
expect
(
res
).
assertEqual
(
5
);
});
});
it
(
"
SR000GGR4B_testHasKey0
04_
1
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testHasKey0
2
1
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -166,12 +167,12 @@ describe("HashMapTest", function () {
...
@@ -166,12 +167,12 @@ describe("HashMapTest", function () {
let
res1
=
hashMap
.
hasKey
(
8
);
let
res1
=
hashMap
.
hasKey
(
8
);
expect
(
res1
).
assertEqual
(
false
);
expect
(
res1
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR4B_testHasKey0
04_
2
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testHasKey0
2
2
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
res
=
hashMap
.
hasKey
(
8
);
let
res
=
hashMap
.
hasKey
(
8
);
expect
(
res
).
assertEqual
(
false
);
expect
(
res
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR4B_testHasValue0
05_1
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testHasValue0
23
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -183,12 +184,12 @@ describe("HashMapTest", function () {
...
@@ -183,12 +184,12 @@ describe("HashMapTest", function () {
let
res1
=
hashMap
.
hasValue
(
8
);
let
res1
=
hashMap
.
hasValue
(
8
);
expect
(
res1
).
assertEqual
(
false
);
expect
(
res1
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR4B_testHasValue0
05_2
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testHasValue0
24
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
res
=
hashMap
.
hasValue
(
8
);
let
res
=
hashMap
.
hasValue
(
8
);
expect
(
res
).
assertEqual
(
false
);
expect
(
res
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR4B_testGet0
06_1
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testGet0
25
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -198,17 +199,12 @@ describe("HashMapTest", function () {
...
@@ -198,17 +199,12 @@ describe("HashMapTest", function () {
let
res
=
hashMap
.
get
(
3
);
let
res
=
hashMap
.
get
(
3
);
expect
(
res
).
assertEqual
(
"
C
"
);
expect
(
res
).
assertEqual
(
"
C
"
);
});
});
it
(
"
SR000GGR4B_testGet0
06_2
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testGet0
26
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
try
{
let
res
=
hashMap
.
get
(
3
);
let
res
=
hashMap
.
get
(
3
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: The removed element does not exist in this container
"
);
}
});
});
it
(
"
SR000GGR4B_testSetAll0
07_1
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSetAll0
27
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -232,7 +228,7 @@ describe("HashMapTest", function () {
...
@@ -232,7 +228,7 @@ describe("HashMapTest", function () {
expect
(
arr
[
i
][
1
]).
assertEqual
(
hashMap
.
get
(
i
+
1
));
expect
(
arr
[
i
][
1
]).
assertEqual
(
hashMap
.
get
(
i
+
1
));
}
}
});
});
it
(
"
SR000GGR4B_testSetAll0
07_2
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testSetAll0
28
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
hashMap1
=
new
HashMap
();
let
hashMap1
=
new
HashMap
();
hashMap1
.
set
(
1
,
1
);
hashMap1
.
set
(
1
,
1
);
...
@@ -251,7 +247,7 @@ describe("HashMapTest", function () {
...
@@ -251,7 +247,7 @@ describe("HashMapTest", function () {
);
);
}
}
});
});
it
(
"
SR000GGR4B_testRemove0
08_1
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testRemove0
29
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -263,17 +259,12 @@ describe("HashMapTest", function () {
...
@@ -263,17 +259,12 @@ describe("HashMapTest", function () {
let
res1
=
hashMap
.
length
;
let
res1
=
hashMap
.
length
;
expect
(
res1
).
assertEqual
(
4
);
expect
(
res1
).
assertEqual
(
4
);
});
});
it
(
"
SR000GGR4B_testRemove0
08_2
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testRemove0
30
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
try
{
let
res
=
hashMap
.
remove
(
3
);
let
res
=
hashMap
.
remove
(
3
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: The removed element does not exist in this container
"
);
}
});
});
it
(
"
SR000GGR4B_testClear0
09
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testClear0
31
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -286,13 +277,13 @@ describe("HashMapTest", function () {
...
@@ -286,13 +277,13 @@ describe("HashMapTest", function () {
let
res1
=
hashMap
.
length
;
let
res1
=
hashMap
.
length
;
expect
(
res1
).
assertEqual
(
0
);
expect
(
res1
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR4B_testClear0
10
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testClear0
32
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
clear
();
hashMap
.
clear
();
let
res
=
hashMap
.
length
;
let
res
=
hashMap
.
length
;
expect
(
res
).
assertEqual
(
0
);
expect
(
res
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR4B_testKeys0
10
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testKeys0
33
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -304,7 +295,7 @@ describe("HashMapTest", function () {
...
@@ -304,7 +295,7 @@ describe("HashMapTest", function () {
console
.
log
(
res
.
next
());
console
.
log
(
res
.
next
());
}
}
});
});
it
(
"
SR000GGR4B_testValues0
11
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testValues0
34
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -317,7 +308,7 @@ describe("HashMapTest", function () {
...
@@ -317,7 +308,7 @@ describe("HashMapTest", function () {
expect
(
has
).
assertEqual
(
true
);
expect
(
has
).
assertEqual
(
true
);
}
}
});
});
it
(
"
SR000GGR4B_testReplace0
12_1
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testReplace0
35
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -328,12 +319,12 @@ describe("HashMapTest", function () {
...
@@ -328,12 +319,12 @@ describe("HashMapTest", function () {
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
expect
(
hashMap
.
get
(
2
)).
assertEqual
(
"
G
"
);
expect
(
hashMap
.
get
(
2
)).
assertEqual
(
"
G
"
);
});
});
it
(
"
SR000GGR4B_testReplace0
12_2
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testReplace0
36
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
res
=
hashMap
.
replace
(
2
,
"
G
"
);
let
res
=
hashMap
.
replace
(
2
,
"
G
"
);
expect
(
res
).
assertEqual
(
false
);
expect
(
res
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR4B_testForEach0
13_1
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testForEach0
37
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -355,19 +346,15 @@ describe("HashMapTest", function () {
...
@@ -355,19 +346,15 @@ describe("HashMapTest", function () {
expect
(
has
).
assertEqual
(
true
);
expect
(
has
).
assertEqual
(
true
);
}
}
});
});
it
(
"
SR000GGR4B_testForEach0
13_2
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testForEach0
38
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
arr
=
[];
let
arr
=
[];
try
{
hashMap
.
forEach
((
item
,
index
)
=>
{
hashMap
.
forEach
((
item
,
index
)
=>
{
arr
.
push
(
item
);
arr
.
push
(
item
);
});
});
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error:Cannot create new hashMap
"
);
}
expect
(
arr
.
length
).
assertEqual
(
0
);
expect
(
arr
.
length
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR4B_testIterator0
14_1
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testIterator0
39
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -386,19 +373,15 @@ describe("HashMapTest", function () {
...
@@ -386,19 +373,15 @@ describe("HashMapTest", function () {
expect
(
arr
[
i
][
1
]).
assertEqual
(
hashMap
.
get
(
i
+
1
));
expect
(
arr
[
i
][
1
]).
assertEqual
(
hashMap
.
get
(
i
+
1
));
}
}
});
});
it
(
"
SR000GGR4B_testIterator0
14_2
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testIterator0
40
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
arr
=
[];
let
arr
=
[];
try
{
for
(
let
item
of
hashMap
)
{
for
(
let
item
of
hashMap
)
{
arr
.
push
(
item
);
arr
.
push
(
item
);
}
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Cannot create new HashMap
"
);
}
}
expect
(
arr
.
length
).
assertEqual
(
0
);
expect
(
arr
.
length
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR4B_testEntries0
15_
1
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testEntries0
4
1
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -419,12 +402,12 @@ describe("HashMapTest", function () {
...
@@ -419,12 +402,12 @@ describe("HashMapTest", function () {
expect
(
arr
[
i
][
1
]).
assertEqual
(
hashMap
.
get
(
i
+
1
));
expect
(
arr
[
i
][
1
]).
assertEqual
(
hashMap
.
get
(
i
+
1
));
}
}
});
});
it
(
"
SR000GGR4B_testEntries0
15_
2
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testEntries0
4
2
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
res
=
hashMap
.
entries
();
let
res
=
hashMap
.
entries
();
expect
(
undefined
).
assertEqual
(
res
.
next
().
value
);
expect
(
undefined
).
assertEqual
(
res
.
next
().
value
);
});
});
it
(
"
SR000GGR4B_testIsEmpty0
16_1
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testIsEmpty0
43
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -436,7 +419,7 @@ describe("HashMapTest", function () {
...
@@ -436,7 +419,7 @@ describe("HashMapTest", function () {
expect
(
res
).
assertEqual
(
5
);
expect
(
res
).
assertEqual
(
5
);
expect
(
res1
).
assertEqual
(
false
);
expect
(
res1
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR4B_testIsEmpty0
16_2
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testIsEmpty0
44
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -449,12 +432,12 @@ describe("HashMapTest", function () {
...
@@ -449,12 +432,12 @@ describe("HashMapTest", function () {
expect
(
res
).
assertEqual
(
0
);
expect
(
res
).
assertEqual
(
0
);
expect
(
res1
).
assertEqual
(
true
);
expect
(
res1
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR4B_testEntries04
3
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testEntries04
5
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
let
res
=
hashMap
.
entries
();
let
res
=
hashMap
.
entries
();
expect
(
undefined
).
assertEqual
(
res
.
next
().
value
);
expect
(
undefined
).
assertEqual
(
res
.
next
().
value
);
});
});
it
(
"
SR000GGR4B_testIterator04
4
"
,
0
,
function
()
{
it
(
"
SR000GGR4B_testIterator04
6
"
,
0
,
function
()
{
let
hashMap
=
new
HashMap
();
let
hashMap
=
new
HashMap
();
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
1
,
"
A
"
);
hashMap
.
set
(
2
,
"
B
"
);
hashMap
.
set
(
2
,
"
B
"
);
...
@@ -462,18 +445,16 @@ describe("HashMapTest", function () {
...
@@ -462,18 +445,16 @@ describe("HashMapTest", function () {
hashMap
.
set
(
4
,
"
D
"
);
hashMap
.
set
(
4
,
"
D
"
);
hashMap
.
set
(
5
,
"
E
"
);
hashMap
.
set
(
5
,
"
E
"
);
let
arr
=
[];
let
arr
=
[];
let
res
=
hashMap
[
Symbol
.
iterator
]();
let
iters
=
hashMap
[
Symbol
.
iterator
]();
let
temp
=
undefined
;
let
flag
=
true
;
do
{
for
(
let
i
=
0
,
len
=
hashMap
.
length
;
i
<
len
;
i
++
)
{
temp
=
res
.
next
().
value
;
let
entry
=
iters
.
next
().
value
;
arr
.
push
(
temp
);
let
res
=
hashMap
.
get
(
entry
[
0
]);
}
while
(
temp
!=
undefined
);
if
(
res
!=
entry
[
1
])
{
arr
.
sort
(
function
(
a
,
b
)
{
flag
=
false
;
return
a
[
0
]
-
b
[
0
];
break
;
});
}
let
arr1
=
[
"
1,A
"
,
"
2,B
"
,
"
3,C
"
,
"
4,D
"
,
"
5,E
"
];
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
}
expect
(
flag
).
assertEqual
(
true
);
});
});
});
});
compileruntime/containerRelation_lib_standard/src/main/js/test/HashSet.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -20,7 +20,8 @@ describe("HashSetTest", function () {
...
@@ -20,7 +20,8 @@ describe("HashSetTest", function () {
try
{
try
{
let
hashSet
=
new
HashSet
();
let
hashSet
=
new
HashSet
();
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Cannot create new HashSet
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new HashSet
"
);
}
}
});
});
it
(
"
SR000GGR3J_testAdd001
"
,
0
,
function
()
{
it
(
"
SR000GGR3J_testAdd001
"
,
0
,
function
()
{
...
...
compileruntime/containerRelation_lib_standard/src/main/js/test/LightWeightMap.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -21,7 +21,8 @@ describe("LightWeightMapTest", function () {
...
@@ -21,7 +21,8 @@ describe("LightWeightMapTest", function () {
let
lightWeightMap
=
new
LightWeightMap
();
let
lightWeightMap
=
new
LightWeightMap
();
expect
(
lightWeightMap
!=
undefined
).
assertEqual
(
true
);
expect
(
lightWeightMap
!=
undefined
).
assertEqual
(
true
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error:Cannot create new TreeMap
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new TreeMap
"
);
}
}
});
});
it
(
"
SR00GGR3L_testSet002
"
,
0
,
function
()
{
it
(
"
SR00GGR3L_testSet002
"
,
0
,
function
()
{
...
@@ -122,8 +123,9 @@ describe("LightWeightMapTest", function () {
...
@@ -122,8 +123,9 @@ describe("LightWeightMapTest", function () {
lightWeightMap
.
set
(
"
c
"
,
"
C
"
);
lightWeightMap
.
set
(
"
c
"
,
"
C
"
);
lightWeightMap
.
set
(
"
d
"
,
"
D
"
);
lightWeightMap
.
set
(
"
d
"
,
"
D
"
);
lightWeightMap
.
set
(
"
e
"
,
"
E
"
);
lightWeightMap
.
set
(
"
e
"
,
"
E
"
);
let
res
=
lightWeightMap
.
increaseCapacityTo
(
3
);
lightWeightMap
.
increaseCapacityTo
(
3
);
expect
(
res
).
assertEqual
(
undefined
);
let
length
=
lightWeightMap
.
length
;
expect
(
length
).
assertEqual
(
5
);
});
});
it
(
"
SR00GGR3L_testEntries012
"
,
0
,
function
()
{
it
(
"
SR00GGR3L_testEntries012
"
,
0
,
function
()
{
let
lightWeightMap
=
new
LightWeightMap
();
let
lightWeightMap
=
new
LightWeightMap
();
...
@@ -318,14 +320,17 @@ describe("LightWeightMapTest", function () {
...
@@ -318,14 +320,17 @@ describe("LightWeightMapTest", function () {
lightWeightMap
.
set
(
3
,
"
C
"
);
lightWeightMap
.
set
(
3
,
"
C
"
);
lightWeightMap
.
set
(
4
,
"
D
"
);
lightWeightMap
.
set
(
4
,
"
D
"
);
lightWeightMap
.
set
(
5
,
"
E
"
);
lightWeightMap
.
set
(
5
,
"
E
"
);
let
arr
=
[];
let
iters
=
lightWeightMap
[
Symbol
.
iterator
]();
for
(
let
item
of
lightWeightMap
)
{
let
flag
=
true
;
arr
.
push
(
item
);
for
(
let
i
=
0
,
len
=
lightWeightMap
.
length
;
i
<
len
;
i
++
)
{
}
let
entry
=
iters
.
next
().
value
;
let
arr1
=
[
"
1,A
"
,
"
2,B
"
,
"
3,C
"
,
"
4,D
"
,
"
5,E
"
];
let
res
=
lightWeightMap
.
get
(
entry
[
0
]);
for
(
let
i
=
0
;
i
<
arr1
.
length
;
i
++
)
{
if
(
res
!=
entry
[
1
])
{
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
flag
=
false
;
break
;
}
}
}
expect
(
flag
).
assertEqual
(
true
);
});
});
it
(
"
SR00GGR3L_testSet028
"
,
0
,
function
()
{
it
(
"
SR00GGR3L_testSet028
"
,
0
,
function
()
{
let
lightWeightMap
=
new
LightWeightMap
();
let
lightWeightMap
=
new
LightWeightMap
();
...
@@ -387,11 +392,8 @@ describe("LightWeightMapTest", function () {
...
@@ -387,11 +392,8 @@ describe("LightWeightMapTest", function () {
});
});
it
(
"
SR00GGR3L_testRemove034
"
,
0
,
function
()
{
it
(
"
SR00GGR3L_testRemove034
"
,
0
,
function
()
{
let
lightWeightMap
=
new
LightWeightMap
();
let
lightWeightMap
=
new
LightWeightMap
();
try
{
let
res
=
lightWeightMap
.
remove
(
3
);
let
res
=
lightWeightMap
.
remove
(
3
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find the key in lightweight
"
);
}
});
});
it
(
"
SR00GGR3L_testRemoveAt035
"
,
0
,
function
()
{
it
(
"
SR00GGR3L_testRemoveAt035
"
,
0
,
function
()
{
let
lightWeightMap
=
new
LightWeightMap
();
let
lightWeightMap
=
new
LightWeightMap
();
...
@@ -416,9 +418,10 @@ describe("LightWeightMapTest", function () {
...
@@ -416,9 +418,10 @@ describe("LightWeightMapTest", function () {
lightWeightMap
.
set
(
"
d
"
,
"
D
"
);
lightWeightMap
.
set
(
"
d
"
,
"
D
"
);
lightWeightMap
.
set
(
"
e
"
,
"
E
"
);
lightWeightMap
.
set
(
"
e
"
,
"
E
"
);
try
{
try
{
l
et
res
=
l
ightWeightMap
.
increaseCapacityTo
(
"
qwe
"
);
lightWeightMap
.
increaseCapacityTo
(
"
qwe
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
lightWeightMap: index must be int
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the size is not integer
"
);
}
}
});
});
it
(
"
SR00GGR3L_testRemoveAt038
"
,
0
,
function
()
{
it
(
"
SR00GGR3L_testRemoveAt038
"
,
0
,
function
()
{
...
@@ -426,7 +429,8 @@ describe("LightWeightMapTest", function () {
...
@@ -426,7 +429,8 @@ describe("LightWeightMapTest", function () {
try
{
try
{
let
res
=
lightWeightMap
.
removeAt
(
"
123
"
);
let
res
=
lightWeightMap
.
removeAt
(
"
123
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
lightWeightMap: index must be int
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the size is not integer
"
);
}
}
});
});
it
(
"
SR00GGR3L_testGetValueAt039
"
,
0
,
function
()
{
it
(
"
SR00GGR3L_testGetValueAt039
"
,
0
,
function
()
{
...
@@ -439,7 +443,8 @@ describe("LightWeightMapTest", function () {
...
@@ -439,7 +443,8 @@ describe("LightWeightMapTest", function () {
try
{
try
{
let
res
=
lightWeightMap
.
getValueAt
(
"
123
"
);
let
res
=
lightWeightMap
.
getValueAt
(
"
123
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
lightWeightMap: index must be int
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is not integer
"
);
}
}
});
});
it
(
"
SR00GGR3L_testGetKeyAt040
"
,
0
,
function
()
{
it
(
"
SR00GGR3L_testGetKeyAt040
"
,
0
,
function
()
{
...
@@ -452,7 +457,8 @@ describe("LightWeightMapTest", function () {
...
@@ -452,7 +457,8 @@ describe("LightWeightMapTest", function () {
try
{
try
{
let
res
=
lightWeightMap
.
getKeyAt
(
"
123
"
);
let
res
=
lightWeightMap
.
getKeyAt
(
"
123
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
lightWeightMap: index must be int
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is not integer
"
);
}
}
});
});
it
(
"
SR00GGR3L_testHasAll041
"
,
0
,
function
()
{
it
(
"
SR00GGR3L_testHasAll041
"
,
0
,
function
()
{
...
@@ -552,7 +558,7 @@ describe("LightWeightMapTest", function () {
...
@@ -552,7 +558,7 @@ describe("LightWeightMapTest", function () {
lightWeightMap
.
set
(
4
,
"
D
"
);
lightWeightMap
.
set
(
4
,
"
D
"
);
lightWeightMap
.
set
(
5
,
"
E
"
);
lightWeightMap
.
set
(
5
,
"
E
"
);
let
res
=
lightWeightMap
.
get
(
10
);
let
res
=
lightWeightMap
.
get
(
10
);
expect
(
res
).
assertEqual
(
null
);
expect
(
res
).
assertEqual
(
undefined
);
});
});
it
(
"
SR00GGR3L_testHasAll050
"
,
0
,
function
()
{
it
(
"
SR00GGR3L_testHasAll050
"
,
0
,
function
()
{
let
lightWeightMap
=
new
LightWeightMap
();
let
lightWeightMap
=
new
LightWeightMap
();
...
@@ -567,23 +573,4 @@ describe("LightWeightMapTest", function () {
...
@@ -567,23 +573,4 @@ describe("LightWeightMapTest", function () {
let
res
=
lightWeightMap
.
hasAll
(
lightWeightMap1
);
let
res
=
lightWeightMap
.
hasAll
(
lightWeightMap1
);
expect
(
res
).
assertEqual
(
false
);
expect
(
res
).
assertEqual
(
false
);
});
});
it
(
"
SR00GGR3L_testIterator051
"
,
0
,
function
()
{
let
lightWeightMap
=
new
LightWeightMap
();
lightWeightMap
.
set
(
1
,
"
A
"
);
lightWeightMap
.
set
(
2
,
"
B
"
);
lightWeightMap
.
set
(
3
,
"
C
"
);
lightWeightMap
.
set
(
4
,
"
D
"
);
lightWeightMap
.
set
(
5
,
"
E
"
);
let
arr
=
[];
let
res
=
lightWeightMap
[
Symbol
.
iterator
]();
let
temp
=
undefined
;
do
{
temp
=
res
.
next
().
value
;
arr
.
push
(
temp
);
}
while
(
temp
!=
undefined
);
let
arr1
=
[
"
1,A
"
,
"
2,B
"
,
"
3,C
"
,
"
4,D
"
,
"
5,E
"
];
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
});
});
});
compileruntime/containerRelation_lib_standard/src/main/js/test/LightWeightSet.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -21,7 +21,8 @@ describe("LightWeightSetTest", function () {
...
@@ -21,7 +21,8 @@ describe("LightWeightSetTest", function () {
let
lightWeightSet
=
new
LightWeightSet
();
let
lightWeightSet
=
new
LightWeightSet
();
expect
(
lightWeightSet
!=
undefined
).
assertEqual
(
true
);
expect
(
lightWeightSet
!=
undefined
).
assertEqual
(
true
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error:Cannot create new TreeMap
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new TreeMap
"
);
}
}
});
});
it
(
"
SR000GGR43_testAdd002
"
,
0
,
function
()
{
it
(
"
SR000GGR43_testAdd002
"
,
0
,
function
()
{
...
@@ -324,11 +325,8 @@ describe("LightWeightSetTest", function () {
...
@@ -324,11 +325,8 @@ describe("LightWeightSetTest", function () {
});
});
it
(
"
SR000GGR43_testRemove028
"
,
0
,
function
()
{
it
(
"
SR000GGR43_testRemove028
"
,
0
,
function
()
{
let
lightWeightSet
=
new
LightWeightSet
();
let
lightWeightSet
=
new
LightWeightSet
();
try
{
let
res
=
lightWeightSet
.
remove
(
3
);
let
res
=
lightWeightSet
.
remove
(
3
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find the key in lightweight
"
);
}
});
});
it
(
"
SR000GGR43_testRemoveAt029
"
,
0
,
function
()
{
it
(
"
SR000GGR43_testRemoveAt029
"
,
0
,
function
()
{
let
lightWeightSet
=
new
LightWeightSet
();
let
lightWeightSet
=
new
LightWeightSet
();
...
@@ -343,9 +341,10 @@ describe("LightWeightSetTest", function () {
...
@@ -343,9 +341,10 @@ describe("LightWeightSetTest", function () {
lightWeightSet
.
add
(
4
);
lightWeightSet
.
add
(
4
);
lightWeightSet
.
add
(
5
);
lightWeightSet
.
add
(
5
);
try
{
try
{
l
et
res
=
l
ightWeightSet
.
increaseCapacityTo
(
3
);
lightWeightSet
.
increaseCapacityTo
(
3
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Unable to shrink capacity
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is not integer
"
);
}
}
});
});
it
(
"
SR000GGR43_testIncreaseCapacityTo031
"
,
0
,
function
()
{
it
(
"
SR000GGR43_testIncreaseCapacityTo031
"
,
0
,
function
()
{
...
@@ -358,7 +357,8 @@ describe("LightWeightSetTest", function () {
...
@@ -358,7 +357,8 @@ describe("LightWeightSetTest", function () {
try
{
try
{
let
res
=
lightWeightSet
.
increaseCapacityTo
(
"
qwe
"
);
let
res
=
lightWeightSet
.
increaseCapacityTo
(
"
qwe
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
lightWeightSet: index must be int
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is not integer
"
);
}
}
});
});
it
(
"
SR000GGR43_testRemoveAt032
"
,
0
,
function
()
{
it
(
"
SR000GGR43_testRemoveAt032
"
,
0
,
function
()
{
...
@@ -366,7 +366,8 @@ describe("LightWeightSetTest", function () {
...
@@ -366,7 +366,8 @@ describe("LightWeightSetTest", function () {
try
{
try
{
let
res
=
lightWeightSet
.
removeAt
(
"
123
"
);
let
res
=
lightWeightSet
.
removeAt
(
"
123
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
lightWeightSet: index must be int
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is not integer
"
);
}
}
});
});
it
(
"
SR000GGR43_testIncreaseCapacityTo033
"
,
0
,
function
()
{
it
(
"
SR000GGR43_testIncreaseCapacityTo033
"
,
0
,
function
()
{
...
@@ -389,7 +390,8 @@ describe("LightWeightSetTest", function () {
...
@@ -389,7 +390,8 @@ describe("LightWeightSetTest", function () {
try
{
try
{
let
res
=
lightWeightSet
.
getValueAt
(
"
123
"
);
let
res
=
lightWeightSet
.
getValueAt
(
"
123
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
lightWeightSet: index must be int
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is not integer
"
);
}
}
});
});
it
(
"
SR000GGR43_testIsEmpty035
"
,
0
,
function
()
{
it
(
"
SR000GGR43_testIsEmpty035
"
,
0
,
function
()
{
...
@@ -448,7 +450,8 @@ describe("LightWeightSetTest", function () {
...
@@ -448,7 +450,8 @@ describe("LightWeightSetTest", function () {
try
{
try
{
let
res
=
lightWeightSet
.
remove
(
"
A
"
);
let
res
=
lightWeightSet
.
remove
(
"
A
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find the key in lightweight
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is not integer
"
);
}
}
});
});
it
(
"
SR000GGR43_testIterator41
"
,
0
,
function
()
{
it
(
"
SR000GGR43_testIterator41
"
,
0
,
function
()
{
...
@@ -470,4 +473,22 @@ describe("LightWeightSetTest", function () {
...
@@ -470,4 +473,22 @@ describe("LightWeightSetTest", function () {
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
}
});
});
it
(
"
SR000GGR43_testEqual42
"
,
0
,
function
()
{
let
lightWeightSet
=
new
LightWeightSet
();
lightWeightSet
.
add
(
1
);
lightWeightSet
.
add
(
2
);
lightWeightSet
.
add
(
3
);
let
obj
=
[
1
,
2
,
3
];
let
res
=
lightWeightSet
.
equal
(
obj
);
expect
(
res
).
assertEqual
(
true
);
});
it
(
"
SR000GGR43_testEqual43
"
,
0
,
function
()
{
let
lightWeightSet
=
new
LightWeightSet
();
lightWeightSet
.
add
(
1
);
lightWeightSet
.
add
(
2
);
lightWeightSet
.
add
(
3
);
let
obj
=
[
1
,
2
];
let
res
=
lightWeightSet
.
equal
(
obj
);
expect
(
res
).
assertEqual
(
false
);
});
});
});
compileruntime/containerRelation_lib_standard/src/main/js/test/Main.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
...
compileruntime/containerRelation_lib_standard/src/main/js/test/PlainArray.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -20,7 +20,8 @@ describe("PlainArrayTest", function () {
...
@@ -20,7 +20,8 @@ describe("PlainArrayTest", function () {
try
{
try
{
let
plainArray
=
new
PlainArray
();
let
plainArray
=
new
PlainArray
();
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error:Cannot create new PlainArray
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new PlainArray
"
);
}
}
});
});
it
(
"
SR000GGR45_testAdd002
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testAdd002
"
,
0
,
function
()
{
...
@@ -65,11 +66,8 @@ describe("PlainArrayTest", function () {
...
@@ -65,11 +66,8 @@ describe("PlainArrayTest", function () {
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
add
(
5
,
"
E
"
);
let
res
=
plainArray
.
get
(
4
);
let
res
=
plainArray
.
get
(
4
);
expect
(
res
).
assertEqual
(
"
D
"
);
expect
(
res
).
assertEqual
(
"
D
"
);
try
{
res
=
plainArray
.
get
(
10
);
res
=
plainArray
.
get
(
10
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Key error found
"
);
}
});
});
it
(
"
SR000GGR45_testLength008
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testLength008
"
,
0
,
function
()
{
let
plainArray
=
new
PlainArray
();
let
plainArray
=
new
PlainArray
();
...
@@ -188,19 +186,10 @@ describe("PlainArrayTest", function () {
...
@@ -188,19 +186,10 @@ describe("PlainArrayTest", function () {
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
add
(
5
,
"
E
"
);
let
res
=
plainArray
.
remove
(
2
);
let
res
=
plainArray
.
remove
(
2
);
expect
(
res
).
assertEqual
(
"
B
"
);
expect
(
res
).
assertEqual
(
"
B
"
);
try
{
let
value
=
plainArray
.
get
(
2
);
res
=
plainArray
.
remove
(
12
);
expect
(
value
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
res
=
plainArray
.
remove
(
12
);
expect
(
err
).
assertEqual
(
"
Error: element not in this plainarray
"
);
expect
(
res
).
assertEqual
(
undefined
);
}
let
arr
=
[];
for
(
let
item
of
plainArray
)
{
arr
.
push
(
item
);
}
let
arr1
=
[
"
1,A
"
,
"
3,C
"
,
"
4,D
"
,
"
5,E
"
];
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
});
});
it
(
"
SR000GGR45_testReMoveAt017
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testReMoveAt017
"
,
0
,
function
()
{
let
plainArray
=
new
PlainArray
();
let
plainArray
=
new
PlainArray
();
...
@@ -211,19 +200,10 @@ describe("PlainArrayTest", function () {
...
@@ -211,19 +200,10 @@ describe("PlainArrayTest", function () {
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
add
(
5
,
"
E
"
);
let
res
=
plainArray
.
removeAt
(
2
);
let
res
=
plainArray
.
removeAt
(
2
);
expect
(
res
).
assertEqual
(
"
C
"
);
expect
(
res
).
assertEqual
(
"
C
"
);
try
{
let
value
=
plainArray
.
get
(
3
);
res
=
plainArray
.
removeAt
(
12
);
expect
(
value
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
res
=
plainArray
.
removeAt
(
12
);
expect
(
err
).
assertEqual
(
"
Error: index not in this plainarray range
"
);
expect
(
res
).
assertEqual
(
undefined
);
}
let
arr
=
[];
for
(
let
item
of
plainArray
)
{
arr
.
push
(
item
);
}
let
arr1
=
[
"
1,A
"
,
"
2,B
"
,
"
4,D
"
,
"
5,E
"
];
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
});
});
it
(
"
SR000GGR45_testReMoveRangeFrom018
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testReMoveRangeFrom018
"
,
0
,
function
()
{
let
plainArray
=
new
PlainArray
();
let
plainArray
=
new
PlainArray
();
...
@@ -233,23 +213,22 @@ describe("PlainArrayTest", function () {
...
@@ -233,23 +213,22 @@ describe("PlainArrayTest", function () {
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
removeRangeFrom
(
2
,
2
);
plainArray
.
removeRangeFrom
(
2
,
2
);
let
arr
=
[];
let
keys
=
[
1
,
2
,
5
];
for
(
let
item
of
plainArray
)
{
let
values
=
[
"
A
"
,
"
B
"
,
"
E
"
];
arr
.
push
(
item
);
for
(
let
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
}
expect
(
values
[
i
]).
assertEqual
(
plainArray
.
get
(
keys
[
i
]));
let
arr1
=
[
"
1,A
"
,
"
2,B
"
,
"
5,E
"
];
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
}
try
{
try
{
plainArray
.
removeRangeFrom
(
15
,
5
);
plainArray
.
removeRangeFrom
(
15
,
5
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: index not in this plainarray range
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
try
{
try
{
plainArray
.
removeRangeFrom
(
1
,
-
1
);
plainArray
.
removeRangeFrom
(
1
,
-
1
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
index not in this plainarray range
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the size cannot be less than 0
"
);
}
}
});
});
it
(
"
SR000GGR45_testSetValueAt019
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testSetValueAt019
"
,
0
,
function
()
{
...
@@ -260,18 +239,16 @@ describe("PlainArrayTest", function () {
...
@@ -260,18 +239,16 @@ describe("PlainArrayTest", function () {
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
setValueAt
(
2
,
"
V
"
);
plainArray
.
setValueAt
(
2
,
"
V
"
);
let
arr
=
[];
let
keys
=
[
1
,
2
,
3
,
4
,
5
];
for
(
let
item
of
plainArray
)
{
let
values
=
[
"
A
"
,
"
B
"
,
"
V
"
,
"
D
"
,
"
E
"
];
arr
.
push
(
item
);
for
(
let
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
}
expect
(
values
[
i
]).
assertEqual
(
plainArray
.
get
(
keys
[
i
]));
let
arr1
=
[
"
1,A
"
,
"
2,B
"
,
"
3,V
"
,
"
4,D
"
,
"
5,E
"
];
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
}
try
{
try
{
plainArray
.
setValueAt
(
-
1
,
"
X
"
);
plainArray
.
setValueAt
(
-
1
,
"
X
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: index Out Of Bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR45_testToString020
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testToString020
"
,
0
,
function
()
{
...
@@ -292,10 +269,6 @@ describe("PlainArrayTest", function () {
...
@@ -292,10 +269,6 @@ describe("PlainArrayTest", function () {
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
add
(
5
,
"
E
"
);
let
arr
=
[];
let
arr
=
[];
let
keyArr
=
[];
plainArray
.
forEach
((
key
,
index
)
=>
{
keyArr
.
push
(
key
);
});
plainArray
.
forEach
((
value
,
index
)
=>
{
plainArray
.
forEach
((
value
,
index
)
=>
{
arr
.
push
(
value
);
arr
.
push
(
value
);
});
});
...
@@ -303,10 +276,6 @@ describe("PlainArrayTest", function () {
...
@@ -303,10 +276,6 @@ describe("PlainArrayTest", function () {
for
(
let
i
=
0
;
i
<
arr1
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
arr1
.
length
;
i
++
)
{
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
}
let
keyArr1
=
[
1
,
2
,
3
,
4
,
5
];
for
(
let
i
=
0
;
i
<
keyArr1
.
length
;
i
++
)
{
expect
(
keyArr
[
i
]).
assertEqual
(
keyArr
[
i
]);
}
});
});
it
(
"
SR000GGR45_testIterator022
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testIterator022
"
,
0
,
function
()
{
let
plainArray
=
new
PlainArray
();
let
plainArray
=
new
PlainArray
();
...
@@ -315,13 +284,10 @@ describe("PlainArrayTest", function () {
...
@@ -315,13 +284,10 @@ describe("PlainArrayTest", function () {
plainArray
.
add
(
3
,
"
C
"
);
plainArray
.
add
(
3
,
"
C
"
);
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
add
(
5
,
"
E
"
);
let
arr
=
[];
let
keys
=
[
1
,
2
,
3
,
4
,
5
];
for
(
let
item
of
plainArray
)
{
let
values
=
[
"
A
"
,
"
B
"
,
"
C
"
,
"
D
"
,
"
E
"
];
arr
.
push
(
item
);
for
(
let
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
}
expect
(
values
[
i
]).
assertEqual
(
plainArray
.
get
(
keys
[
i
]));
let
arr1
=
[
"
1,A
"
,
"
2,B
"
,
"
3,C
"
,
"
4,D
"
,
"
5,E
"
];
for
(
let
i
=
0
;
i
<
arr1
.
length
;
i
++
)
{
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
}
});
});
it
(
"
SR000GGR45_testGetValueAt023
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testGetValueAt023
"
,
0
,
function
()
{
...
@@ -353,7 +319,8 @@ describe("PlainArrayTest", function () {
...
@@ -353,7 +319,8 @@ describe("PlainArrayTest", function () {
try
{
try
{
let
res
=
plainArray
.
add
(
"
123
"
,
null
);
let
res
=
plainArray
.
add
(
"
123
"
,
null
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: PlainArray's only number is allowed
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is not integer
"
);
}
}
});
});
it
(
"
SR000GGR45_testGet026
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testGet026
"
,
0
,
function
()
{
...
@@ -363,11 +330,8 @@ describe("PlainArrayTest", function () {
...
@@ -363,11 +330,8 @@ describe("PlainArrayTest", function () {
plainArray
.
add
(
3
,
"
C
"
);
plainArray
.
add
(
3
,
"
C
"
);
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
add
(
5
,
"
E
"
);
try
{
let
res
=
plainArray
.
get
(
8
);
let
res
=
plainArray
.
get
(
8
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Key error found
"
);
}
});
});
it
(
"
SR000GGR45_testGetIndexOfKey027
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testGetIndexOfKey027
"
,
0
,
function
()
{
let
plainArray
=
new
PlainArray
();
let
plainArray
=
new
PlainArray
();
...
@@ -397,7 +361,7 @@ describe("PlainArrayTest", function () {
...
@@ -397,7 +361,7 @@ describe("PlainArrayTest", function () {
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
add
(
5
,
"
E
"
);
let
res
=
plainArray
.
getKeyAt
(
50
);
let
res
=
plainArray
.
getKeyAt
(
50
);
expect
(
res
).
assertEqual
(
null
);
expect
(
res
).
assertEqual
(
undefined
);
});
});
it
(
"
SR000GGR45_testGetValueAt030
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testGetValueAt030
"
,
0
,
function
()
{
let
plainArray
=
new
PlainArray
();
let
plainArray
=
new
PlainArray
();
...
@@ -407,22 +371,20 @@ describe("PlainArrayTest", function () {
...
@@ -407,22 +371,20 @@ describe("PlainArrayTest", function () {
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
add
(
5
,
"
E
"
);
let
res
=
plainArray
.
getValueAt
(
50
);
let
res
=
plainArray
.
getValueAt
(
50
);
expect
(
res
).
assertEqual
(
null
);
expect
(
res
).
assertEqual
(
undefined
);
});
});
it
(
"
SR000GGR45_testRemove031
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testRemove031
"
,
0
,
function
()
{
let
plainArray
=
new
PlainArray
();
let
plainArray
=
new
PlainArray
();
try
{
let
res
=
plainArray
.
remove
(
2
);
let
res
=
plainArray
.
remove
(
2
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: element not in this plainarray
"
);
}
});
});
it
(
"
SR000GGR45_testRemoveAt032
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testRemoveAt032
"
,
0
,
function
()
{
let
plainArray
=
new
PlainArray
();
let
plainArray
=
new
PlainArray
();
try
{
try
{
let
res
=
plainArray
.
removeAt
(
2
);
let
res
=
plainArray
.
removeAt
(
2
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: index not in this plainarray range
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR45_testReMoveRangeFrom033
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testReMoveRangeFrom033
"
,
0
,
function
()
{
...
@@ -446,7 +408,8 @@ describe("PlainArrayTest", function () {
...
@@ -446,7 +408,8 @@ describe("PlainArrayTest", function () {
try
{
try
{
plainArray
.
setValueAt
(
8
,
"
V
"
);
plainArray
.
setValueAt
(
8
,
"
V
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: index Out Of Bounds
"
);
expect
(
err
.
name
).
assertEqual
(
"
RangeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is out-of-bounds
"
);
}
}
});
});
it
(
"
SR000GGR45_testAdd035
"
,
0
,
function
()
{
it
(
"
SR000GGR45_testAdd035
"
,
0
,
function
()
{
...
@@ -501,7 +464,8 @@ describe("PlainArrayTest", function () {
...
@@ -501,7 +464,8 @@ describe("PlainArrayTest", function () {
try
{
try
{
plainArray
.
add
(
"
a
"
,
"
c
"
);
plainArray
.
add
(
"
a
"
,
"
c
"
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: PlainArray's only number is allowed
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
the index is not integer
"
);
}
}
let
res
=
plainArray
.
get
(
-
2
);
let
res
=
plainArray
.
get
(
-
2
);
expect
(
res
).
assertEqual
(
"
b
"
);
expect
(
res
).
assertEqual
(
"
b
"
);
...
@@ -525,16 +489,16 @@ describe("PlainArrayTest", function () {
...
@@ -525,16 +489,16 @@ describe("PlainArrayTest", function () {
plainArray
.
add
(
3
,
"
C
"
);
plainArray
.
add
(
3
,
"
C
"
);
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
4
,
"
D
"
);
plainArray
.
add
(
5
,
"
E
"
);
plainArray
.
add
(
5
,
"
E
"
);
let
arr
=
[];
let
iters
=
plainArray
[
Symbol
.
iterator
]();
let
res
=
plainArray
[
Symbol
.
iterator
]();
let
flag
=
true
;
let
temp
=
undefined
;
for
(
let
i
=
0
,
len
=
plainArray
.
length
;
i
<
len
;
i
++
)
{
do
{
let
entry
=
iters
.
next
().
value
;
temp
=
res
.
next
().
value
;
let
res
=
plainArray
.
get
(
entry
[
0
]);
arr
.
push
(
temp
);
if
(
res
!=
entry
[
1
])
{
}
while
(
temp
!=
undefined
);
flag
=
false
;
let
arr1
=
[
"
1,A
"
,
"
2,B
"
,
"
3,C
"
,
"
4,D
"
,
"
5,E
"
];
break
;
for
(
let
i
=
0
;
i
<
arr1
.
length
;
i
++
)
{
}
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
}
expect
(
flag
).
assertEqual
(
true
);
});
});
});
});
compileruntime/containerRelation_lib_standard/src/main/js/test/TreeMap.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -21,66 +21,67 @@ describe("TreeMapTest", function () {
...
@@ -21,66 +21,67 @@ describe("TreeMapTest", function () {
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
expect
(
treeMap
!=
undefined
).
assertEqual
(
true
);
expect
(
treeMap
!=
undefined
).
assertEqual
(
true
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Cannot create new TreeMap
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new TreeMap
"
);
}
}
});
});
it
(
"
SR000GGR3H_testSet002
_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testSet002
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
四
"
);
treeMap
.
set
(
0
,
"
四
"
);
let
res
=
treeMap
.
get
(
0
);
let
res
=
treeMap
.
get
(
0
);
expect
(
res
).
assertEqual
(
"
四
"
);
expect
(
res
).
assertEqual
(
"
四
"
);
});
});
it
(
"
SR000GGR3H_testSet00
2_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testSet00
3
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
8
);
treeMap
.
set
(
0
,
8
);
let
res
=
treeMap
.
get
(
0
);
let
res
=
treeMap
.
get
(
0
);
expect
(
res
).
assertEqual
(
8
);
expect
(
res
).
assertEqual
(
8
);
});
});
it
(
"
SR000GGR3H_testSet00
2_3
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testSet00
4
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
let
a
=
[
1
,
2
,
3
,
4
];
let
a
=
[
1
,
2
,
3
,
4
];
treeMap
.
set
(
0
,
a
);
treeMap
.
set
(
0
,
a
);
let
res
=
treeMap
.
get
(
0
);
let
res
=
treeMap
.
get
(
0
);
expect
(
res
).
assertEqual
(
a
);
expect
(
res
).
assertEqual
(
a
);
});
});
it
(
"
SR000GGR3H_testSet00
2_4
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testSet00
5
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
let
a
=
{
name
:
"
lala
"
,
age
:
"
13
"
};
let
a
=
{
name
:
"
lala
"
,
age
:
"
13
"
};
treeMap
.
set
(
0
,
a
);
treeMap
.
set
(
0
,
a
);
let
res
=
treeMap
.
get
(
0
);
let
res
=
treeMap
.
get
(
0
);
expect
(
res
).
assertEqual
(
a
);
expect
(
res
).
assertEqual
(
a
);
});
});
it
(
"
SR000GGR3H_testSet00
2_5
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testSet00
6
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
2
,
"
*
"
);
treeMap
.
set
(
2
,
"
*
"
);
let
res
=
treeMap
.
get
(
2
);
let
res
=
treeMap
.
get
(
2
);
expect
(
res
).
assertEqual
(
"
*
"
);
expect
(
res
).
assertEqual
(
"
*
"
);
});
});
it
(
"
SR000GGR3H_testSet00
2_6
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testSet00
7
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
-
2
,
3.14
);
treeMap
.
set
(
-
2
,
3.14
);
let
res
=
treeMap
.
get
(
-
2
);
let
res
=
treeMap
.
get
(
-
2
);
expect
(
res
).
assertEqual
(
3.14
);
expect
(
res
).
assertEqual
(
3.14
);
});
});
it
(
"
SR000GGR3H_testSet00
2_7
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testSet00
8
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
100
,
true
);
treeMap
.
set
(
100
,
true
);
let
res
=
treeMap
.
get
(
100
);
let
res
=
treeMap
.
get
(
100
);
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3H_testSet00
2_8
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testSet00
9
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
100
,
""
);
treeMap
.
set
(
100
,
""
);
let
res
=
treeMap
.
get
(
100
);
let
res
=
treeMap
.
get
(
100
);
expect
(
res
).
assertEqual
(
""
);
expect
(
res
).
assertEqual
(
""
);
});
});
it
(
"
SR000GGR3H_testSet0
02_9
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testSet0
10
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
"
a
"
,
"
四
"
);
treeMap
.
set
(
"
a
"
,
"
四
"
);
let
res
=
treeMap
.
get
(
"
a
"
);
let
res
=
treeMap
.
get
(
"
a
"
);
expect
(
res
).
assertEqual
(
"
四
"
);
expect
(
res
).
assertEqual
(
"
四
"
);
});
});
it
(
"
SR000GGR3H_testSet0
02_10
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testSet0
11
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
for
(
let
i
=
0
;
i
<
10000
;
i
++
)
{
for
(
let
i
=
0
;
i
<
10000
;
i
++
)
{
treeMap
.
set
(
0
,
8
);
treeMap
.
set
(
0
,
8
);
...
@@ -89,7 +90,7 @@ describe("TreeMapTest", function () {
...
@@ -89,7 +90,7 @@ describe("TreeMapTest", function () {
expect
(
res
).
assertEqual
(
8
);
expect
(
res
).
assertEqual
(
8
);
expect
(
treeMap
.
length
).
assertEqual
(
1
);
expect
(
treeMap
.
length
).
assertEqual
(
1
);
});
});
it
(
"
SR000GGR3H_testHasKey0
03
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testHasKey0
12
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -98,7 +99,7 @@ describe("TreeMapTest", function () {
...
@@ -98,7 +99,7 @@ describe("TreeMapTest", function () {
let
res1
=
treeMap
.
hasKey
(
6
);
let
res1
=
treeMap
.
hasKey
(
6
);
expect
(
res1
).
assertEqual
(
false
);
expect
(
res1
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR3H_testHasValue0
04
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testHasValue0
13
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -108,7 +109,7 @@ describe("TreeMapTest", function () {
...
@@ -108,7 +109,7 @@ describe("TreeMapTest", function () {
let
res1
=
treeMap
.
hasValue
(
"
d
"
);
let
res1
=
treeMap
.
hasValue
(
"
d
"
);
expect
(
res1
).
assertEqual
(
false
);
expect
(
res1
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR3H_testGet0
05_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testGet0
14
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -116,28 +117,20 @@ describe("TreeMapTest", function () {
...
@@ -116,28 +117,20 @@ describe("TreeMapTest", function () {
let
res
=
treeMap
.
get
(
1
);
let
res
=
treeMap
.
get
(
1
);
expect
(
res
).
assertEqual
(
"
b
"
);
expect
(
res
).
assertEqual
(
"
b
"
);
});
});
it
(
"
SR000GGR3H_testGet0
05_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testGet0
15
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
try
{
let
res
=
treeMap
.
get
(
1
);
let
res
=
treeMap
.
get
(
1
);
expect
(
res
).
assertEqual
(
undefined
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: The node of this key does not exist in the tree
"
);
}
});
});
it
(
"
SR000GGR3H_testGet0
05_3
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testGet0
16
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
clear
();
treeMap
.
clear
();
expect
(
treeMap
.
length
).
assertEqual
(
0
);
expect
(
treeMap
.
length
).
assertEqual
(
0
);
try
{
let
res
=
treeMap
.
get
(
0
);
let
res
=
treeMap
.
get
(
0
);
expect
(
res
).
assertEqual
(
undefined
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: The node of this key does not exist in the tree
"
);
}
});
});
it
(
"
SR000GGR3H_testGetFirstKey0
06_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testGetFirstKey0
17
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -145,15 +138,12 @@ describe("TreeMapTest", function () {
...
@@ -145,15 +138,12 @@ describe("TreeMapTest", function () {
let
res
=
treeMap
.
getFirstKey
();
let
res
=
treeMap
.
getFirstKey
();
expect
(
res
).
assertEqual
(
0
);
expect
(
res
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR3H_testGetFirstKey0
06_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testGetFirstKey0
18
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
try
{
let
res
=
treeMap
.
getFirstKey
();
let
res
=
treeMap
.
getFirstKey
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find this key,this tree is empty
"
);
}
});
});
it
(
"
SR000GGR3H_testGetLastKey0
07_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testGetLastKey0
19
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -161,15 +151,12 @@ describe("TreeMapTest", function () {
...
@@ -161,15 +151,12 @@ describe("TreeMapTest", function () {
let
res
=
treeMap
.
getLastKey
();
let
res
=
treeMap
.
getLastKey
();
expect
(
res
).
assertEqual
(
2
);
expect
(
res
).
assertEqual
(
2
);
});
});
it
(
"
SR000GGR3H_testGetLastKey0
07_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testGetLastKey0
20
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
try
{
let
res
=
treeMap
.
getLastKey
();
let
res
=
treeMap
.
getLastKey
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find this key,this tree is empty
"
);
}
});
});
it
(
"
SR000GGR3H_testSetAll0
08
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testSetAll0
21
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -185,7 +172,7 @@ describe("TreeMapTest", function () {
...
@@ -185,7 +172,7 @@ describe("TreeMapTest", function () {
let
res2
=
treeMap
.
get
(
2
);
let
res2
=
treeMap
.
get
(
2
);
expect
(
res2
).
assertEqual
(
"
c
"
);
expect
(
res2
).
assertEqual
(
"
c
"
);
});
});
it
(
"
SR000GGR3H_testRemove0
09_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testRemove0
22
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -193,13 +180,13 @@ describe("TreeMapTest", function () {
...
@@ -193,13 +180,13 @@ describe("TreeMapTest", function () {
let
res
=
treeMap
.
remove
(
1
);
let
res
=
treeMap
.
remove
(
1
);
expect
(
res
).
assertEqual
(
"
b
"
);
expect
(
res
).
assertEqual
(
"
b
"
);
});
});
it
(
"
SR000GGR3H_testRemove0
09_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testRemove0
23
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
let
res
=
treeMap
.
remove
(
1
);
let
res
=
treeMap
.
remove
(
1
);
expect
(
res
).
assertEqual
(
null
);
expect
(
res
).
assertEqual
(
undefined
);
});
});
it
(
"
SR000GGR3H_testClear0
10_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testClear0
24
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -208,7 +195,7 @@ describe("TreeMapTest", function () {
...
@@ -208,7 +195,7 @@ describe("TreeMapTest", function () {
let
res
=
treeMap
.
length
;
let
res
=
treeMap
.
length
;
expect
(
res
).
assertEqual
(
0
);
expect
(
res
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR3H_testClear0
10_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testClear0
25
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -220,7 +207,7 @@ describe("TreeMapTest", function () {
...
@@ -220,7 +207,7 @@ describe("TreeMapTest", function () {
let
va
=
treeMap
.
get
(
3
);
let
va
=
treeMap
.
get
(
3
);
expect
(
va
).
assertEqual
(
"
d
"
);
expect
(
va
).
assertEqual
(
"
d
"
);
});
});
it
(
"
SR000GGR3H_testGetLowerKey0
11_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testGetLowerKey0
26
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -230,15 +217,12 @@ describe("TreeMapTest", function () {
...
@@ -230,15 +217,12 @@ describe("TreeMapTest", function () {
let
res
=
treeMap
.
getLowerKey
(
2
);
let
res
=
treeMap
.
getLowerKey
(
2
);
expect
(
res
).
assertEqual
(
1
);
expect
(
res
).
assertEqual
(
1
);
});
});
it
(
"
SR000GGR3H_testGetLowerKey0
11_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testGetLowerKey0
27
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
try
{
let
res
=
treeMap
.
getLowerKey
(
2
);
let
res
=
treeMap
.
getLowerKey
(
2
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find this key,this node is undefine
"
);
}
});
});
it
(
"
SR000GGR3H_testGetHigherKey0
12_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testGetHigherKey0
28
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -248,15 +232,12 @@ describe("TreeMapTest", function () {
...
@@ -248,15 +232,12 @@ describe("TreeMapTest", function () {
let
res
=
treeMap
.
getHigherKey
(
2
);
let
res
=
treeMap
.
getHigherKey
(
2
);
expect
(
res
).
assertEqual
(
3
);
expect
(
res
).
assertEqual
(
3
);
});
});
it
(
"
SR000GGR3H_testGetHigherKey0
12_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testGetHigherKey0
29
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
try
{
let
res
=
treeMap
.
getHigherKey
(
2
);
let
res
=
treeMap
.
getHigherKey
(
2
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find this key,this node is undefine
"
);
}
});
});
it
(
"
SR000GGR3H_testKeys0
13
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testKeys0
30
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -270,7 +251,7 @@ describe("TreeMapTest", function () {
...
@@ -270,7 +251,7 @@ describe("TreeMapTest", function () {
expect
(
res
.
next
().
value
).
assertEqual
(
3
);
expect
(
res
.
next
().
value
).
assertEqual
(
3
);
expect
(
res
.
next
().
value
).
assertEqual
(
4
);
expect
(
res
.
next
().
value
).
assertEqual
(
4
);
});
});
it
(
"
SR000GGR3H_testValues0
14
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testValues0
31
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -284,7 +265,7 @@ describe("TreeMapTest", function () {
...
@@ -284,7 +265,7 @@ describe("TreeMapTest", function () {
expect
(
res
.
next
().
value
).
assertEqual
(
"
d
"
);
expect
(
res
.
next
().
value
).
assertEqual
(
"
d
"
);
expect
(
res
.
next
().
value
).
assertEqual
(
"
g
"
);
expect
(
res
.
next
().
value
).
assertEqual
(
"
g
"
);
});
});
it
(
"
SR000GGR3H_testReplace0
15_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testReplace0
32
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -295,19 +276,15 @@ describe("TreeMapTest", function () {
...
@@ -295,19 +276,15 @@ describe("TreeMapTest", function () {
let
res1
=
treeMap
.
get
(
2
);
let
res1
=
treeMap
.
get
(
2
);
expect
(
res1
).
assertEqual
(
"
B
"
);
expect
(
res1
).
assertEqual
(
"
B
"
);
});
});
it
(
"
SR000GGR3H_testReplace0
15_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testReplace0
33
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
let
res
=
treeMap
.
replace
(
2
,
"
B
"
);
let
res
=
treeMap
.
replace
(
2
,
"
B
"
);
expect
(
res
).
assertEqual
(
false
);
expect
(
res
).
assertEqual
(
false
);
try
{
let
res1
=
treeMap
.
get
(
2
);
let
res1
=
treeMap
.
get
(
2
);
expect
(
res1
).
assertEqual
(
undefined
);
expect
(
res1
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: The node of this key does not exist in the tree
"
);
}
});
});
it
(
"
SR000GGR3H_testLength0
16_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testLength0
34
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -317,12 +294,12 @@ describe("TreeMapTest", function () {
...
@@ -317,12 +294,12 @@ describe("TreeMapTest", function () {
let
res
=
treeMap
.
length
;
let
res
=
treeMap
.
length
;
expect
(
res
).
assertEqual
(
5
);
expect
(
res
).
assertEqual
(
5
);
});
});
it
(
"
SR000GGR3H_testLength0
16_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testLength0
35
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
let
res
=
treeMap
.
length
;
let
res
=
treeMap
.
length
;
expect
(
res
).
assertEqual
(
0
);
expect
(
res
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR3H_testForEach0
17
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testForEach0
36
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -346,20 +323,26 @@ describe("TreeMapTest", function () {
...
@@ -346,20 +323,26 @@ describe("TreeMapTest", function () {
expect
(
arr3
[
i
]).
assertEqual
(
arr2
[
i
]);
expect
(
arr3
[
i
]).
assertEqual
(
arr2
[
i
]);
}
}
});
});
it
(
"
SR000GGR3H_testEntries0
18
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testEntries0
37
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
2
,
"
c
"
);
treeMap
.
set
(
2
,
"
c
"
);
treeMap
.
set
(
3
,
"
d
"
);
treeMap
.
set
(
3
,
"
d
"
);
treeMap
.
set
(
4
,
"
g
"
);
treeMap
.
set
(
4
,
"
g
"
);
let
res
=
treeMap
.
entries
();
let
entries
=
treeMap
.
entries
();
let
arr
=
[
"
0,a
"
,
"
1,b
"
,
"
2,c
"
,
"
3,d
"
,
"
4,g
"
];
let
flag
=
true
;
for
(
let
i
=
0
;
i
<
treeMap
.
length
;
i
++
)
{
for
(
let
i
=
0
,
len
=
treeMap
.
length
;
i
<
len
;
i
++
)
{
expect
(
arr
[
i
]).
assertEqual
(
res
.
next
().
value
);
let
entry
=
entries
.
next
().
value
;
let
res
=
treeMap
.
get
(
entry
[
0
]);
if
(
res
!=
entry
[
1
])
{
flag
=
false
;
break
;
}
}
}
expect
(
flag
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3H_testIterator0
19
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testIterator0
38
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
...
@@ -375,23 +358,23 @@ describe("TreeMapTest", function () {
...
@@ -375,23 +358,23 @@ describe("TreeMapTest", function () {
expect
(
arr
[
i
]).
assertEqual
(
iterArr
[
i
]);
expect
(
arr
[
i
]).
assertEqual
(
iterArr
[
i
]);
}
}
});
});
it
(
"
SR000GGR3H_testIterator0
20
"
,
0
,
function
()
{
it
(
"
SR000GGR3H_testIterator0
39
"
,
0
,
function
()
{
let
treeMap
=
new
TreeMap
();
let
treeMap
=
new
TreeMap
();
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
0
,
"
a
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
1
,
"
b
"
);
treeMap
.
set
(
2
,
"
c
"
);
treeMap
.
set
(
2
,
"
c
"
);
treeMap
.
set
(
3
,
"
d
"
);
treeMap
.
set
(
3
,
"
d
"
);
treeMap
.
set
(
4
,
"
g
"
);
treeMap
.
set
(
4
,
"
g
"
);
let
arr
=
[];
let
iters
=
treeMap
[
Symbol
.
iterator
]();
let
res
=
treeMap
[
Symbol
.
iterator
]();
let
flag
=
true
;
let
temp
=
undefined
;
for
(
let
i
=
0
,
len
=
treeMap
.
length
;
i
<
len
;
i
++
)
{
do
{
let
entry
=
iters
.
next
().
value
;
temp
=
res
.
next
().
value
;
let
res
=
treeMap
.
get
(
entry
[
0
]);
arr
.
push
(
temp
);
if
(
res
!=
entry
[
1
])
{
}
while
(
temp
!=
undefined
);
flag
=
false
;
let
arr1
=
[
"
0,a
"
,
"
1,b
"
,
"
2,c
"
,
"
3,d
"
,
"
4,g
"
];
break
;
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
}
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
}
expect
(
flag
).
assertEqual
(
true
);
});
});
});
});
compileruntime/containerRelation_lib_standard/src/main/js/test/TreeSet.test.js
浏览文件 @
e04ff3e7
/*
/*
* Copyright (C) 202
1
Huawei Device Co., Ltd.
* Copyright (C) 202
2
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License')
* Licensed under the Apache License, Version 2.0 (the 'License')
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -21,60 +21,61 @@ describe("TreeSetTest", function () {
...
@@ -21,60 +21,61 @@ describe("TreeSetTest", function () {
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
expect
(
treeSet
!=
undefined
).
assertEqual
(
true
);
expect
(
treeSet
!=
undefined
).
assertEqual
(
true
);
}
catch
(
err
)
{
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: Cannot create new TreeSet
"
);
expect
(
err
.
name
).
assertEqual
(
"
TypeError
"
);
expect
(
err
.
message
).
assertEqual
(
"
Cannot create new TreeSet
"
);
}
}
});
});
it
(
"
SR000GGR3I_testAdd002
_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testAdd002
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
"
四
"
);
treeSet
.
add
(
"
四
"
);
let
res
=
treeSet
.
has
(
"
四
"
);
let
res
=
treeSet
.
has
(
"
四
"
);
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3I_testAdd00
2_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testAdd00
3
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
8
);
treeSet
.
add
(
8
);
let
res
=
treeSet
.
has
(
8
);
let
res
=
treeSet
.
has
(
8
);
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3I_testAdd00
2_3
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testAdd00
4
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
let
a
=
[
1
,
2
,
3
,
4
];
let
a
=
[
1
,
2
,
3
,
4
];
treeSet
.
add
(
a
);
treeSet
.
add
(
a
);
let
res
=
treeSet
.
has
(
a
);
let
res
=
treeSet
.
has
(
a
);
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3I_testAdd00
2_4
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testAdd00
5
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
"
*
"
);
treeSet
.
add
(
"
*
"
);
let
res
=
treeSet
.
has
(
"
*
"
);
let
res
=
treeSet
.
has
(
"
*
"
);
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3I_testAdd00
2_5
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testAdd00
6
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
let
a
=
{
name
:
"
lala
"
,
age
:
"
13岁
"
};
let
a
=
{
name
:
"
lala
"
,
age
:
"
13岁
"
};
treeSet
.
add
(
a
);
treeSet
.
add
(
a
);
let
res
=
treeSet
.
has
(
a
);
let
res
=
treeSet
.
has
(
a
);
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3I_testAdd00
2_6
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testAdd00
7
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
1.234
);
treeSet
.
add
(
1.234
);
let
res
=
treeSet
.
has
(
1.234
);
let
res
=
treeSet
.
has
(
1.234
);
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3I_testAdd00
2_7
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testAdd00
8
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
true
);
treeSet
.
add
(
true
);
let
res
=
treeSet
.
has
(
true
);
let
res
=
treeSet
.
has
(
true
);
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3I_testAdd00
2_8
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testAdd00
9
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
""
);
treeSet
.
add
(
""
);
let
res
=
treeSet
.
has
(
""
);
let
res
=
treeSet
.
has
(
""
);
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3I_testAdd0
02_9
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testAdd0
10
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
for
(
let
i
=
0
;
i
<
10000
;
i
++
)
{
for
(
let
i
=
0
;
i
<
10000
;
i
++
)
{
treeSet
.
add
(
i
);
treeSet
.
add
(
i
);
...
@@ -83,7 +84,7 @@ describe("TreeSetTest", function () {
...
@@ -83,7 +84,7 @@ describe("TreeSetTest", function () {
let
res
=
treeSet
.
has
(
8888
);
let
res
=
treeSet
.
has
(
8888
);
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3I_testLength0
03_
1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testLength0
1
1
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
@@ -91,12 +92,12 @@ describe("TreeSetTest", function () {
...
@@ -91,12 +92,12 @@ describe("TreeSetTest", function () {
let
res
=
treeSet
.
length
;
let
res
=
treeSet
.
length
;
expect
(
res
).
assertEqual
(
3
);
expect
(
res
).
assertEqual
(
3
);
});
});
it
(
"
SR000GGR3I_testLength0
03_
2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testLength0
1
2
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
let
res
=
treeSet
.
length
;
let
res
=
treeSet
.
length
;
expect
(
res
).
assertEqual
(
0
);
expect
(
res
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR3I_testHas0
04_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testHas0
13
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
@@ -104,7 +105,7 @@ describe("TreeSetTest", function () {
...
@@ -104,7 +105,7 @@ describe("TreeSetTest", function () {
let
res
=
treeSet
.
has
(
2
);
let
res
=
treeSet
.
has
(
2
);
expect
(
res
).
assertEqual
(
true
);
expect
(
res
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3I_testHas0
04_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testHas0
14
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
@@ -112,7 +113,7 @@ describe("TreeSetTest", function () {
...
@@ -112,7 +113,7 @@ describe("TreeSetTest", function () {
let
res1
=
treeSet
.
has
(
3
);
let
res1
=
treeSet
.
has
(
3
);
expect
(
res1
).
assertEqual
(
false
);
expect
(
res1
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR3I_testGetFirstValue0
05_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testGetFirstValue0
15
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
@@ -122,15 +123,12 @@ describe("TreeSetTest", function () {
...
@@ -122,15 +123,12 @@ describe("TreeSetTest", function () {
let
res
=
treeSet
.
getFirstValue
();
let
res
=
treeSet
.
getFirstValue
();
expect
(
res
).
assertEqual
(
0
);
expect
(
res
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR3I_testGetFirstValue0
05_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testGetFirstValue0
16
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
try
{
let
res
=
treeSet
.
getFirstValue
();
let
res
=
treeSet
.
getFirstValue
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find this key,this tree is empty
"
);
}
});
});
it
(
"
SR000GGR3I_testGetLastValue0
06_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testGetLastValue0
17
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
@@ -138,15 +136,12 @@ describe("TreeSetTest", function () {
...
@@ -138,15 +136,12 @@ describe("TreeSetTest", function () {
let
res
=
treeSet
.
getLastValue
();
let
res
=
treeSet
.
getLastValue
();
expect
(
res
).
assertEqual
(
2
);
expect
(
res
).
assertEqual
(
2
);
});
});
it
(
"
SR000GGR3I_testGetLastValue0
06_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testGetLastValue0
18
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
try
{
let
res
=
treeSet
.
getLastValue
();
let
res
=
treeSet
.
getLastValue
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find this key,this tree is empty
"
);
}
});
});
it
(
"
SR000GGR3I_testGetLowerValue0
07_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testGetLowerValue0
19
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
@@ -156,15 +151,12 @@ describe("TreeSetTest", function () {
...
@@ -156,15 +151,12 @@ describe("TreeSetTest", function () {
let
res
=
treeSet
.
getLowerValue
(
2
);
let
res
=
treeSet
.
getLowerValue
(
2
);
expect
(
res
).
assertEqual
(
1
);
expect
(
res
).
assertEqual
(
1
);
});
});
it
(
"
SR000GGR3I_testGetLowerValue0
07_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testGetLowerValue0
20
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
try
{
let
res
=
treeSet
.
getLowerValue
(
2
);
let
res
=
treeSet
.
getLowerValue
(
2
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find this key,this node is undefine
"
);
}
});
});
it
(
"
SR000GGR3I_testGetHigherValue0
08_
1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testGetHigherValue0
2
1
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
@@ -174,15 +166,12 @@ describe("TreeSetTest", function () {
...
@@ -174,15 +166,12 @@ describe("TreeSetTest", function () {
let
res
=
treeSet
.
getHigherValue
(
3
);
let
res
=
treeSet
.
getHigherValue
(
3
);
expect
(
res
).
assertEqual
(
4
);
expect
(
res
).
assertEqual
(
4
);
});
});
it
(
"
SR000GGR3I_testGetHigherValue0
08_
2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testGetHigherValue0
2
2
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
try
{
let
res
=
treeSet
.
getHigherValue
(
3
);
let
res
=
treeSet
.
getHigherValue
(
3
);
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find this key,this node is undefine
"
);
}
});
});
it
(
"
SR000GGR3I_testPopFirst0
09_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testPopFirst0
23
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
"
a
"
);
treeSet
.
add
(
"
a
"
);
treeSet
.
add
(
"
b
"
);
treeSet
.
add
(
"
b
"
);
...
@@ -192,15 +181,12 @@ describe("TreeSetTest", function () {
...
@@ -192,15 +181,12 @@ describe("TreeSetTest", function () {
let
res
=
treeSet
.
popFirst
();
let
res
=
treeSet
.
popFirst
();
expect
(
res
).
assertEqual
(
"
a
"
);
expect
(
res
).
assertEqual
(
"
a
"
);
});
});
it
(
"
SR000GGR3I_testPopFirst0
09_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testPopFirst0
24
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
try
{
let
res
=
treeSet
.
popFirst
();
let
res
=
treeSet
.
popFirst
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find first node,this tree is empty
"
);
}
});
});
it
(
"
SR000GGR3I_testPopLast0
10_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testPopLast0
25
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
"
a
"
);
treeSet
.
add
(
"
a
"
);
treeSet
.
add
(
"
b
"
);
treeSet
.
add
(
"
b
"
);
...
@@ -210,15 +196,12 @@ describe("TreeSetTest", function () {
...
@@ -210,15 +196,12 @@ describe("TreeSetTest", function () {
let
res
=
treeSet
.
popLast
();
let
res
=
treeSet
.
popLast
();
expect
(
res
).
assertEqual
(
"
e
"
);
expect
(
res
).
assertEqual
(
"
e
"
);
});
});
it
(
"
SR000GGR3I_testPopLast0
10_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testPopLast0
26
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
try
{
let
res
=
treeSet
.
popLast
();
let
res
=
treeSet
.
popLast
();
expect
(
res
).
assertEqual
(
undefined
);
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find last node,this tree is empty
"
);
}
});
});
it
(
"
SR000GGR3I_testClear0
11_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testClear0
27
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
@@ -227,7 +210,7 @@ describe("TreeSetTest", function () {
...
@@ -227,7 +210,7 @@ describe("TreeSetTest", function () {
let
res
=
treeSet
.
length
;
let
res
=
treeSet
.
length
;
expect
(
res
).
assertEqual
(
0
);
expect
(
res
).
assertEqual
(
0
);
});
});
it
(
"
SR000GGR3I_testClear0
11_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testClear0
28
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
@@ -235,25 +218,21 @@ describe("TreeSetTest", function () {
...
@@ -235,25 +218,21 @@ describe("TreeSetTest", function () {
treeSet
.
clear
();
treeSet
.
clear
();
let
res
=
treeSet
.
length
;
let
res
=
treeSet
.
length
;
expect
(
res
).
assertEqual
(
0
);
expect
(
res
).
assertEqual
(
0
);
treeSet
.
add
(
3
);
let
res1
=
treeSet
.
popFirst
();
try
{
expect
(
res1
).
assertEqual
(
undefined
);
treeSet
.
popFirst
();
}
catch
(
err
)
{
expect
(
err
).
assertEqual
(
"
Error: don't find first node,this tree is empty
"
);
}
});
});
it
(
"
SR000GGR3I_testIsEmpty0
12_1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testIsEmpty0
29
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
"
a
"
);
treeSet
.
add
(
"
a
"
);
let
res1
=
treeSet
.
isEmpty
();
let
res1
=
treeSet
.
isEmpty
();
expect
(
res1
).
assertEqual
(
false
);
expect
(
res1
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR3I_testIsEmpty0
12_2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testIsEmpty0
30
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
let
res2
=
treeSet
.
isEmpty
();
let
res2
=
treeSet
.
isEmpty
();
expect
(
res2
).
assertEqual
(
true
);
expect
(
res2
).
assertEqual
(
true
);
});
});
it
(
"
SR000GGR3I_testRemove0
13_
1
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testRemove0
3
1
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
"
a
"
);
treeSet
.
add
(
"
a
"
);
treeSet
.
add
(
"
b
"
);
treeSet
.
add
(
"
b
"
);
...
@@ -266,12 +245,12 @@ describe("TreeSetTest", function () {
...
@@ -266,12 +245,12 @@ describe("TreeSetTest", function () {
let
res2
=
treeSet
.
has
(
"
c
"
);
let
res2
=
treeSet
.
has
(
"
c
"
);
expect
(
res2
).
assertEqual
(
false
);
expect
(
res2
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR3I_testRemove0
13_
2
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testRemove0
3
2
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
let
res
=
treeSet
.
remove
(
"
c
"
);
let
res
=
treeSet
.
remove
(
"
c
"
);
expect
(
res
).
assertEqual
(
false
);
expect
(
res
).
assertEqual
(
false
);
});
});
it
(
"
SR000GGR3I_testValues0
14
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testValues0
33
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
"
a
"
);
treeSet
.
add
(
"
a
"
);
treeSet
.
add
(
"
b
"
);
treeSet
.
add
(
"
b
"
);
...
@@ -285,7 +264,7 @@ describe("TreeSetTest", function () {
...
@@ -285,7 +264,7 @@ describe("TreeSetTest", function () {
expect
(
res
.
next
().
value
).
assertEqual
(
"
d
"
);
expect
(
res
.
next
().
value
).
assertEqual
(
"
d
"
);
expect
(
res
.
next
().
value
).
assertEqual
(
"
g
"
);
expect
(
res
.
next
().
value
).
assertEqual
(
"
g
"
);
});
});
it
(
"
SR000GGR3I_testForEach0
15
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testForEach0
34
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
@@ -301,7 +280,7 @@ describe("TreeSetTest", function () {
...
@@ -301,7 +280,7 @@ describe("TreeSetTest", function () {
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
}
});
});
it
(
"
SR000GGR3I_testEntries0
16
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testEntries0
35
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
"
a
"
);
treeSet
.
add
(
"
a
"
);
treeSet
.
add
(
"
b
"
);
treeSet
.
add
(
"
b
"
);
...
@@ -315,7 +294,7 @@ describe("TreeSetTest", function () {
...
@@ -315,7 +294,7 @@ describe("TreeSetTest", function () {
expect
(
JSON
.
stringify
(
res
.
next
().
value
)).
assertEqual
(
'
["d","d"]
'
);
expect
(
JSON
.
stringify
(
res
.
next
().
value
)).
assertEqual
(
'
["d","d"]
'
);
expect
(
JSON
.
stringify
(
res
.
next
().
value
)).
assertEqual
(
'
["g","g"]
'
);
expect
(
JSON
.
stringify
(
res
.
next
().
value
)).
assertEqual
(
'
["g","g"]
'
);
});
});
it
(
"
SR000GGR3I_testIterator0
17
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testIterator0
36
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
@@ -331,7 +310,7 @@ describe("TreeSetTest", function () {
...
@@ -331,7 +310,7 @@ describe("TreeSetTest", function () {
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
expect
(
arr
[
i
]).
assertEqual
(
arr1
[
i
]);
}
}
});
});
it
(
"
SR000GGR3I_testIterator0
18
"
,
0
,
function
()
{
it
(
"
SR000GGR3I_testIterator0
37
"
,
0
,
function
()
{
let
treeSet
=
new
TreeSet
();
let
treeSet
=
new
TreeSet
();
treeSet
.
add
(
0
);
treeSet
.
add
(
0
);
treeSet
.
add
(
1
);
treeSet
.
add
(
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录