summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-02-14 10:30:10 -0800
committerGitHub <noreply@github.com>2024-02-14 10:30:10 -0800
commit5ef1aba98ebff75e29b2c90d8b683b1f0fe1f123 (patch)
treecb1bbc59fb947132b2da46c2a72101e7fc4ce9a8 /test
parentdf3784e3df9744d943016b110e1f92af286cec72 (diff)
downloadbinaryen-5ef1aba98ebff75e29b2c90d8b683b1f0fe1f123.tar.gz
binaryen-5ef1aba98ebff75e29b2c90d8b683b1f0fe1f123.tar.bz2
binaryen-5ef1aba98ebff75e29b2c90d8b683b1f0fe1f123.zip
Strings: Add some interpreter support (#6304)
This adds just enough support to be able to --fuzz-exec a small but realistic fuzz testcase from Java. To that end, just implement the minimal ops we need, which are all related to JS-style strings.
Diffstat (limited to 'test')
-rw-r--r--test/lit/exec/strings.wast31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/lit/exec/strings.wast b/test/lit/exec/strings.wast
index e7e31392a..711d2e36a 100644
--- a/test/lit/exec/strings.wast
+++ b/test/lit/exec/strings.wast
@@ -162,6 +162,29 @@
(string.const "hf")
)
)
+
+ ;; CHECK: [fuzz-exec] calling get_codeunit
+ ;; CHECK-NEXT: [fuzz-exec] note result: get_codeunit => 99
+ (func $get_codeunit (export "get_codeunit") (result i32)
+ ;; Reads 'c' which is code 99.
+ (stringview_wtf16.get_codeunit
+ (string.as_wtf16
+ (string.const "abcdefg")
+ )
+ (i32.const 2)
+ )
+ )
+
+ ;; CHECK: [fuzz-exec] calling get_length
+ ;; CHECK-NEXT: [fuzz-exec] note result: get_length => 7
+ (func $get_length (export "get_length") (result i32)
+ ;; This should return 7.
+ (stringview_wtf16.length
+ (string.as_wtf16
+ (string.const "1234567")
+ )
+ )
+ )
)
;; CHECK: [fuzz-exec] calling new_wtf16_array
;; CHECK-NEXT: [fuzz-exec] note result: new_wtf16_array => string("ello")
@@ -213,6 +236,12 @@
;; CHECK: [fuzz-exec] calling compare.10
;; CHECK-NEXT: [fuzz-exec] note result: compare.10 => -1
+
+;; CHECK: [fuzz-exec] calling get_codeunit
+;; CHECK-NEXT: [fuzz-exec] note result: get_codeunit => 99
+
+;; CHECK: [fuzz-exec] calling get_length
+;; CHECK-NEXT: [fuzz-exec] note result: get_length => 7
;; CHECK-NEXT: [fuzz-exec] comparing compare.1
;; CHECK-NEXT: [fuzz-exec] comparing compare.10
;; CHECK-NEXT: [fuzz-exec] comparing compare.2
@@ -229,4 +258,6 @@
;; CHECK-NEXT: [fuzz-exec] comparing eq.3
;; CHECK-NEXT: [fuzz-exec] comparing eq.4
;; 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_wtf16_array