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

test: fix tests on mips #20377

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions test/parallel/test-buffer-writedouble.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ buffer.writeDoubleLE(NaN, 8);
assert.ok(buffer.equals(new Uint8Array([
0x7F, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x7F
// Mips processors use a different NaN.
])) || buffer.equals(new Uint8Array([
Copy link
Member

Choose a reason for hiding this comment

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

Can we detect running on mips and only assert the alternative value if so?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

0x7F, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0x7F
])));

assert.ok(Number.isNaN(buffer.readDoubleBE(0)));
Expand Down
8 changes: 6 additions & 2 deletions test/parallel/test-buffer-writefloat.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ assert.strictEqual(buffer.readFloatLE(4), -Infinity);

buffer.writeFloatBE(NaN, 0);
buffer.writeFloatLE(NaN, 4);
assert.ok(buffer.equals(
new Uint8Array([ 0x7F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x7F ])));
assert.ok(
buffer.equals(new Uint8Array(
[ 0x7F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x7F ])) ||
// Mips processors use a different NaN.
buffer.equals(new Uint8Array(
[ 0x7F, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBF, 0x7F ])));

assert.ok(Number.isNaN(buffer.readFloatBE(0)));
assert.ok(Number.isNaN(buffer.readFloatLE(4)));
Expand Down