github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/integration_test/spectest/v2/testdata/table.wast (about)

     1  ;; Test table section structure
     2  
     3  (module (table 0 funcref))
     4  (module (table 1 funcref))
     5  (module (table 0 0 funcref))
     6  (module (table 0 1 funcref))
     7  (module (table 1 256 funcref))
     8  (module (table 0 65536 funcref))
     9  (module (table 0 0xffff_ffff funcref))
    10  
    11  (module (table 0 funcref) (table 0 funcref))
    12  (module (table (import "spectest" "table") 0 funcref) (table 0 funcref))
    13  
    14  (assert_invalid (module (elem (i32.const 0))) "unknown table")
    15  (assert_invalid (module (elem (i32.const 0) $f) (func $f)) "unknown table")
    16  
    17  
    18  (assert_invalid
    19    (module (table 1 0 funcref))
    20    "size minimum must not be greater than maximum"
    21  )
    22  (assert_invalid
    23    (module (table 0xffff_ffff 0 funcref))
    24    "size minimum must not be greater than maximum"
    25  )
    26  
    27  (assert_malformed
    28    (module quote "(table 0x1_0000_0000 funcref)")
    29    "i32 constant out of range"
    30  )
    31  (assert_malformed
    32    (module quote "(table 0x1_0000_0000 0x1_0000_0000 funcref)")
    33    "i32 constant out of range"
    34  )
    35  (assert_malformed
    36    (module quote "(table 0 0x1_0000_0000 funcref)")
    37    "i32 constant out of range"
    38  )
    39  
    40  
    41  ;; Duplicate table identifiers
    42  
    43  (assert_malformed (module quote
    44    "(table $foo 1 funcref)"
    45    "(table $foo 1 funcref)")
    46    "duplicate table")
    47  (assert_malformed (module quote
    48    "(import \"\" \"\" (table $foo 1 funcref))"
    49    "(table $foo 1 funcref)")
    50    "duplicate table")
    51  (assert_malformed (module quote
    52    "(import \"\" \"\" (table $foo 1 funcref))"
    53    "(import \"\" \"\" (table $foo 1 funcref))")
    54    "duplicate table")