wa-lang.org/wazero@v1.0.2/internal/integration_test/spectest/v2/testdata/table_fill.wast (about) 1 (module 2 (table $t 10 externref) 3 4 (func (export "fill") (param $i i32) (param $r externref) (param $n i32) 5 (table.fill $t (local.get $i) (local.get $r) (local.get $n)) 6 ) 7 8 (func (export "get") (param $i i32) (result externref) 9 (table.get $t (local.get $i)) 10 ) 11 ) 12 13 (assert_return (invoke "get" (i32.const 1)) (ref.null extern)) 14 (assert_return (invoke "get" (i32.const 2)) (ref.null extern)) 15 (assert_return (invoke "get" (i32.const 3)) (ref.null extern)) 16 (assert_return (invoke "get" (i32.const 4)) (ref.null extern)) 17 (assert_return (invoke "get" (i32.const 5)) (ref.null extern)) 18 19 (assert_return (invoke "fill" (i32.const 2) (ref.extern 1) (i32.const 3))) 20 (assert_return (invoke "get" (i32.const 1)) (ref.null extern)) 21 (assert_return (invoke "get" (i32.const 2)) (ref.extern 1)) 22 (assert_return (invoke "get" (i32.const 3)) (ref.extern 1)) 23 (assert_return (invoke "get" (i32.const 4)) (ref.extern 1)) 24 (assert_return (invoke "get" (i32.const 5)) (ref.null extern)) 25 26 (assert_return (invoke "fill" (i32.const 4) (ref.extern 2) (i32.const 2))) 27 (assert_return (invoke "get" (i32.const 3)) (ref.extern 1)) 28 (assert_return (invoke "get" (i32.const 4)) (ref.extern 2)) 29 (assert_return (invoke "get" (i32.const 5)) (ref.extern 2)) 30 (assert_return (invoke "get" (i32.const 6)) (ref.null extern)) 31 32 (assert_return (invoke "fill" (i32.const 4) (ref.extern 3) (i32.const 0))) 33 (assert_return (invoke "get" (i32.const 3)) (ref.extern 1)) 34 (assert_return (invoke "get" (i32.const 4)) (ref.extern 2)) 35 (assert_return (invoke "get" (i32.const 5)) (ref.extern 2)) 36 37 (assert_return (invoke "fill" (i32.const 8) (ref.extern 4) (i32.const 2))) 38 (assert_return (invoke "get" (i32.const 7)) (ref.null extern)) 39 (assert_return (invoke "get" (i32.const 8)) (ref.extern 4)) 40 (assert_return (invoke "get" (i32.const 9)) (ref.extern 4)) 41 42 (assert_return (invoke "fill" (i32.const 9) (ref.null extern) (i32.const 1))) 43 (assert_return (invoke "get" (i32.const 8)) (ref.extern 4)) 44 (assert_return (invoke "get" (i32.const 9)) (ref.null extern)) 45 46 (assert_return (invoke "fill" (i32.const 10) (ref.extern 5) (i32.const 0))) 47 (assert_return (invoke "get" (i32.const 9)) (ref.null extern)) 48 49 (assert_trap 50 (invoke "fill" (i32.const 8) (ref.extern 6) (i32.const 3)) 51 "out of bounds table access" 52 ) 53 (assert_return (invoke "get" (i32.const 7)) (ref.null extern)) 54 (assert_return (invoke "get" (i32.const 8)) (ref.extern 4)) 55 (assert_return (invoke "get" (i32.const 9)) (ref.null extern)) 56 57 (assert_trap 58 (invoke "fill" (i32.const 11) (ref.null extern) (i32.const 0)) 59 "out of bounds table access" 60 ) 61 62 (assert_trap 63 (invoke "fill" (i32.const 11) (ref.null extern) (i32.const 10)) 64 "out of bounds table access" 65 ) 66 67 68 ;; Type errors 69 70 (assert_invalid 71 (module 72 (table $t 10 externref) 73 (func $type-index-value-length-empty-vs-i32-i32 74 (table.fill $t) 75 ) 76 ) 77 "type mismatch" 78 ) 79 (assert_invalid 80 (module 81 (table $t 10 externref) 82 (func $type-index-empty-vs-i32 83 (table.fill $t (ref.null extern) (i32.const 1)) 84 ) 85 ) 86 "type mismatch" 87 ) 88 (assert_invalid 89 (module 90 (table $t 10 externref) 91 (func $type-value-empty-vs 92 (table.fill $t (i32.const 1) (i32.const 1)) 93 ) 94 ) 95 "type mismatch" 96 ) 97 (assert_invalid 98 (module 99 (table $t 10 externref) 100 (func $type-length-empty-vs-i32 101 (table.fill $t (i32.const 1) (ref.null extern)) 102 ) 103 ) 104 "type mismatch" 105 ) 106 (assert_invalid 107 (module 108 (table $t 0 externref) 109 (func $type-index-f32-vs-i32 110 (table.fill $t (f32.const 1) (ref.null extern) (i32.const 1)) 111 ) 112 ) 113 "type mismatch" 114 ) 115 (assert_invalid 116 (module 117 (table $t 0 funcref) 118 (func $type-value-vs-funcref (param $r externref) 119 (table.fill $t (i32.const 1) (local.get $r) (i32.const 1)) 120 ) 121 ) 122 "type mismatch" 123 ) 124 (assert_invalid 125 (module 126 (table $t 0 externref) 127 (func $type-length-f32-vs-i32 128 (table.fill $t (i32.const 1) (ref.null extern) (f32.const 1)) 129 ) 130 ) 131 "type mismatch" 132 ) 133 134 (assert_invalid 135 (module 136 (table $t1 1 externref) 137 (table $t2 1 funcref) 138 (func $type-value-externref-vs-funcref-multi (param $r externref) 139 (table.fill $t2 (i32.const 0) (local.get $r) (i32.const 1)) 140 ) 141 ) 142 "type mismatch" 143 ) 144 145 (assert_invalid 146 (module 147 (table $t 1 externref) 148 (func $type-result-empty-vs-num (result i32) 149 (table.fill $t (i32.const 0) (ref.null extern) (i32.const 1)) 150 ) 151 ) 152 "type mismatch" 153 )