diff --git a/test/moduletest/allocatearraybuffer/BUILD.gn b/test/moduletest/allocatearraybuffer/BUILD.gn index 8a192e777588da2b9eb9ba086630d414ecfdb278..50a29eb99ea9c2c3ee3c6d8b134cd49aa72a9552 100644 --- a/test/moduletest/allocatearraybuffer/BUILD.gn +++ b/test/moduletest/allocatearraybuffer/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("allocatearraybuffer") { +host_moduletest_assert_action("allocatearraybuffer") { deps = [] } diff --git a/test/moduletest/allocatearraybuffer/allocatearraybuffer.js b/test/moduletest/allocatearraybuffer/allocatearraybuffer.js index 0e5a07d549ce9fda4da7b6abe50b040f9b620123..a6f08b049b722f26b5f07fa72390fbdabab8da33 100644 --- a/test/moduletest/allocatearraybuffer/allocatearraybuffer.js +++ b/test/moduletest/allocatearraybuffer/allocatearraybuffer.js @@ -21,7 +21,7 @@ */ var newTarget = function() {}.bind(null); var arrayBuffer = Reflect.construct(ArrayBuffer, [16], newTarget); -print(arrayBuffer.length); +assert_equal(arrayBuffer.length.toString(), "undefined"); /* * @tc.name:allocatearraybuffer @@ -31,14 +31,14 @@ print(arrayBuffer.length); */ const dataview = new DataView(new ArrayBuffer(64)); dataview.setInt16(0,-1); -print(dataview.getFloat64("cas")); +assert_equal(dataview.getFloat64("cas").toString(), "NaN"); const v32 = new Int32Array(10); for (let i = 0; i < v32.length; i++) { v32[i] = i + 1; } const v36 = this.Atomics; -print(v36.and(v32, this, v36)); +assert_equal(v36.and(v32, this, v36).toString(), "1"); function SendableArrayBufferTest() { try { @@ -46,7 +46,8 @@ function SendableArrayBufferTest() { const v3 = new Proxy(SendableArrayBuffer, o1); new v3(); } catch (error) { - print(error); + assert_equal(error.toString(), "TypeError: shared ctor cannot assign unshared newTarget"); } } -SendableArrayBufferTest() \ No newline at end of file +SendableArrayBufferTest() +test_end(); \ No newline at end of file diff --git a/test/moduletest/allocatearraybuffer/expect_output.txt b/test/moduletest/allocatearraybuffer/expect_output.txt deleted file mode 100644 index 5fd9e962a359b02511ec76f82633c98d8d966fb4..0000000000000000000000000000000000000000 --- a/test/moduletest/allocatearraybuffer/expect_output.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -undefined -NaN -1 -TypeError: shared ctor cannot assign unshared newTarget \ No newline at end of file diff --git a/test/moduletest/allocatesizeoverflow/BUILD.gn b/test/moduletest/allocatesizeoverflow/BUILD.gn index bf27d97bd43450895e43dfa8e4b0e91a95d7c990..fce3db02e874e2185d8f0410c9684c47efa5152e 100644 --- a/test/moduletest/allocatesizeoverflow/BUILD.gn +++ b/test/moduletest/allocatesizeoverflow/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("allocatesizeoverflow") { +host_moduletest_assert_action("allocatesizeoverflow") { deps = [] } diff --git a/test/moduletest/allocatesizeoverflow/allocatesizeoverflow.js b/test/moduletest/allocatesizeoverflow/allocatesizeoverflow.js index 29083188bc0b10340214567bdf6b6b92252d9f07..7681f4c35cef86df9505215b49bcf4689e94fa75 100644 --- a/test/moduletest/allocatesizeoverflow/allocatesizeoverflow.js +++ b/test/moduletest/allocatesizeoverflow/allocatesizeoverflow.js @@ -23,5 +23,6 @@ v0.length = 2465979003; try { isNaN.apply(undefined, v0); } catch (error) { - print(error); + assert_equal(error.toString(), "TypeError: len is bigger than 2^32 - 1"); } +test_end(); diff --git a/test/moduletest/allocatesizeoverflow/expect_output.txt b/test/moduletest/allocatesizeoverflow/expect_output.txt deleted file mode 100644 index 518afaa244669fe56de958219a24f14c1aa9eae8..0000000000000000000000000000000000000000 --- a/test/moduletest/allocatesizeoverflow/expect_output.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -TypeError: len is bigger than 2^32 - 1 diff --git a/test/moduletest/arktoolsgetundetectable/BUILD.gn b/test/moduletest/arktoolsgetundetectable/BUILD.gn index e08d61b7f294f871dfac35d72276093301f962ae..e9b090f9086dcd2d3b2edb2c19e61966c2904930 100755 --- a/test/moduletest/arktoolsgetundetectable/BUILD.gn +++ b/test/moduletest/arktoolsgetundetectable/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("arktoolsgetundetectable") { +host_moduletest_assert_action("arktoolsgetundetectable") { deps = [] } diff --git a/test/moduletest/arktoolsgetundetectable/arktoolsgetundetectable.js b/test/moduletest/arktoolsgetundetectable/arktoolsgetundetectable.js index 14bc49ab4fe1809f29e80b582af103877249ae11..6e1ff75ae8c1cbed6819a78e01484bb56b8ef30d 100755 --- a/test/moduletest/arktoolsgetundetectable/arktoolsgetundetectable.js +++ b/test/moduletest/arktoolsgetundetectable/arktoolsgetundetectable.js @@ -17,19 +17,20 @@ var undetectable = ArkTools.getUndetectable(); // Undefined -print(typeof undetectable == 'undefined'); -print(typeof undetectable === 'undefined'); -print(typeof undetectable != 'undefined'); -print(typeof undetectable !== 'undefined'); +assert_equal(typeof undetectable == 'undefined', true); +assert_equal(typeof undetectable === 'undefined', true); +assert_equal(typeof undetectable != 'undefined', false); +assert_equal(typeof undetectable !== 'undefined', false); // Function -print(typeof undetectable != 'function'); -print(typeof undetectable !== 'function'); -print(typeof undetectable == 'function'); -print(typeof undetectable === 'function'); +assert_equal(typeof undetectable != 'function', true); +assert_equal(typeof undetectable !== 'function', true); +assert_equal(typeof undetectable == 'function', false); +assert_equal(typeof undetectable === 'function', false); // Object -print(typeof undetectable != 'object'); -print(typeof undetectable !== 'object'); -print(typeof undetectable == 'object'); -print(typeof undetectable === 'object'); \ No newline at end of file +assert_equal(typeof undetectable != 'object', true); +assert_equal(typeof undetectable !== 'object', true); +assert_equal(typeof undetectable == 'object', false); +assert_equal(typeof undetectable === 'object', false); +test_end(); \ No newline at end of file diff --git a/test/moduletest/arktoolsgetundetectable/expect_output.txt b/test/moduletest/arktoolsgetundetectable/expect_output.txt deleted file mode 100755 index 60b5fdafe7282ec6ee545f30744ba01ed81c146d..0000000000000000000000000000000000000000 --- a/test/moduletest/arktoolsgetundetectable/expect_output.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -true -true -false -false -true -true -false -false -true -true -false -false diff --git a/test/moduletest/arrayconcat/BUILD.gn b/test/moduletest/arrayconcat/BUILD.gn index 32dda9fb22784fc839763569b93b9ae22f4951c6..52dbb724c3222c35aab5b3c6bac7b339deb2fdeb 100644 --- a/test/moduletest/arrayconcat/BUILD.gn +++ b/test/moduletest/arrayconcat/BUILD.gn @@ -13,6 +13,6 @@ import("//arkcompiler/ets_runtime/test/test_helper.gni") -host_moduletest_action("arrayconcat") { +host_moduletest_assert_action("arrayconcat") { deps = [] } diff --git a/test/moduletest/arrayconcat/arrayconcat.js b/test/moduletest/arrayconcat/arrayconcat.js index 61b8ebdd7bc689420d73dee8ea13672d73a394fd..cfe147e5f82d1c6080cf371459cf71ded55c4066 100644 --- a/test/moduletest/arrayconcat/arrayconcat.js +++ b/test/moduletest/arrayconcat/arrayconcat.js @@ -15,13 +15,13 @@ const array1 = ['a', 'b', 'c']; const array2 = ['d', 'e', 'f']; const array3 = array1.concat(array2); -print(array3); +assert_equal(array3.toString(), "a,b,c,d,e,f"); const letters = ["a", "b", "c"]; const numbers = [1, 2, 3]; const alphaNumeric = letters.concat(numbers); -print(alphaNumeric); +assert_equal(alphaNumeric.toString(), "a,b,c,1,2,3"); const num1 = [1, 2, 3]; const num2 = [4, 5, 6]; @@ -29,32 +29,32 @@ const num3 = [7, 8, 9]; const numbers1 = num1.concat(num2, num3); -print(numbers1); +assert_equal(numbers1.toString(), "1,2,3,4,5,6,7,8,9"); const letters1 = ["a", "b", "c"]; const alphaNumeric1 = letters1.concat(1, [2, 3]); -print(alphaNumeric1); +assert_equal(alphaNumeric1.toString(), "a,b,c,1,2,3"); const num11 = [[1]]; const num22 = [2, [3]]; const numbers2 = num1.concat(num22); -print(numbers2); +assert_equal(numbers2.toString(), "1,2,3,2,3"); // [[1], 2, [3]] num11[0].push(4); -print(numbers2); +assert_equal(numbers2.toString(), "1,2,3,2,3"); -print([1, , 3].concat([4, 5])); // [1, empty, 3, 4, 5] -print([1, 2].concat([3, , 5])); // [1, 2, 3, empty, 5] +assert_equal([1, , 3].concat([4, 5]).toString(), "1,,3,4,5"); // [1, empty, 3, 4, 5] +assert_equal([1, 2].concat([3, , 5]).toString(), "1,2,3,,5"); // [1, 2, 3, empty, 5] const emptyArr = []; -print(emptyArr.concat([]).length); +assert_equal(emptyArr.concat([]).length, 0); /* * @tc.name:Array concat1 @@ -73,7 +73,11 @@ print(emptyArr.concat([]).length); arr2[4] = 1; let arr3 = new Array(2000); let arr4 = arr3.concat(arr2); - print(arr4[2000], arr4[2001], arr4[2002], arr4[2003], arr4[2004]); + assert_equal(arr4[2000], 1); + assert_equal(arr4[2001], 3); + assert_equal(arr4[2002], 2); + assert_equal(arr4[2003].toString(), "ab"); + assert_equal(arr4[2004], 1); } /* @@ -93,7 +97,11 @@ print(emptyArr.concat([]).length); arr2[4] = 1; let arr3 = new Array(2000); let arr4 = arr3.concat(arr2); - print(arr4[2000], arr4[2001], arr4[2002], arr4[2003], arr4[2004]); + assert_equal(arr4[2000], 1); + assert_equal(arr4[2001], 3); + assert_equal(arr4[2002], 2); + assert_equal(arr4[2003].toString(), "ab"); + assert_equal(arr4[2004], 1); } /* @@ -113,7 +121,11 @@ print(emptyArr.concat([]).length); arr2[4] = 1; let arr3 = new Array(10); let arr4 = arr3.concat(arr2); - print(arr4[10], arr4[11], arr4[12], arr4[13], arr4[14]); + assert_equal(arr4[10], 1); + assert_equal(arr4[11], 3); + assert_equal(arr4[12], 2); + assert_equal(arr4[13].toString(), "ab"); + assert_equal(arr4[14], 1); } /* @@ -129,7 +141,11 @@ print(emptyArr.concat([]).length); arr2[4] = 1; let arr3 = new Array(2000); let arr4 = arr3.concat(arr2); - print(arr4[2000], arr4[2001], arr4[2002], arr4[2003], arr4[2004]); + assert_equal(arr4[2000].toString(), "undefined"); + assert_equal(arr4[2001], 3); + assert_equal(arr4[2002], 2); + assert_equal(arr4[2003], ab); + assert_equal(arr4[2004], 1); } /* @@ -145,7 +161,11 @@ print(emptyArr.concat([]).length); arr2[4] = 1; let arr3 = new Array(2000); let arr4 = arr3.concat(arr2); - print(arr4[2000], arr4[2001], arr4[2002], arr4[2003], arr4[2004]); + assert_equal(arr4[2000].toString(), "undefined"); + assert_equal(arr4[2001], 3); + assert_equal(arr4[2002], 2); + assert_equal(arr4[2003].toString(), "ab"); + assert_equal(arr4[2004], 1); } /* @@ -161,7 +181,11 @@ print(emptyArr.concat([]).length); arr2[4] = 1; let arr3 = new Array(10); let arr4 = arr3.concat(arr2); - print(arr4[10], arr4[11], arr4[12], arr4[13], arr4[14]); + assert_equal(arr4[10].toString(), "undefined"); + assert_equal(arr4[11], 3); + assert_equal(arr4[12], 2); + assert_equal(arr4[13], ab); + assert_equal(arr4[14], 1); } /* @@ -178,7 +202,12 @@ print(emptyArr.concat([]).length); arr2[4] = 1; let arr3 = new Array(2000); let arr4 = arr3.concat(arr2); - print(arr4[0], arr4[2000], arr4[2001], arr4[2002], arr4[2003], arr4[2004]); + assert_equal(arr4[0].toString(), "??"); + assert_equal(arr4[2000].toString(), "??"); + assert_equal(arr4[2001], 3); + assert_equal(arr4[2002], 2); + assert_equal(arr4[2003].toString(), "ab"); + assert_equal(arr4[2004], 1); } print("test arrayconcat success!"); @@ -186,10 +215,10 @@ print("test arrayconcat success!"); print("proxy defineproperty success!"); const v1 = [1, 2, "j", 9999, , 23]; const v2 = ["sss", 2, "j", , , ,"test"]; -print(v1.concat(v2)); +assert_equal(v1.concat(v2), "1,2,j,9999,,23,sss,2,j,,,,test"); let v3 = new Array(); v3.push('foo'); var v4 = ['bar']; var v5 = v3.concat(v4); -print(v5); \ No newline at end of file +assert_equal(v5.toString(), "foo,bar"); \ No newline at end of file