| 1 |
/* Copyright 2021 Mozilla Foundation |
| 2 |
* |
| 3 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
* you may not use this file except in compliance with the License. |
| 5 |
* You may obtain a copy of the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software |
| 10 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
* See the License for the specific language governing permissions and |
| 13 |
* limitations under the License. |
| 14 |
*/ |
| 15 |
|
| 16 |
// ./test/core/table_copy_mixed.wast |
| 17 |
|
| 18 |
// ./test/core/table_copy_mixed.wast:2 |
| 19 |
let $0 = instantiate(`(module |
| 20 |
(table $$t32 30 30 funcref) |
| 21 |
(table $$t64 i64 30 30 funcref) |
| 22 |
|
| 23 |
(func (export "test32") |
| 24 |
(table.copy $$t32 $$t32 (i32.const 13) (i32.const 2) (i32.const 3))) |
| 25 |
|
| 26 |
(func (export "test64") |
| 27 |
(table.copy $$t64 $$t64 (i64.const 13) (i64.const 2) (i64.const 3))) |
| 28 |
|
| 29 |
(func (export "test_64to32") |
| 30 |
(table.copy $$t32 $$t64 (i32.const 13) (i64.const 2) (i32.const 3))) |
| 31 |
|
| 32 |
(func (export "test_32to64") |
| 33 |
(table.copy $$t64 $$t32 (i64.const 13) (i32.const 2) (i32.const 3))) |
| 34 |
)`); |
| 35 |
|
| 36 |
// ./test/core/table_copy_mixed.wast:20 |
| 37 |
assert_invalid( |
| 38 |
() => instantiate(`(module |
| 39 |
(table $$t32 30 30 funcref) |
| 40 |
(table $$t64 i64 30 30 funcref) |
| 41 |
|
| 42 |
(func (export "bad_size_arg") |
| 43 |
(table.copy $$t32 $$t64 (i32.const 13) (i64.const 2) (i64.const 3))) |
| 44 |
)`), |
| 45 |
`type mismatch`, |
| 46 |
); |
| 47 |
|
| 48 |
// ./test/core/table_copy_mixed.wast:30 |
| 49 |
assert_invalid( |
| 50 |
() => instantiate(`(module |
| 51 |
(table $$t32 30 30 funcref) |
| 52 |
(table $$t64 i64 30 30 funcref) |
| 53 |
|
| 54 |
(func (export "bad_src_idx") |
| 55 |
(table.copy $$t32 $$t64 (i32.const 13) (i32.const 2) (i32.const 3))) |
| 56 |
)`), |
| 57 |
`type mismatch`, |
| 58 |
); |
| 59 |
|
| 60 |
// ./test/core/table_copy_mixed.wast:40 |
| 61 |
assert_invalid( |
| 62 |
() => instantiate(`(module |
| 63 |
(table $$t32 30 30 funcref) |
| 64 |
(table $$t64 i64 30 30 funcref) |
| 65 |
|
| 66 |
(func (export "bad_dst_idx") |
| 67 |
(table.copy $$t32 $$t64 (i64.const 13) (i64.const 2) (i32.const 3))) |
| 68 |
)`), |
| 69 |
`type mismatch`, |
| 70 |
); |