From 83c77e56bf6df30f40c41282ba448df0d516e035 Mon Sep 17 00:00:00 2001 From: Uday Kakade Date: Fri, 13 Jun 2025 22:59:13 +0530 Subject: [PATCH 01/12] add assert/has-float16array-support --- .../assert/has-float16array-support/README.md | 123 +++++++++++++ .../benchmark/benchmark.js | 49 ++++++ .../assert/has-float16array-support/bin/cli | 60 +++++++ .../has-float16array-support/docs/repl.txt | 17 ++ .../docs/types/index.d.ts | 35 ++++ .../docs/types/test.ts | 33 ++++ .../has-float16array-support/docs/usage.txt | 8 + .../etc/cli_opts.json | 14 ++ .../examples/index.js | 28 +++ .../lib/float16array.js | 28 +++ .../has-float16array-support/lib/index.js | 40 +++++ .../has-float16array-support/lib/main.js | 65 +++++++ .../has-float16array-support/package.json | 74 ++++++++ .../has-float16array-support/test/test.cli.js | 162 ++++++++++++++++++ .../has-float16array-support/test/test.js | 134 +++++++++++++++ 15 files changed, 870 insertions(+) create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/README.md create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/bin/cli create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/docs/usage.txt create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/etc/cli_opts.json create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/examples/index.js create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/lib/index.js create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/package.json create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/test/test.cli.js create mode 100644 lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/README.md b/lib/node_modules/@stdlib/assert/has-float16array-support/README.md new file mode 100644 index 000000000000..59de7eb9710f --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/README.md @@ -0,0 +1,123 @@ + + +# Float16Array Support + +> Detect native [`Float16Array`][mdn-float16array] support. + +
+ +## Usage + +```javascript +var hasFloat16ArraySupport = require( '@stdlib/assert/has-float16array-support' ); +``` + +#### hasFloat16ArraySupport() + +Detects if a runtime environment supports [`Float16Array`][mdn-float16array]. + +```javascript +var bool = hasFloat16ArraySupport(); +// returns +``` + +
+ + + +
+ +## Examples + + + +```javascript +var hasFloat16ArraySupport = require( '@stdlib/assert/has-float16array-support' ); + +var bool = hasFloat16ArraySupport(); +if ( bool ) { + console.log( 'Environment has Float16Array support.' ); +} else { + console.log( 'Environment lacks Float16Array support.' ); +} +``` + +
+ + + +* * * + +
+ +## CLI + +
+ +### Usage + +```text +Usage: has-float32array-support [options] + +Options: + + -h, --help Print this message. + -V, --version Print the package version. +``` + +
+ + + +
+ +### Examples + +```bash +$ has-float16array-support + +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/benchmark/benchmark.js b/lib/node_modules/@stdlib/assert/has-float16array-support/benchmark/benchmark.js new file mode 100644 index 000000000000..9808661f514b --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/benchmark/benchmark.js @@ -0,0 +1,49 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; +var pkg = require( './../package.json' ).name; +var hasFloat16ArraySupport = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var bool; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + // Note: the following *could* be optimized away via loop-invariant code motion. If so, the entire loop will disappear. + bool = hasFloat16ArraySupport(); + if ( typeof bool !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( !isBoolean( bool ) ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/bin/cli b/lib/node_modules/@stdlib/assert/has-float16array-support/bin/cli new file mode 100644 index 000000000000..8520ae55bf89 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/bin/cli @@ -0,0 +1,60 @@ +#!/usr/bin/env node + +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var readFileSync = require( '@stdlib/fs/read-file' ).sync; +var CLI = require( '@stdlib/cli/ctor' ); +var detect = require( './../lib' ); + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var flags; + var cli; + + // Create a command-line interface: + cli = new CLI({ + 'pkg': require( './../package.json' ), + 'options': require( './../etc/cli_opts.json' ), + 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { + 'encoding': 'utf8' + }) + }); + + // Get any provided command-line options: + flags = cli.flags(); + if ( flags.help || flags.version ) { + return; + } + + console.log( detect() ); // eslint-disable-line no-console +} + +main(); diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/docs/repl.txt b/lib/node_modules/@stdlib/assert/has-float16array-support/docs/repl.txt new file mode 100644 index 000000000000..f1a03da90e60 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/docs/repl.txt @@ -0,0 +1,17 @@ + +{{alias}}() + Tests for native `Float16Array` support. + + Returns + ------- + bool: boolean + Boolean indicating if an environment has `Float16Array` support. + + Examples + -------- + > var bool = {{alias}}() + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/docs/types/index.d.ts b/lib/node_modules/@stdlib/assert/has-float16array-support/docs/types/index.d.ts new file mode 100644 index 000000000000..144600c2139f --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/docs/types/index.d.ts @@ -0,0 +1,35 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/** +* Tests for native `Float16Array` support. +* +* @returns boolean indicating if an environment has `Float16Array` support +* +* @example +* var bool = hasFloat16ArraySupport(); +* // returns +*/ +declare function hasFloat16ArraySupport(): boolean; + + +// EXPORTS // + +export = hasFloat16ArraySupport; diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/docs/types/test.ts b/lib/node_modules/@stdlib/assert/has-float16array-support/docs/types/test.ts new file mode 100644 index 000000000000..73e758e17015 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/docs/types/test.ts @@ -0,0 +1,33 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import hasFloat16ArraySupport = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + hasFloat16ArraySupport(); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided arguments... +{ + hasFloat16ArraySupport( true ); // $ExpectError + hasFloat16ArraySupport( [], 123 ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/docs/usage.txt b/lib/node_modules/@stdlib/assert/has-float16array-support/docs/usage.txt new file mode 100644 index 000000000000..a982ba896460 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/docs/usage.txt @@ -0,0 +1,8 @@ + +Usage: has-float16array-support [options] + +Options: + + -h, --help Print this message. + -V, --version Print the package version. + diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/etc/cli_opts.json b/lib/node_modules/@stdlib/assert/has-float16array-support/etc/cli_opts.json new file mode 100644 index 000000000000..f245a17e6317 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/etc/cli_opts.json @@ -0,0 +1,14 @@ +{ + "boolean": [ + "help", + "version" + ], + "alias": { + "help": [ + "h" + ], + "version": [ + "V" + ] + } +} diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/examples/index.js b/lib/node_modules/@stdlib/assert/has-float16array-support/examples/index.js new file mode 100644 index 000000000000..b316e6ad9628 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/examples/index.js @@ -0,0 +1,28 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var hasFloat16ArraySupport = require( './../lib' ); + +var bool = hasFloat16ArraySupport(); +if ( bool ) { + console.log( 'Environment has Float16Array support.' ); +} else { + console.log( 'Environment lacks Float16Array support.' ); +} diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js new file mode 100644 index 000000000000..3661839e7f33 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js @@ -0,0 +1,28 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MAIN // + +var main = ( typeof Float16Array === 'function' ) ? Float16Array : null; // eslint-disable-line stdlib/require-globals + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/index.js b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/index.js new file mode 100644 index 000000000000..5683c7d5c597 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test for native `Float16Array` support. +* +* @module @stdlib/assert/has-float16array-support +* +* @example +* var hasFloat16ArraySupport = require( '@stdlib/assert/has-float16array-support' ); +* +* var bool = hasFloat16ArraySupport(); +* // returns +*/ + +// MODULES // + +var hasFloat16ArraySupport = require( './main.js' ); + + +// EXPORTS // + +module.exports = hasFloat16ArraySupport; \ No newline at end of file diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js new file mode 100644 index 000000000000..e5d7be81de05 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js @@ -0,0 +1,65 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isFloat16Array = require( '@stdlib/assert/is-float16array' ); +var PINF = require( '@stdlib/constants/float64/pinf' ); +var GlobalFloat16Array = require( './float16array.js' ); + + +// MAIN // + +/** +* Tests for native `Float16Array` support. +* +* @returns {boolean} boolean indicating if an environment has `Float16Array` support +* +* @example +* var bool = hasFloat16ArraySupport(); +* // returns +*/ +function hasFloat16ArraySupport() { + var bool; + var arr; + + if ( typeof GlobalFloat16Array !== 'function' ) { + return false; + } + // Test basic support... + try { + arr = new GlobalFloat16Array( [ 1.0, 3.14, -3.14, 5.0e40 ] ); + bool = ( + isFloat16Array( arr ) && + arr[ 0 ] === 1.0 && + arr[ 1 ] !== 3.14 && + arr[ 2 ] !== -3.14 && + arr[ 3 ] === PINF + ); + } catch ( err ) { // eslint-disable-line no-unused-vars + bool = false; + } + return bool; +} + + +// EXPORTS // + +module.exports = hasFloat16ArraySupport; diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/package.json b/lib/node_modules/@stdlib/assert/has-float16array-support/package.json new file mode 100644 index 000000000000..d51f6a8c2485 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/package.json @@ -0,0 +1,74 @@ +{ + "name": "@stdlib/assert/has-float16array-support", + "version": "0.0.0", + "description": "Detect native Float16Array support.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "bin": { + "has-float16array-support": "./bin/cli" + }, + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdutils", + "stdutil", + "utilities", + "utility", + "utils", + "util", + "detect", + "feature", + "float16array", + "es2022", + "typed array", + "typed-array", + "support", + "has", + "native", + "issupported", + "cli" + ] +} diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.cli.js b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.cli.js new file mode 100644 index 000000000000..bbfbb40255b2 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.cli.js @@ -0,0 +1,162 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var resolve = require( 'path' ).resolve; +var exec = require( 'child_process' ).exec; +var tape = require( 'tape' ); +var IS_BROWSER = require( '@stdlib/assert/is-browser' ); +var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); +var EXEC_PATH = require( '@stdlib/process/exec-path' ); +var readFileSync = require( '@stdlib/fs/read-file' ).sync; + + +// VARIABLES // + +var fpath = resolve( __dirname, '..', 'bin', 'cli' ); +var opts = { + 'skip': IS_BROWSER || IS_WINDOWS +}; + + +// FIXTURES // + +var PKG_VERSION = require( './../package.json' ).version; + + +// TESTS // + +tape( 'command-line interface', function test( t ) { + t.ok( true, __filename ); + t.end(); +}); + +tape( 'when invoked with a `--help` flag, the CLI prints the help text to `stderr`', opts, function test( t ) { + var expected; + var cmd; + + expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { + 'encoding': 'utf8' + }); + cmd = [ + EXEC_PATH, + fpath, + '--help' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), expected+'\n', 'prints expected help text' ); + } + t.end(); + } +}); + +tape( 'when invoked with a `-h` flag, the CLI prints the help text to `stderr`', opts, function test( t ) { + var expected; + var cmd; + + expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { + 'encoding': 'utf8' + }); + cmd = [ + EXEC_PATH, + fpath, + '-h' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), expected+'\n', 'prints expected help text' ); + } + t.end(); + } +}); + +tape( 'when invoked with a `--version` flag, the CLI prints the version to `stderr`', opts, function test( t ) { + var cmd = [ + EXEC_PATH, + fpath, + '--version' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'prints version to `stderr`' ); + } + t.end(); + } +}); + +tape( 'when invoked with a `-V` flag, the CLI prints the version to `stderr`', opts, function test( t ) { + var cmd = [ + EXEC_PATH, + fpath, + '-V' + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); + t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'prints version to `stderr`' ); + } + t.end(); + } +}); + +tape( 'the CLI prints either `true` or `false` to `stdout` indicating native `Float16Array` support', opts, function test( t ) { + var cmd = [ + EXEC_PATH, + fpath + ]; + + exec( cmd.join( ' ' ), done ); + + function done( error, stdout, stderr ) { + var out = stdout.toString(); + if ( error ) { + t.fail( error.message ); + } else { + t.strictEqual( out === 'true\n' || out === 'false\n', true, 'prints either `true` or `false` to `stdout`' ); + t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); + } + t.end(); + } +}); diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js new file mode 100644 index 000000000000..a149e1ef8642 --- /dev/null +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js @@ -0,0 +1,134 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require('tape'); +var proxyquire = require('proxyquire'); +var Number = require('@stdlib/number/ctor'); +var detect = require('./../lib'); + + +// VARIABLES // + +var hasFloat16Array = (typeof Float16Array === 'function'); + +var opts = { + skip: !hasFloat16Array +}; + + +// TESTS // + +tape('main export is a function', function test(t) { + t.ok(true, __filename); + t.strictEqual(typeof detect, 'function', 'main export is a function'); + t.end(); +}); + +tape('feature detection result is a boolean', function test(t) { + t.strictEqual(typeof detect(), 'boolean', 'detection result is a boolean'); + t.end(); +}); + +tape('if `Float16Array` is supported, detection result is `true`', opts, function test(t) { + t.strictEqual(detect(), true, 'detection result is `true`'); + + var mocked = proxyquire('./../lib/main.js', { + './float16array.js': Mock, + '@stdlib/assert/is-float16array': isArray + }); + t.strictEqual(mocked(), true, 'detection result is `true` (mocked)'); + + t.end(); + + function isArray() { + return true; + } + + function Mock() { + return [ + 1.0, + 0.333251953125, + -0.333251953125, + Number.POSITIVE_INFINITY + ]; + } +}); + +tape('if `Float16Array` is not supported, detection result is `false`', function test(t) { + if (hasFloat16Array) { + t.strictEqual(detect(), true, 'detection result is `true`'); + } else { + t.strictEqual(detect(), false, 'detection result is `false`'); + } + + var mocked = proxyquire('./../lib/main.js', { + './float16array.js': {} + }); + t.strictEqual(mocked(), false, 'detection result is `false`'); + + mocked = proxyquire('./../lib/main.js', { + './float16array.js': Mock1 + }); + t.strictEqual(mocked(), false, 'detection result is `false`'); + + mocked = proxyquire('./../lib/main.js', { + './float16array.js': Mock2, + '@stdlib/assert/is-float16array': isArray + }); + t.strictEqual(mocked(), false, 'detection result is `false`'); + + mocked = proxyquire('./../lib/main.js', { + './float16array.js': Mock3, + '@stdlib/assert/is-float16array': isArray + }); + t.strictEqual(mocked(), false, 'detection result is `false`'); + + mocked = proxyquire('./../lib/main.js', { + './float16array.js': Mock4 + }); + t.strictEqual(mocked(), false, 'detection result is `false`'); + + t.end(); + + function isArray() { + return true; + } + + function Mock1() { + // Not a typed array: + return []; + } + + function Mock2() { + // Does not lose precision... + return [1.0, 3.14, -3.14, Number.POSITIVE_INFINITY]; + } + + function Mock3() { + // Does not overflow... + return [1.0, 0.333251953125, -0.333251953125, 5.0e40]; + } + + function Mock4() { + throw new Error('beep'); + } +}); From a069b91f5b64ab1b982e2ca224be1b117659d36d Mon Sep 17 00:00:00 2001 From: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> Date: Fri, 13 Jun 2025 23:14:21 +0530 Subject: [PATCH 02/12] Removed extra line at the end of code in index.js Signed-off-by: Uday Kakade <141299403+udaykakade25@users.noreply.github.com> --- .../@stdlib/assert/has-float16array-support/lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/index.js b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/index.js index 5683c7d5c597..528001f17292 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/index.js +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/index.js @@ -37,4 +37,4 @@ var hasFloat16ArraySupport = require( './main.js' ); // EXPORTS // -module.exports = hasFloat16ArraySupport; \ No newline at end of file +module.exports = hasFloat16ArraySupport; From 9437b82acbe890f7304fa53c8cb1e0f8235e3dd4 Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Tue, 8 Jul 2025 07:34:28 +0000 Subject: [PATCH 03/12] fix: resolve lint errors --- .../lib/float16array.js | 2 +- .../has-float16array-support/test/test.js | 178 +++++++++--------- 2 files changed, 90 insertions(+), 90 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js index 3661839e7f33..34e705fb9c1d 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js @@ -20,7 +20,7 @@ // MAIN // -var main = ( typeof Float16Array === 'function' ) ? Float16Array : null; // eslint-disable-line stdlib/require-globals +var main = ( typeof Float16Array === 'function' ) ? Float16Array : null; // EXPORTS // diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js index a149e1ef8642..505e2e96f785 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js @@ -20,10 +20,10 @@ // MODULES // -var tape = require('tape'); -var proxyquire = require('proxyquire'); -var Number = require('@stdlib/number/ctor'); -var detect = require('./../lib'); +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var Number = require( '@stdlib/number/ctor' ); +var detect = require( './../lib' ); // VARIABLES // @@ -31,104 +31,104 @@ var detect = require('./../lib'); var hasFloat16Array = (typeof Float16Array === 'function'); var opts = { - skip: !hasFloat16Array + skip: !hasFloat16Array }; // TESTS // tape('main export is a function', function test(t) { - t.ok(true, __filename); - t.strictEqual(typeof detect, 'function', 'main export is a function'); - t.end(); + t.ok(true, __filename); + t.strictEqual(typeof detect, 'function', 'main export is a function'); + t.end(); }); tape('feature detection result is a boolean', function test(t) { - t.strictEqual(typeof detect(), 'boolean', 'detection result is a boolean'); - t.end(); + t.strictEqual(typeof detect(), 'boolean', 'detection result is a boolean'); + t.end(); }); tape('if `Float16Array` is supported, detection result is `true`', opts, function test(t) { - t.strictEqual(detect(), true, 'detection result is `true`'); - - var mocked = proxyquire('./../lib/main.js', { - './float16array.js': Mock, - '@stdlib/assert/is-float16array': isArray - }); - t.strictEqual(mocked(), true, 'detection result is `true` (mocked)'); - - t.end(); - - function isArray() { - return true; - } - - function Mock() { - return [ - 1.0, - 0.333251953125, - -0.333251953125, - Number.POSITIVE_INFINITY - ]; - } + t.strictEqual(detect(), true, 'detection result is `true`'); + + var mocked = proxyquire('./../lib/main.js', { + './float16array.js': Mock, + '@stdlib/assert/is-float16array': isArray + }); + t.strictEqual(mocked(), true, 'detection result is `true` (mocked)'); + + t.end(); + + function isArray() { + return true; + } + + function Mock() { + return [ + 1.0, + 0.333251953125, + -0.333251953125, + Number.POSITIVE_INFINITY + ]; + } }); tape('if `Float16Array` is not supported, detection result is `false`', function test(t) { - if (hasFloat16Array) { - t.strictEqual(detect(), true, 'detection result is `true`'); - } else { - t.strictEqual(detect(), false, 'detection result is `false`'); - } - - var mocked = proxyquire('./../lib/main.js', { - './float16array.js': {} - }); - t.strictEqual(mocked(), false, 'detection result is `false`'); - - mocked = proxyquire('./../lib/main.js', { - './float16array.js': Mock1 - }); - t.strictEqual(mocked(), false, 'detection result is `false`'); - - mocked = proxyquire('./../lib/main.js', { - './float16array.js': Mock2, - '@stdlib/assert/is-float16array': isArray - }); - t.strictEqual(mocked(), false, 'detection result is `false`'); - - mocked = proxyquire('./../lib/main.js', { - './float16array.js': Mock3, - '@stdlib/assert/is-float16array': isArray - }); - t.strictEqual(mocked(), false, 'detection result is `false`'); - - mocked = proxyquire('./../lib/main.js', { - './float16array.js': Mock4 - }); - t.strictEqual(mocked(), false, 'detection result is `false`'); - - t.end(); - - function isArray() { - return true; - } - - function Mock1() { - // Not a typed array: - return []; - } - - function Mock2() { - // Does not lose precision... - return [1.0, 3.14, -3.14, Number.POSITIVE_INFINITY]; - } - - function Mock3() { - // Does not overflow... - return [1.0, 0.333251953125, -0.333251953125, 5.0e40]; - } - - function Mock4() { - throw new Error('beep'); - } + if (hasFloat16Array) { + t.strictEqual(detect(), true, 'detection result is `true`'); + } else { + t.strictEqual(detect(), false, 'detection result is `false`'); + } + + var mocked = proxyquire('./../lib/main.js', { + './float16array.js': {} + }); + t.strictEqual(mocked(), false, 'detection result is `false`'); + + mocked = proxyquire('./../lib/main.js', { + './float16array.js': Mock1 + }); + t.strictEqual(mocked(), false, 'detection result is `false`'); + + mocked = proxyquire('./../lib/main.js', { + './float16array.js': Mock2, + '@stdlib/assert/is-float16array': isArray + }); + t.strictEqual(mocked(), false, 'detection result is `false`'); + + mocked = proxyquire('./../lib/main.js', { + './float16array.js': Mock3, + '@stdlib/assert/is-float16array': isArray + }); + t.strictEqual(mocked(), false, 'detection result is `false`'); + + mocked = proxyquire('./../lib/main.js', { + './float16array.js': Mock4 + }); + t.strictEqual(mocked(), false, 'detection result is `false`'); + + t.end(); + + function isArray() { + return true; + } + + function Mock1() { + // Not a typed array: + return []; + } + + function Mock2() { + // Does not lose precision... + return [1.0, 3.14, -3.14, Number.POSITIVE_INFINITY]; + } + + function Mock3() { + // Does not overflow... + return [1.0, 0.333251953125, -0.333251953125, 5.0e40]; + } + + function Mock4() { + throw new Error('beep'); + } }); From 89a0e42ee58a426661021ccf385d6f1aaf273b84 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 8 Jul 2025 01:08:44 -0700 Subject: [PATCH 04/12] docs: fix command name Signed-off-by: Athan --- .../@stdlib/assert/has-float16array-support/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/README.md b/lib/node_modules/@stdlib/assert/has-float16array-support/README.md index 59de7eb9710f..1e0745943641 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/README.md +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/README.md @@ -75,7 +75,7 @@ if ( bool ) { ### Usage ```text -Usage: has-float32array-support [options] +Usage: has-float16array-support [options] Options: From f7193623fc77153d2328219e4c190a7a532bc967 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 8 Jul 2025 01:11:02 -0700 Subject: [PATCH 05/12] docs: add TODO Signed-off-by: Athan --- .../@stdlib/assert/has-float16array-support/lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js index e5d7be81de05..94445e799009 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFloat16Array = require( '@stdlib/assert/is-float16array' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); +var PINF = require( '@stdlib/constants/float64/pinf' ); // TODO: replace with `constants/float16/pinf` var GlobalFloat16Array = require( './float16array.js' ); From 4f08be9adacd35fd341e398032980d5a4c62bdb7 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 8 Jul 2025 01:12:54 -0700 Subject: [PATCH 06/12] docs: disable lint rule Signed-off-by: Athan --- .../@stdlib/assert/has-float16array-support/lib/float16array.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js index 34e705fb9c1d..3661839e7f33 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js @@ -20,7 +20,7 @@ // MAIN // -var main = ( typeof Float16Array === 'function' ) ? Float16Array : null; +var main = ( typeof Float16Array === 'function' ) ? Float16Array : null; // eslint-disable-line stdlib/require-globals // EXPORTS // From 7883e13f7af8e5f492c248532f88719b87e6b34d Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 8 Jul 2025 01:13:50 -0700 Subject: [PATCH 07/12] fix: avoid rounding errors Signed-off-by: Athan --- .../@stdlib/assert/has-float16array-support/lib/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js index 94445e799009..6188e2c10646 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js @@ -45,12 +45,12 @@ function hasFloat16ArraySupport() { } // Test basic support... try { - arr = new GlobalFloat16Array( [ 1.0, 3.14, -3.14, 5.0e40 ] ); + arr = new GlobalFloat16Array( [ 1.0, 3.0, -3.0, 5.0e40 ] ); bool = ( isFloat16Array( arr ) && arr[ 0 ] === 1.0 && - arr[ 1 ] !== 3.14 && - arr[ 2 ] !== -3.14 && + arr[ 1 ] !== 3.0 && + arr[ 2 ] !== -3.0 && arr[ 3 ] === PINF ); } catch ( err ) { // eslint-disable-line no-unused-vars From c329c0772b738ed0dfafb0a5c4e92cb8aa3ec071 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 8 Jul 2025 01:14:27 -0700 Subject: [PATCH 08/12] chore: fix keyword Signed-off-by: Athan --- .../@stdlib/assert/has-float16array-support/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/package.json b/lib/node_modules/@stdlib/assert/has-float16array-support/package.json index d51f6a8c2485..db270955f1a3 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/package.json +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/package.json @@ -62,7 +62,7 @@ "detect", "feature", "float16array", - "es2022", + "es2025", "typed array", "typed-array", "support", From 96450a299babbd3e8d9c3201442dccab3cfb8af9 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 8 Jul 2025 01:29:04 -0700 Subject: [PATCH 09/12] chore: resolve style issues and clean-up --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../has-float16array-support/test/test.js | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js index 505e2e96f785..6b9b9cc7e9d5 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js @@ -28,34 +28,34 @@ var detect = require( './../lib' ); // VARIABLES // -var hasFloat16Array = (typeof Float16Array === 'function'); - -var opts = { - skip: !hasFloat16Array -}; +var hasFloat16Array = ( typeof Float16Array === 'function' ); // eslint-disable-line stdlib/require-globals // TESTS // -tape('main export is a function', function test(t) { - t.ok(true, __filename); - t.strictEqual(typeof detect, 'function', 'main export is a function'); +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof detect, 'function', 'main export is a function' ); t.end(); }); -tape('feature detection result is a boolean', function test(t) { - t.strictEqual(typeof detect(), 'boolean', 'detection result is a boolean'); +tape( 'feature detection result is a boolean', function test( t ) { + t.strictEqual( typeof detect(), 'boolean', 'detection result is a boolean' ); t.end(); }); -tape('if `Float16Array` is supported, detection result is `true`', opts, function test(t) { - t.strictEqual(detect(), true, 'detection result is `true`'); - - var mocked = proxyquire('./../lib/main.js', { +tape( 'if `Float16Array` is supported, detection result is `true`', function test( t ) { + var mocked; + if ( hasFloat16Array ) { + t.strictEqual( detect(), true, 'detection result is `true`' ); + } else { + t.strictEqual( detect(), false, 'detection result is `false`' ); + } + mocked = proxyquire( './../lib/main.js', { './float16array.js': Mock, '@stdlib/assert/is-float16array': isArray }); - t.strictEqual(mocked(), true, 'detection result is `true` (mocked)'); + t.strictEqual( mocked(), true, 'detection result is `true` (mocked)' ); t.end(); @@ -66,46 +66,46 @@ tape('if `Float16Array` is supported, detection result is `true`', opts, functio function Mock() { return [ 1.0, - 0.333251953125, - -0.333251953125, + 3.0, + -3.0, Number.POSITIVE_INFINITY ]; } }); -tape('if `Float16Array` is not supported, detection result is `false`', function test(t) { - if (hasFloat16Array) { - t.strictEqual(detect(), true, 'detection result is `true`'); +tape( 'if `Float16Array` is not supported, detection result is `false`', function test( t ) { + var mocked; + if ( hasFloat16Array ) { + t.strictEqual( detect(), true, 'detection result is `true`' ); } else { - t.strictEqual(detect(), false, 'detection result is `false`'); + t.strictEqual( detect(), false, 'detection result is `false`' ); } - - var mocked = proxyquire('./../lib/main.js', { + mocked = proxyquire( './../lib/main.js', { './float16array.js': {} }); - t.strictEqual(mocked(), false, 'detection result is `false`'); + t.strictEqual( mocked(), false, 'detection result is `false`' ); - mocked = proxyquire('./../lib/main.js', { + mocked = proxyquire( './../lib/main.js', { './float16array.js': Mock1 }); - t.strictEqual(mocked(), false, 'detection result is `false`'); + t.strictEqual( mocked(), false, 'detection result is `false`' ); - mocked = proxyquire('./../lib/main.js', { + mocked = proxyquire( './../lib/main.js', { './float16array.js': Mock2, '@stdlib/assert/is-float16array': isArray }); - t.strictEqual(mocked(), false, 'detection result is `false`'); + t.strictEqual( mocked(), false, 'detection result is `false`' ); - mocked = proxyquire('./../lib/main.js', { + mocked = proxyquire( './../lib/main.js', { './float16array.js': Mock3, '@stdlib/assert/is-float16array': isArray }); - t.strictEqual(mocked(), false, 'detection result is `false`'); + t.strictEqual( mocked(), false, 'detection result is `false`' ); - mocked = proxyquire('./../lib/main.js', { + mocked = proxyquire( './../lib/main.js', { './float16array.js': Mock4 }); - t.strictEqual(mocked(), false, 'detection result is `false`'); + t.strictEqual( mocked(), false, 'detection result is `false`' ); t.end(); @@ -120,15 +120,15 @@ tape('if `Float16Array` is not supported, detection result is `false`', function function Mock2() { // Does not lose precision... - return [1.0, 3.14, -3.14, Number.POSITIVE_INFINITY]; + return [ 1.0, 3.0, -3.0, Number.POSITIVE_INFINITY ]; } function Mock3() { // Does not overflow... - return [1.0, 0.333251953125, -0.333251953125, 5.0e40]; + return [ 1.0, 0.0, -0.0, 5.0e40 ]; } function Mock4() { - throw new Error('beep'); + throw new Error( 'beep' ); } }); From fe9d362fa59b7b8fea870f8b591a3add2272887f Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 8 Jul 2025 01:30:58 -0700 Subject: [PATCH 10/12] test: fix test case --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/assert/has-float16array-support/test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js index 6b9b9cc7e9d5..9e0406f931f8 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js @@ -125,7 +125,7 @@ tape( 'if `Float16Array` is not supported, detection result is `false`', functio function Mock3() { // Does not overflow... - return [ 1.0, 0.0, -0.0, 5.0e40 ]; + return [ 1.0, 3.0, -3.0, 5.0e40 ]; } function Mock4() { From 154bad36d13ef2205da0ddf9792b7858a731e5e7 Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 8 Jul 2025 01:32:53 -0700 Subject: [PATCH 11/12] style: disable lint rule --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/assert/has-float16array-support/lib/float16array.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js index 3661839e7f33..816539c5a43d 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js @@ -20,7 +20,7 @@ // MAIN // -var main = ( typeof Float16Array === 'function' ) ? Float16Array : null; // eslint-disable-line stdlib/require-globals +var main = ( typeof Float16Array === 'function' ) ? Float16Array : null; // eslint-disable-line no-undef, stdlib/require-globals // EXPORTS // From 98a7f4e0d88799b9389c4578a580121a585d76da Mon Sep 17 00:00:00 2001 From: Athan Date: Tue, 8 Jul 2025 01:40:53 -0700 Subject: [PATCH 12/12] fix: resolve failing tests --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../@stdlib/assert/has-float16array-support/lib/main.js | 6 +++--- .../@stdlib/assert/has-float16array-support/test/test.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js index 6188e2c10646..94445e799009 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/lib/main.js @@ -45,12 +45,12 @@ function hasFloat16ArraySupport() { } // Test basic support... try { - arr = new GlobalFloat16Array( [ 1.0, 3.0, -3.0, 5.0e40 ] ); + arr = new GlobalFloat16Array( [ 1.0, 3.14, -3.14, 5.0e40 ] ); bool = ( isFloat16Array( arr ) && arr[ 0 ] === 1.0 && - arr[ 1 ] !== 3.0 && - arr[ 2 ] !== -3.0 && + arr[ 1 ] !== 3.14 && + arr[ 2 ] !== -3.14 && arr[ 3 ] === PINF ); } catch ( err ) { // eslint-disable-line no-unused-vars diff --git a/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js index 9e0406f931f8..6c766f2b7edd 100644 --- a/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js +++ b/lib/node_modules/@stdlib/assert/has-float16array-support/test/test.js @@ -120,12 +120,12 @@ tape( 'if `Float16Array` is not supported, detection result is `false`', functio function Mock2() { // Does not lose precision... - return [ 1.0, 3.0, -3.0, Number.POSITIVE_INFINITY ]; + return [ 1.0, 3.14, -3.14, Number.POSITIVE_INFINITY ]; } function Mock3() { // Does not overflow... - return [ 1.0, 3.0, -3.0, 5.0e40 ]; + return [ 1.0, 3.140625, -3.140625, 5.0e40 ]; } function Mock4() {