Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing, testing infrastructure, and tests for f32 and f64 #104

Merged
merged 10 commits into from
Oct 5, 2015

Conversation

sunfishcode
Copy link
Member

  • support for infinity, NaN with arbitrary bit pattern, and hexadecimal float literals
  • assert_eq_bits and assert_nan for testing floating point results
  • tests for all floating point operators

@sunfishcode sunfishcode force-pushed the float-tests branch 7 times, most recently from 05452e3 to 8d3831a Compare October 2, 2015 04:56
let float = (num '.' digit+) | num ('.' digit+)? ('e' | 'E') num
let float = (num '.' digit+)
| num ('.' digit+)? ('e' | 'E') num
| sign "0x" hexdigit* '.'? hexdigit* 'p' sign digit*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would allow weird things like 0xp or 0x.p to be valid float literals. Is that intended?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No; I've now updated this to require at least one leading significand digit and at least one exponent digit, and added a test for a significand with a trailing dot, as in 0x1.p4.

@rossberg
Copy link
Member

rossberg commented Oct 2, 2015

I would prefer kicking out the existing assert_eq and rename assert_eq_bits to it. There is no good reason to ever use the former. (I feel somewhat strongly about this because we had this very situation in the V8 test suite, which provides both AssertEqual and AssertSame. Everybody was intuitively using the former, because it has the more natural name. At some point we discovered that many tests actually were broken because of this, and not testing what the authors thought they would. And that had been hiding some real bugs in the features being tested.)

@sunfishcode
Copy link
Member Author

Ok. I updated this PR to merge assert_eq and assert_eq_bits into a single assert_same. I think I like that name better than assert_eq_bits because it anticipates possible future types which don't have exposed bitwise representations (GC handles, etc.).

@rossberg
Copy link
Member

rossberg commented Oct 5, 2015

How about naming it assert_return? That would be more analogous to assert_fail, and would avoid the confusion we already saw a couple of times where people expected the assertion to be symmetric, with arbitrary expressions being allowed on either side. (assert_nan should probably be assert_return_nan in that case.)

Support Infinity, NaN with arbitrary bit patterns, and C99-style
hexadecimal floating point literals.
"eq" on floating point types is true for 0 and -0, and false for x and y
when either is NaN. assert_same compares for bit-identical values.
Require hexadecimal float literals to have at least one leading
significand digit and at least one exponent digit. This is consistent
with the C99 syntax.
@sunfishcode
Copy link
Member Author

assert_return and assert_return_nan sound good to me. I updated the PR accordingly.

@rossberg
Copy link
Member

rossberg commented Oct 5, 2015

lgtm

sunfishcode added a commit that referenced this pull request Oct 5, 2015
Parsing, testing infrastructure, and tests for f32 and f64
@sunfishcode sunfishcode merged commit 46e15f1 into master Oct 5, 2015
@sunfishcode sunfishcode deleted the float-tests branch October 5, 2015 15:59
eqrion pushed a commit to eqrion/wasm-spec that referenced this pull request Jul 18, 2019
* Polish table.init exec spec

* table.set and table.init don't have the same imm.

* Update document/core/exec/instructions.rst

Co-Authored-By: Andreas Rossberg <rossberg@mpi-sws.org>
alexcrichton pushed a commit to alexcrichton/spec that referenced this pull request Nov 18, 2019
Clarify that shift count is modulo lane width
rossberg pushed a commit that referenced this pull request Feb 11, 2021
While `linking.wast` tests that we can link modules that are importing and
exporting mutable `externref` globals, there were no tests exercising
`global.{get,set}` on mutable `externref` globals.
dhil pushed a commit to dhil/webassembly-spec that referenced this pull request Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants