Skip to content

Commit 8e4f613

Browse files
authored
[test] Add more array.fill cases (#1998)
1 parent 2246e8b commit 8e4f613

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/core/gc/array_fill.wast

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,22 @@
7979
(assert_return (invoke "array_get_nth" (i32.const 2)) (i32.const 11))
8080
(assert_return (invoke "array_get_nth" (i32.const 3)) (i32.const 11))
8181
(assert_return (invoke "array_get_nth" (i32.const 4)) (i32.const 0))
82+
83+
;; fill the whole array
84+
(assert_return (invoke "array_fill" (i32.const 0) (i32.const 42) (i32.const 12)))
85+
(assert_return (invoke "array_get_nth" (i32.const 0)) (i32.const 42))
86+
(assert_return (invoke "array_get_nth" (i32.const 2)) (i32.const 42))
87+
(assert_return (invoke "array_get_nth" (i32.const 5)) (i32.const 42))
88+
(assert_return (invoke "array_get_nth" (i32.const 11)) (i32.const 42))
89+
90+
;; fill the first element
91+
(assert_return (invoke "array_fill" (i32.const 0) (i32.const 7) (i32.const 1)))
92+
(assert_return (invoke "array_get_nth" (i32.const 0)) (i32.const 7))
93+
(assert_return (invoke "array_get_nth" (i32.const 1)) (i32.const 42))
94+
(assert_return (invoke "array_get_nth" (i32.const 11)) (i32.const 42))
95+
96+
;; fill the last 2 elements
97+
(assert_return (invoke "array_fill" (i32.const 10) (i32.const 9) (i32.const 2)))
98+
(assert_return (invoke "array_get_nth" (i32.const 9)) (i32.const 42))
99+
(assert_return (invoke "array_get_nth" (i32.const 10)) (i32.const 9))
100+
(assert_return (invoke "array_get_nth" (i32.const 11)) (i32.const 9))

0 commit comments

Comments
 (0)