Skip to content

Commit

Permalink
Add tests for out-of-range NaN payloads.
Browse files Browse the repository at this point in the history
Add `assert_malformed` tests for `f32.const nan:0x800000` and
`f64.const nan:0x10000000000000`, which are malformed since the payload
values are outside the range supported by the types.
  • Loading branch information
sunfishcode committed Jul 11, 2023
1 parent 5b18d52 commit a3f5de0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/core/float_literals.wast
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@
(module quote "(global f32 (f32.const 0x1.0p_+1))")
"unknown operator"
)
(assert_malformed
(module quote "(global f32 (f32.const nan:0x800000))")
"invalid literal"
)

(assert_malformed
(module quote "(global f64 (f64.const _100))")
Expand Down Expand Up @@ -505,3 +509,7 @@
(module quote "(global f64 (f64.const 0x1.0p_+1))")
"unknown operator"
)
(assert_malformed
(module quote "(global f64 (f64.const nan:0x10000000000000))")
"invalid literal"
)

0 comments on commit a3f5de0

Please sign in to comment.