-
-
Notifications
You must be signed in to change notification settings - Fork 498
test: add ability to control experimental tests #350
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
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
615d54f
test: add ability to control experimental tests
mhdawson 1cb7bf3
squash: fix typo
mhdawson 74a1b18
squash: fix typo
mhdawson bd1f715
squash: guard using NAPI_VERSION
mhdawson 30479db
squash: add missing guard
mhdawson a568284
squash: fixup
mhdawson 24ce107
squash: fix up js side detection
mhdawson a13f93d
squash: refactor biging typedarray testing
mhdawson 6ebe43f
squash: address comments
mhdawson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| 'use strict'; | ||
| const buildType = process.config.target_defaults.default_configuration; | ||
| const assert = require('assert'); | ||
|
|
||
| test(require(`./build/${buildType}/binding.node`)); | ||
| test(require(`./build/${buildType}/binding_noexcept.node`)); | ||
|
|
||
| function test(binding) { | ||
| [ | ||
| ['bigint64', BigInt64Array], | ||
| ['biguint64', BigUint64Array], | ||
| ].forEach(([type, Constructor]) => { | ||
| try { | ||
| const length = 4; | ||
| const t = binding.typedarray.createTypedArray(type, length); | ||
| assert.ok(t instanceof Constructor); | ||
| assert.strictEqual(binding.typedarray.getTypedArrayType(t), type); | ||
| assert.strictEqual(binding.typedarray.getTypedArrayLength(t), length); | ||
|
|
||
| t[3] = 11n; | ||
| assert.strictEqual(binding.typedarray.getTypedArrayElement(t, 3), 11n); | ||
| binding.typedarray.setTypedArrayElement(t, 3, 22n); | ||
| assert.strictEqual(binding.typedarray.getTypedArrayElement(t, 3), 22n); | ||
| assert.strictEqual(t[3], 22n); | ||
|
|
||
| const b = binding.typedarray.getTypedArrayBuffer(t); | ||
| assert.ok(b instanceof ArrayBuffer); | ||
| } catch (e) { | ||
| console.log(type, Constructor); | ||
| throw e; | ||
| } | ||
|
|
||
| try { | ||
| const length = 4; | ||
| const offset = 8; | ||
| const b = new ArrayBuffer(offset + 64 * 4); | ||
|
|
||
| const t = binding.typedarray.createTypedArray(type, length, b, offset); | ||
| assert.ok(t instanceof Constructor); | ||
| assert.strictEqual(binding.typedarray.getTypedArrayType(t), type); | ||
| assert.strictEqual(binding.typedarray.getTypedArrayLength(t), length); | ||
|
|
||
| t[3] = 11n; | ||
| assert.strictEqual(binding.typedarray.getTypedArrayElement(t, 3), 11n); | ||
| binding.typedarray.setTypedArrayElement(t, 3, 22n); | ||
| assert.strictEqual(binding.typedarray.getTypedArrayElement(t, 3), 22n); | ||
| assert.strictEqual(t[3], 22n); | ||
|
|
||
| assert.strictEqual(binding.typedarray.getTypedArrayBuffer(t), b); | ||
| } catch (e) { | ||
| console.log(type, Constructor); | ||
| throw e; | ||
| } | ||
| }); | ||
|
|
||
| assert.throws(() => { | ||
| binding.typedarray.createInvalidTypedArray(); | ||
| }, /Invalid (pointer passed as )?argument/); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.