Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test
  • Loading branch information
kripken committed Mar 25, 2024
commit 2965ffc55e5a962d45441f38d722e78e70ebbfb6
34 changes: 32 additions & 2 deletions test/lit/exec/strings.wast
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
(import "fuzzing-support" "log" (func $log (param i32)))

;; CHECK: [fuzz-exec] calling new_wtf16_array
;; CHECK-NEXT: [fuzz-exec] note result: new_wtf16_array => string("ello")
;; CHECK-NEXT: [trap array oob]
(func $new_wtf16_array (export "new_wtf16_array") (result stringref)
(string.new_wtf16_array
(array.new_fixed $array16 5
Expand Down Expand Up @@ -297,6 +297,8 @@
)
)

;; CHECK: [fuzz-exec] calling new_empty
;; CHECK-NEXT: [fuzz-exec] note result: new_empty => string("")
(func $new_empty (export "new_empty") (result stringref)
;; Make an empty string from an empty array.
(string.new_wtf16_array
Expand All @@ -308,6 +310,8 @@
)
)

;; CHECK: [fuzz-exec] calling new_empty_oob
;; CHECK-NEXT: [trap array oob]
(func $new_empty_oob (export "new_empty_oob") (result stringref)
;; Try to make a string from an empty array that we slice at [1:0], which is
;; out of bounds due to the starting index.
Expand All @@ -319,9 +323,23 @@
(i32.const 0)
)
)

;; CHECK: [fuzz-exec] calling new_empty_oob_2
;; CHECK-NEXT: [trap array oob]
(func $new_empty_oob_2 (export "new_empty_oob_2") (result stringref)
;; Try to make a string from an empty array that we slice at [:1], which is
;; out of bounds due to the ending index.
(string.new_wtf16_array
(array.new_default $array16
(i32.const 0)
)
(i32.const 0)
(i32.const 1)
)
)
)
;; CHECK: [fuzz-exec] calling new_wtf16_array
;; CHECK-NEXT: [fuzz-exec] note result: new_wtf16_array => string("ello")
;; CHECK-NEXT: [trap array oob]

;; CHECK: [fuzz-exec] calling const
;; CHECK-NEXT: [fuzz-exec] note result: const => string("world")
Expand Down Expand Up @@ -396,6 +414,15 @@

;; CHECK: [fuzz-exec] calling slice-big
;; CHECK-NEXT: [fuzz-exec] note result: slice-big => string("defgh")

;; CHECK: [fuzz-exec] calling new_empty
;; CHECK-NEXT: [fuzz-exec] note result: new_empty => string("")

;; CHECK: [fuzz-exec] calling new_empty_oob
;; CHECK-NEXT: [trap array oob]

;; CHECK: [fuzz-exec] calling new_empty_oob_2
;; CHECK-NEXT: [trap array oob]
;; CHECK-NEXT: [fuzz-exec] comparing compare.1
;; CHECK-NEXT: [fuzz-exec] comparing compare.10
;; CHECK-NEXT: [fuzz-exec] comparing compare.2
Expand All @@ -417,6 +444,9 @@
;; CHECK-NEXT: [fuzz-exec] comparing eq.5
;; CHECK-NEXT: [fuzz-exec] comparing get_codeunit
;; CHECK-NEXT: [fuzz-exec] comparing get_length
;; CHECK-NEXT: [fuzz-exec] comparing new_empty
;; CHECK-NEXT: [fuzz-exec] comparing new_empty_oob
;; CHECK-NEXT: [fuzz-exec] comparing new_empty_oob_2
;; CHECK-NEXT: [fuzz-exec] comparing new_wtf16_array
;; CHECK-NEXT: [fuzz-exec] comparing slice
;; CHECK-NEXT: [fuzz-exec] comparing slice-big