mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
Bug in TypedArray Fill
Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAM2S5 Signed-off-by: hecunmao <hecunmao@huawei.com> Change-Id: I68ee4425f33f1834a654666dd116036a409e2bd0
This commit is contained in:
parent
473c6e7ec6
commit
71711e6fc7
@ -842,7 +842,7 @@ bool JSTypedArray::FastTypedArrayFill(JSThread *thread, const JSHandle<JSTaggedV
|
||||
DataViewType elementType = TypedArrayHelper::GetType(jsType);
|
||||
uint64_t byteBeginOffset = start * elementSize + offset;
|
||||
uint64_t byteEndOffset = std::min(end, arrLen) * elementSize + offset;
|
||||
if (byteBeginOffset <= byteEndOffset) {
|
||||
if (byteBeginOffset < byteEndOffset) {
|
||||
BuiltinsArrayBuffer::TryFastSetValueInBuffer(thread, buffer,
|
||||
byteBeginOffset, byteEndOffset, elementType, numValue.GetNumber(), true);
|
||||
}
|
||||
|
@ -155,6 +155,7 @@ group("ark_js_moduletest") {
|
||||
"trycatch",
|
||||
"typearray",
|
||||
"typedarrayat",
|
||||
"typedarrayfill",
|
||||
"typedarrayfindlast",
|
||||
"typedarrayfrom",
|
||||
"typedarraynan",
|
||||
@ -357,6 +358,7 @@ group("ark_asm_test") {
|
||||
"throwerror",
|
||||
"trycatch",
|
||||
"typedarrayat",
|
||||
"typedarrayfill",
|
||||
"typedarrayfindlast",
|
||||
"typedarrayfrom",
|
||||
"typedarraynan",
|
||||
@ -535,6 +537,7 @@ group("ark_asm_single_step_test") {
|
||||
"throwerror",
|
||||
"trycatch",
|
||||
"typedarrayat",
|
||||
"typedarrayfill",
|
||||
"typedarrayfindlast",
|
||||
"typedarrayfrom",
|
||||
"typedarraynan",
|
||||
|
18
test/moduletest/typedarrayfill/BUILD.gn
Executable file
18
test/moduletest/typedarrayfill/BUILD.gn
Executable file
@ -0,0 +1,18 @@
|
||||
# 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.
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_moduletest_action("typedarrayfill") {
|
||||
deps = []
|
||||
}
|
14
test/moduletest/typedarrayfill/expect_output.txt
Executable file
14
test/moduletest/typedarrayfill/expect_output.txt
Executable file
@ -0,0 +1,14 @@
|
||||
# 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.
|
||||
|
||||
test typedarrayfill success!
|
26
test/moduletest/typedarrayfill/typedarrayfill.js
Executable file
26
test/moduletest/typedarrayfill/typedarrayfill.js
Executable file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @tc.name:typedarrayfill
|
||||
* @tc.desc:test TypedArray.fill
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueI7F8N1
|
||||
*/
|
||||
|
||||
let buff = new ArrayBuffer(0);
|
||||
let arr = new Int32Array(buff);
|
||||
arr.fill(0);
|
||||
print("test typedarrayfill success!")
|
Loading…
Reference in New Issue
Block a user