/* Copyright 2021 Mozilla Foundation
*
* 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/core/gc/array_fill.wast
// ./test/core/gc/array_fill.wast:5
assert_invalid(
() => instantiate(`(module
(type \$a (array i8))
(func (export "array.fill-immutable" ) (param \$1 (ref \$a)) (param \$2 i32)
(array.fill \$a (local.get \$1 ) (i32.const 0 ) (local.get \$2 ) (i32.const 0 ))
)
)`),
`immutable array`,
);
// ./test/core/gc/array_fill.wast:16
assert_invalid(
() => instantiate(`(module
(type \$a (array (mut i8)))
(func (export "array.fill-invalid-1" ) (param \$1 (ref \$a)) (param \$2 funcref)
(array.fill \$a (local.get \$1 ) (i32.const 0 ) (local.get \$2 ) (i32.const 0 ))
)
)`),
`type mismatch`,
);
// ./test/core/gc/array_fill.wast:27
assert_invalid(
() => instantiate(`(module
(type \$b (array (mut funcref)))
(func (export "array.fill-invalid-1" ) (param \$1 (ref \$b)) (param \$2 i32)
(array.fill \$b (local.get \$1 ) (i32.const 0 ) (local.get \$2 ) (i32.const 0 ))
)
)`),
`type mismatch`,
);
// ./test/core/gc/array_fill.wast:38
let $0 = instantiate(`(module
(type \$arr8 (array i8))
(type \$arr8_mut (array (mut i8)))
(global \$g_arr8 (ref \$arr8) (array.new \$arr8 (i32.const 10 ) (i32.const 12 )))
(global \$g_arr8_mut (mut (ref \$arr8_mut)) (array.new_default \$arr8_mut (i32.const 12 )))
(func (export "array_get_nth" ) (param \$1 i32) (result i32)
(array.get_u \$arr8_mut (global.get \$g_arr8_mut) (local.get \$1 ))
)
(func (export "array_fill-null" )
(array.fill \$arr8_mut (ref.null \$arr8_mut) (i32.const 0 ) (i32.const 0 ) (i32.const 0 ))
)
(func (export "array_fill" ) (param \$1 i32) (param \$2 i32) (param \$3 i32)
(array.fill \$arr8_mut (global.get \$g_arr8_mut) (local.get \$1 ) (local.get \$2 ) (local.get \$3 ))
)
)`);
// ./test/core/gc/array_fill.wast:59
assert_trap(() => invoke($0 , `array_fill-null `, []), `null array reference`);
// ./test/core/gc/array_fill.wast:62
assert_trap(() => invoke($0 , `array_fill`, [13 , 0 , 0 ]), `out of bounds array access`);
// ./test/core/gc/array_fill.wast:65
assert_trap(() => invoke($0 , `array_fill`, [0 , 0 , 13 ]), `out of bounds array access`);
// ./test/core/gc/array_fill.wast:68
assert_return(() => invoke($0 , `array_fill`, [12 , 0 , 0 ]), []);
// ./test/core/gc/array_fill.wast:71
assert_return(() => invoke($0 , `array_get_nth`, [0 ]), [value("i32" , 0 )]);
// ./test/core/gc/array_fill.wast:72
assert_return(() => invoke($0 , `array_get_nth`, [5 ]), [value("i32" , 0 )]);
// ./test/core/gc/array_fill.wast:73
assert_return(() => invoke($0 , `array_get_nth`, [11 ]), [value("i32" , 0 )]);
// ./test/core/gc/array_fill.wast:74
assert_trap(() => invoke($0 , `array_get_nth`, [12 ]), `out of bounds array access`);
// ./test/core/gc/array_fill.wast:77
assert_return(() => invoke($0 , `array_fill`, [2 , 11 , 2 ]), []);
// ./test/core/gc/array_fill.wast:78
assert_return(() => invoke($0 , `array_get_nth`, [1 ]), [value("i32" , 0 )]);
// ./test/core/gc/array_fill.wast:79
assert_return(() => invoke($0 , `array_get_nth`, [2 ]), [value("i32" , 11 )]);
// ./test/core/gc/array_fill.wast:80
assert_return(() => invoke($0 , `array_get_nth`, [3 ]), [value("i32" , 11 )]);
// ./test/core/gc/array_fill.wast:81
assert_return(() => invoke($0 , `array_get_nth`, [4 ]), [value("i32" , 0 )]);
// ./test/core/gc/array_fill.wast:84
assert_return(() => invoke($0 , `array_fill`, [0 , 42 , 12 ]), []);
// ./test/core/gc/array_fill.wast:85
assert_return(() => invoke($0 , `array_get_nth`, [0 ]), [value("i32" , 42 )]);
// ./test/core/gc/array_fill.wast:86
assert_return(() => invoke($0 , `array_get_nth`, [2 ]), [value("i32" , 42 )]);
// ./test/core/gc/array_fill.wast:87
assert_return(() => invoke($0 , `array_get_nth`, [5 ]), [value("i32" , 42 )]);
// ./test/core/gc/array_fill.wast:88
assert_return(() => invoke($0 , `array_get_nth`, [11 ]), [value("i32" , 42 )]);
// ./test/core/gc/array_fill.wast:91
assert_return(() => invoke($0 , `array_fill`, [0 , 7 , 1 ]), []);
// ./test/core/gc/array_fill.wast:92
assert_return(() => invoke($0 , `array_get_nth`, [0 ]), [value("i32" , 7 )]);
// ./test/core/gc/array_fill.wast:93
assert_return(() => invoke($0 , `array_get_nth`, [1 ]), [value("i32" , 42 )]);
// ./test/core/gc/array_fill.wast:94
assert_return(() => invoke($0 , `array_get_nth`, [11 ]), [value("i32" , 42 )]);
// ./test/core/gc/array_fill.wast:97
assert_return(() => invoke($0 , `array_fill`, [10 , 9 , 2 ]), []);
// ./test/core/gc/array_fill.wast:98
assert_return(() => invoke($0 , `array_get_nth`, [9 ]), [value("i32" , 42 )]);
// ./test/core/gc/array_fill.wast:99
assert_return(() => invoke($0 , `array_get_nth`, [10 ]), [value("i32" , 9 )]);
// ./test/core/gc/array_fill.wast:100
assert_return(() => invoke($0 , `array_get_nth`, [11 ]), [value("i32" , 9 )]);
Messung V0.5 in Prozent C=79 H=100 G=90
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet am 2026-08-26)
¤
*© Formatika GbR, Deutschland