From 53f5df6da41c3fe329b9d8342af47b850f50bc28 Mon Sep 17 00:00:00 2001 From: wangyong Date: Wed, 8 Jun 2022 14:36:13 +0800 Subject: [PATCH] Modify the bug that the key in plainarray is not integer Description: Modify the bug that the key in plainarray is not integer #I5BAT8:Modify the bug that the key in plainarray is not integer Signed-off-by: wangyong --- .../src/main/js/test/ArrayList.test.js | 20 +++++++++++++++++-- .../src/main/js/test/Vector.test.js | 2 +- .../src/main/js/test/PlainArray.test.js | 13 +++++++++++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/compileruntime/containerLine_lib_standard/src/main/js/test/ArrayList.test.js b/compileruntime/containerLine_lib_standard/src/main/js/test/ArrayList.test.js index 52076df77..12e5df40e 100644 --- a/compileruntime/containerLine_lib_standard/src/main/js/test/ArrayList.test.js +++ b/compileruntime/containerLine_lib_standard/src/main/js/test/ArrayList.test.js @@ -533,8 +533,8 @@ describe("ArraylistTest", function () { arrayList.removeByRange(0, 9); let res = arrayList.length; let res1 = arrayList.getLastIndexOf(1); - expect(res).assertEqual(1); - expect(res1).assertEqual(0); + expect(res).assertEqual(0); + expect(res1).assertEqual(-1); }); it("SR000GGR44_testSubArrayList040", 0, function () { let arrayList = new ArrayList(); @@ -702,4 +702,20 @@ describe("ArraylistTest", function () { expect(arr[i]).assertEqual(a[i]); } }); + it("SR000GGR44_testRemoveByRange052", 0, function () { + let arrayList = new ArrayList(); + arrayList.add("四"); + arrayList.add("三"); + arrayList.add(1); + arrayList.add("a"); + arrayList.add(1); + arrayList.add("b"); + arrayList.add("c"); + arrayList.add(1); + arrayList.removeByRange(0, 8); + let res = arrayList.length; + let res1 = arrayList.getLastIndexOf(1); + expect(res).assertEqual(1); + expect(res1).assertEqual(0); + }); }); diff --git a/compileruntime/containerLine_lib_standard/src/main/js/test/Vector.test.js b/compileruntime/containerLine_lib_standard/src/main/js/test/Vector.test.js index e96f3f85c..021d481b8 100644 --- a/compileruntime/containerLine_lib_standard/src/main/js/test/Vector.test.js +++ b/compileruntime/containerLine_lib_standard/src/main/js/test/Vector.test.js @@ -534,7 +534,7 @@ describe("VectorTest", function () { vector.add(14); let arr1 = ["a", "b", "c"]; vector.copyToArray(arr1); - let a = ["a", "b", "c",4, 3, 1]; + let a = ["a", "b", "c", 4, 3, 1]; for (let i = 0; i < a.length; i++) { expect(arr1[i]).assertEqual(a[i]); } diff --git a/compileruntime/containerRelation_lib_standard/src/main/js/test/PlainArray.test.js b/compileruntime/containerRelation_lib_standard/src/main/js/test/PlainArray.test.js index 1f4143c49..cf9d81604 100644 --- a/compileruntime/containerRelation_lib_standard/src/main/js/test/PlainArray.test.js +++ b/compileruntime/containerRelation_lib_standard/src/main/js/test/PlainArray.test.js @@ -459,7 +459,6 @@ describe("PlainArrayTest", function () { }); it("SR000GGR45_testAdd039", 0, function () { let plainArray = new PlainArray(); - plainArray.add(1.23, "a"); plainArray.add(-2, "b"); try { plainArray.add("a", "c"); @@ -501,4 +500,16 @@ describe("PlainArrayTest", function () { } expect(flag).assertEqual(true); }); + it("SR000GGR45_testAdd042", 0, function () { + let plainArray = new PlainArray(); + plainArray.add(-2, "b"); + try { + plainArray.add(1.23, "a"); + } catch (err) { + expect(err.name).assertEqual("TypeError"); + expect(err.message).assertEqual("the index is not integer"); + } + let res = plainArray.get(-2); + expect(res).assertEqual("b"); + }); }); -- GitLab