tc39 / tc39/test262

Incorrect test: built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js

Open
#757 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.8k
Forks
564
Avg merge
3d 7h
Merged PRs (30d)
10

Description

This test initializes a Float64Array with elements [1, 2, 3, 4, 5, 6, 7, 8]. Then the same buffer is used to create a Float32Array of size 2 (covering only the first element of the Float64Array).
So the binary representation of the Float32Array is the following:

little endian
00 00 00 00 00 00 F0 3F
big endian
3F F0 00 00 00 00 00 00

Then the first element of the Float32Array is assigned the value 42, this results in:

little endian
00 00 28 42 00 00 F0 3F
big endian
42 28 00 00 00 00 00 00

The test relies on little endian architecture, on big endian it always fails as the initial bits are overwritten. Writing 42 to the second element of the Float32Array and adjusting expected values for big endian would make the test pass.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open built-ins/TypedArray/prototype/set/typedarray-arg-set-values-same-buffer-other-type.js and inspect how the shared buffer is initialized and how the expected values are checked. Run this test on little- and big-endian environments; done means the write and expectations pass on both architectures.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.