From 3a51051c9c3fc03ec0357d39841a5d7291b3c6fc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 3 Dec 2024 14:09:15 +0000 Subject: [PATCH] Auto-generated commit --- CHANGELOG.md | 4 +- fixed-endian-factory/README.md | 121 ++++++++-------- .../benchmark/benchmark.join.length.js | 3 +- ...index-of.js => benchmark.last_index_of.js} | 0 ...h.js => benchmark.last_index_of.length.js} | 0 fixed-endian-factory/lib/main.js | 137 +++++++++--------- fixed-endian-factory/test/test.filter.js | 4 +- fixed-endian-factory/test/test.join.js | 56 ++++--- ...last-index-of.js => test.last_index_of.js} | 16 ++ fixed-endian-factory/test/test.with.js | 39 +---- 10 files changed, 183 insertions(+), 197 deletions(-) rename fixed-endian-factory/benchmark/{benchmark.last-index-of.js => benchmark.last_index_of.js} (100%) rename fixed-endian-factory/benchmark/{benchmark.last-index-of.length.js => benchmark.last_index_of.length.js} (100%) rename fixed-endian-factory/test/{test.last-index-of.js => test.last_index_of.js} (90%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 530f337c..24a3825a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@
-## Unreleased (2024-12-02) +## Unreleased (2024-12-03)
@@ -591,6 +591,8 @@ A total of 8 people contributed to this release. Thank you to the following cont
+- [`e5d32c5`](https://github.com/stdlib-js/stdlib/commit/e5d32c53f8f552fae4d672c8750619a59ce078ac) - **chore:** minor clean-up _(by Philipp Burckhardt)_ +- [`9798530`](https://github.com/stdlib-js/stdlib/commit/97985302871b99c45462d43479e246c4549c3991) - **chore:** minor clean-up _(by Philipp Burckhardt)_ - [`a0ba090`](https://github.com/stdlib-js/stdlib/commit/a0ba090515dfdfe617e1179ddb7581db24fec44b) - **feat:** add `with` method to `array/fixed-endian-factory` [(#3291)](https://github.com/stdlib-js/stdlib/pull/3291) _(by Aayush Khanna, Philipp Burckhardt)_ - [`d24969e`](https://github.com/stdlib-js/stdlib/commit/d24969e35be1cfbff2e0d62d740c451e476ee444) - **chore:** update package meta data [(#3303)](https://github.com/stdlib-js/stdlib/pull/3303) _(by stdlib-bot, Athan Reines)_ - [`1242bbf`](https://github.com/stdlib-js/stdlib/commit/1242bbf3e43a142f8d0bd4a66aece5baa33c03fe) - **feat:** add `filter` method to `array/fixed-endian-factory` [(#3278)](https://github.com/stdlib-js/stdlib/pull/3278) _(by Aayush Khanna, Philipp Burckhardt)_ diff --git a/fixed-endian-factory/README.md b/fixed-endian-factory/README.md index 8d3a1892..f9ec6510 100644 --- a/fixed-endian-factory/README.md +++ b/fixed-endian-factory/README.md @@ -390,35 +390,35 @@ var count = context.count; // returns 3 ``` - + -#### TypedArrayFE.prototype.forEach( callbackFn\[, thisArg] ) +#### TypedArrayFE.prototype.filter( predicate\[, thisArg] ) -Invokes a function once for each array element. +Returns a new array containing the elements of an array which pass a test implemented by a predicate function. ```javascript -function log( v, i ) { - console.log( '%s: %s', i.toString(), v.toString() ); +function predicate( v ) { + return ( v % 2 === 0 ); } var Float64ArrayFE = fixedEndianFactory( 'float64' ); -var arr = new Float64ArrayFE( 'little-endian', 3 ); +var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] ); + +var out = arr.filter( predicate ); // returns -arr.set( 1.5, 0 ); -arr.set( 2.5, 1 ); -arr.set( 3.5, 2 ); +var len = out.length; +// returns 2 -arr.forEach( log ); -/* => - 0: 1.5 - 1: 2.5 - 2: 3.5 -*/ +var v = out.get( 0 ); +// returns 2.0 + +v = out.get( 1 ); +// return 4.0 ``` -The invoked function is provided three arguments: +The `predicate` function is provided three arguments: - **value**: current array element. - **index**: current array element index. @@ -427,59 +427,58 @@ The invoked function is provided three arguments: To set the function execution context, provide a `thisArg`. ```javascript -function fcn( v, i ) { +function predicate( v, i ) { this.count += 1; - console.log( '%s: %s', i.toString(), v.toString() ); + return ( v % 2 === 0 ); } -var Float64ArrayFE = fixedEndianFactory( 'float64' ); - -var arr = new Float64ArrayFE( 'little-endian', 3 ); -// returns - var context = { 'count': 0 }; -arr.set( 1.0, 0 ); -arr.set( 2.0, 1 ); -arr.set( 3.0, 2 ); +var Float64ArrayFE = fixedEndianFactory( 'float64' ); -arr.forEach( fcn, context ); +var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] ); + +var out = arr.filter( predicate, context ); +// returns + +var len = out.length; +// returns 2 var count = context.count; -// returns 3 +// returns 4 ``` - + -#### TypedArrayFE.prototype.filter( predicate\[, thisArg] ) +#### TypedArrayFE.prototype.forEach( callbackFn\[, thisArg] ) -Returns a new array containing the elements of an array which pass a test implemented by a predicate function. +Invokes a function once for each array element. ```javascript -function predicate( v ) { - return ( v % 2 === 0 ); +function log( v, i ) { + console.log( '%s: %s', i.toString(), v.toString() ); } var Float64ArrayFE = fixedEndianFactory( 'float64' ); -var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] ); - -var out = arr.filter( predicate ); +var arr = new Float64ArrayFE( 'little-endian', 3 ); // returns -var len = out.length; -// returns 2 - -var v = out.get( 0 ); -// returns 2.0 +arr.set( 1.5, 0 ); +arr.set( 2.5, 1 ); +arr.set( 3.5, 2 ); -v = out.get( 1 ); -// return 4.0 +arr.forEach( log ); +/* => + 0: 1.5 + 1: 2.5 + 2: 3.5 +*/ ``` -The `predicate` function is provided three arguments: +The invoked function is provided three arguments: - **value**: current array element. - **index**: current array element index. @@ -488,27 +487,28 @@ The `predicate` function is provided three arguments: To set the function execution context, provide a `thisArg`. ```javascript -function predicate( v, i ) { +function fcn( v, i ) { this.count += 1; - return ( v % 2 === 0 ); + console.log( '%s: %s', i.toString(), v.toString() ); } +var Float64ArrayFE = fixedEndianFactory( 'float64' ); + +var arr = new Float64ArrayFE( 'little-endian', 3 ); +// returns + var context = { 'count': 0 }; -var Float64ArrayFE = fixedEndianFactory( 'float64' ); - -var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0, 4.0 ] ); - -var out = arr.filter( predicate, context ); -// returns +arr.set( 1.0, 0 ); +arr.set( 2.0, 1 ); +arr.set( 3.0, 2 ); -var len = out.length; -// returns 2 +arr.forEach( fcn, context ); var count = context.count; -// returns 4 +// returns 3 ``` @@ -883,7 +883,7 @@ var str = arr.toString(); #### TypedArrayFE.prototype.join( \[separator] ) -Serializes the array elements into a string, with elements separated by the specified `separator`. If no `separator` is provided, a comma (`,`) is used as the default. +Returns a new string by concatenating all array elements. ```javascript var Float64ArrayFE = fixedEndianFactory( 'float64' ); @@ -892,20 +892,17 @@ var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0 ] ); var str = arr.join(); // returns '1,2,3' - -str = arr.join( ' - ' ); -// returns '1 - 2 - 3' ``` -If the provided `separator` is not a string, it is coerced to a string. +By default, the method separates serialized array elements with a comma. To use an alternative separator, provide a `separator` string. ```javascript var Float64ArrayFE = fixedEndianFactory( 'float64' ); var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0 ] ); -var str = arr.join( 0 ); -// returns '10203' +var str = arr.join( ' - ' ); +// returns '1 - 2 - 3' ``` diff --git a/fixed-endian-factory/benchmark/benchmark.join.length.js b/fixed-endian-factory/benchmark/benchmark.join.length.js index 8bce65e6..8457dd03 100644 --- a/fixed-endian-factory/benchmark/benchmark.join.length.js +++ b/fixed-endian-factory/benchmark/benchmark.join.length.js @@ -42,8 +42,7 @@ var Float64ArrayFE = factory( 'float64' ); * @returns {Function} benchmark function */ function createBenchmark( len ) { - var arr; - arr = new Float64ArrayFE( 'little-endian', zeroTo( len ) ); + var arr = new Float64ArrayFE( 'little-endian', zeroTo( len ) ); return benchmark; /** diff --git a/fixed-endian-factory/benchmark/benchmark.last-index-of.js b/fixed-endian-factory/benchmark/benchmark.last_index_of.js similarity index 100% rename from fixed-endian-factory/benchmark/benchmark.last-index-of.js rename to fixed-endian-factory/benchmark/benchmark.last_index_of.js diff --git a/fixed-endian-factory/benchmark/benchmark.last-index-of.length.js b/fixed-endian-factory/benchmark/benchmark.last_index_of.length.js similarity index 100% rename from fixed-endian-factory/benchmark/benchmark.last-index-of.length.js rename to fixed-endian-factory/benchmark/benchmark.last_index_of.length.js diff --git a/fixed-endian-factory/lib/main.js b/fixed-endian-factory/lib/main.js index f8183e4d..a64d47b5 100644 --- a/fixed-endian-factory/lib/main.js +++ b/fixed-endian-factory/lib/main.js @@ -24,7 +24,6 @@ var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; var isCollection = require( '@stdlib/assert/is-collection' ); var isArrayBuffer = require( '@stdlib/assert/is-arraybuffer' ); var isObject = require( '@stdlib/assert/is-object' ); @@ -584,65 +583,65 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli }); /** - * Invokes a function once for each array element. + * Returns a new array containing the elements of an array which pass a test implemented by a predicate function. * - * @name forEach + * @name filter * @memberof TypedArray.prototype * @type {Function} - * @param {Function} fcn - function to invoke - * @param {*} [thisArg] - function invocation context + * @param {Function} predicate - test function + * @param {*} [thisArg] - predicate function execution context * @throws {TypeError} `this` must be a typed array instance * @throws {TypeError} first argument must be a function + * @returns {TypedArray} typed array */ - setReadOnly( TypedArray.prototype, 'forEach', function forEach( fcn, thisArg ) { + setReadOnly( TypedArray.prototype, 'filter', function filter( predicate, thisArg ) { var buf; + var out; var i; + var v; if ( !isTypedArray( this ) ) { throw new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) ); } - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) ); + if ( !isFunction( predicate ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); } buf = this._buffer; - for ( i = 0; i < this._length; i++ ) { - fcn.call( thisArg, buf[ GETTER ]( i*BYTES_PER_ELEMENT, this._isLE ), i, this ); + out = []; + for ( i = 0; i < this._length; i++) { + v = buf[ GETTER ]( i*BYTES_PER_ELEMENT, this._isLE ); + if ( predicate.call( thisArg, v, i, this ) ) { + out.push( v ); + } } + return new this.constructor( flag2byteOrder( this._isLE ), out ); }); /** - * Returns a new array containing the elements of an array which pass a test implemented by a predicate function. + * Invokes a function once for each array element. * - * @name filter + * @name forEach * @memberof TypedArray.prototype * @type {Function} - * @param {Function} predicate - test function - * @param {*} [thisArg] - predicate function execution context + * @param {Function} fcn - function to invoke + * @param {*} [thisArg] - function invocation context * @throws {TypeError} `this` must be a typed array instance * @throws {TypeError} first argument must be a function - * @returns {TypedArray} typed array */ - setReadOnly( TypedArray.prototype, 'filter', function filter( predicate, thisArg ) { + setReadOnly( TypedArray.prototype, 'forEach', function forEach( fcn, thisArg ) { var buf; - var out; var i; - var v; if ( !isTypedArray( this ) ) { throw new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) ); } - if ( !isFunction( predicate ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) ); + if ( !isFunction( fcn ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', fcn ) ); } buf = this._buffer; - out = []; - for ( i = 0; i < this._length; i++) { - v = buf[ GETTER ]( i*BYTES_PER_ELEMENT, this._isLE ); - if ( predicate.call( thisArg, v, i, this ) ) { - out.push( v ); - } + for ( i = 0; i < this._length; i++ ) { + fcn.call( thisArg, buf[ GETTER ]( i*BYTES_PER_ELEMENT, this._isLE ), i, this ); } - return new this.constructor( flag2byteOrder( this._isLE ), out ); }); /** @@ -712,6 +711,43 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli return -1; }); + /** + * Returns a new string by concatenating all array elements. + * + * @private + * @name join + * @memberof TypedArray.prototype + * @type {Function} + * @param {string} [separator=','] - element separator + * @throws {TypeError} `this` must be a typed array instance + * @throws {TypeError} first argument must be a string + * @returns {string} joined string + */ + setReadOnly( TypedArray.prototype, 'join', function join( separator ) { + var out; + var buf; + var sep; + var i; + + if ( !isTypedArray( this ) ) { + throw new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) ); + } + if ( arguments.length > 0 ) { + if ( !isString( separator ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', separator ) ); + } + sep = separator; + } else { + sep = ','; + } + out = []; + buf = this._buffer; + for ( i = 0; i < this._length; i++ ) { + out.push( buf[ GETTER ]( i * BYTES_PER_ELEMENT, this._isLE ) ); + } + return out.join( sep ); + }); + /** * Returns the index of the last occurrence of a given element. * @@ -720,7 +756,7 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli * @memberof TypedArray.prototype * @type {Function} * @param {*} searchElement - element to search for - * @param {integer} [fromIndex=this._length-1] - starting index (inclusive) + * @param {integer} fromIndex - starting index (inclusive) * @throws {TypeError} `this` must be a typed array instance * @throws {TypeError} second argument must be an integer * @returns {integer} index or -1 @@ -736,14 +772,10 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli if ( !isInteger( fromIndex ) ) { throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) ); } - if ( fromIndex < 0 ) { - fromIndex += this._length; - } - if ( fromIndex < 0 ) { - return -1; - } if ( fromIndex >= this._length ) { fromIndex = this._length - 1; + } else if ( fromIndex < 0 ) { + fromIndex += this._length; } } else { fromIndex = this._length - 1; @@ -1040,39 +1072,6 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli return out.join( ',' ); }); - /** - * Serializes the array elements into a string, with elements separated by the specified `separator`. - * - * @private - * @name join - * @memberof TypedArray.prototype - * @type {Function} - * @param {string} [separator=','] - string used to separate consecutive elements - * @throws {TypeError} `this` must be a typed array instance - * @returns {string} joined string - */ - setReadOnly( TypedArray.prototype, 'join', function join( separator ) { - var out; - var buf; - var sep; - var i; - - if ( !isTypedArray( this ) ) { - throw new TypeError( format( 'invalid invocation. `this` is not %s %s.', CHAR2ARTICLE[ dtype[0] ], CTOR_NAME ) ); - } - if ( arguments.length > 0 ) { - sep = String( separator ); - } else { - sep = ','; - } - out = []; - buf = this._buffer; - for ( i = 0; i < this._length; i++ ) { - out.push( buf[ GETTER ]( i * BYTES_PER_ELEMENT, this._isLE ) ); - } - return out.join( sep ); - }); - /** * Returns a new typed array with the element at a provided index replaced with a provided value. * @@ -1084,7 +1083,6 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli * @throws {TypeError} `this` must be a typed array instance * @throws {TypeError} first argument must be an integer * @throws {RangeError} index argument is out-of-bounds - * @throws {TypeError} second argument must be a number * @returns {TypedArray} new typed array */ setReadOnly( TypedArray.prototype, 'with', function copyWith( index, value ) { @@ -1107,9 +1105,6 @@ function factory( dtype ) { // eslint-disable-line max-lines-per-function, stdli if ( index < 0 || index >= len ) { throw new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%s`.', index ) ); } - if ( !isNumber( value ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a number. Value: `%s`.', value ) ); - } out = new this.constructor( flag2byteOrder( this._isLE ), buf.buffer ); outbuf = out._buffer; // eslint-disable-line no-underscore-dangle outbuf[ SETTER ]( index * BYTES_PER_ELEMENT, value, this._isLE ); diff --git a/fixed-endian-factory/test/test.filter.js b/fixed-endian-factory/test/test.filter.js index 5f3c14ac..47cf85db 100644 --- a/fixed-endian-factory/test/test.filter.js +++ b/fixed-endian-factory/test/test.filter.js @@ -40,7 +40,7 @@ tape( 'the function returns a function', function test( t ) { t.end(); }); -tape( 'attached to the prototype of the returned function is an `filter` method', function test( t ) { +tape( 'attached to the prototype of the returned function is a `filter` method', function test( t ) { var ctor = factory( 'float64' ); t.strictEqual( hasOwnProp( ctor.prototype, 'filter' ), true, 'returns expected value' ); t.strictEqual( isFunction( ctor.prototype.filter ), true, 'returns expected value' ); @@ -132,7 +132,7 @@ tape( 'the method returns an empty array if operating on an empty array', functi } }); -tape( 'the method returns a new boolean array containing only those elements which satisfy a test condition', function test( t ) { +tape( 'the method returns a new typed array containing only those elements which satisfy a test condition', function test( t ) { var expected; var actual; var ctor; diff --git a/fixed-endian-factory/test/test.join.js b/fixed-endian-factory/test/test.join.js index d98a86d0..e59fed52 100644 --- a/fixed-endian-factory/test/test.join.js +++ b/fixed-endian-factory/test/test.join.js @@ -74,6 +74,38 @@ tape( 'the method throws an error if invoked with a `this` context which is not } }); +tape( 'the method throws an error if invoked with a `separator` argument which is not a string', function test( t ) { + var values; + var ctor; + var arr; + var i; + + ctor = factory( 'float64' ); + arr = new ctor( 'little-endian', 5 ); + + values = [ + 5, + NaN, + true, + false, + null, + void 0, + {}, + [], + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + return arr.join( value ); + }; + } +}); + tape( 'the method returns an empty string if invoked on an empty array', function test( t ) { var ctor; var str; @@ -141,27 +173,3 @@ tape( 'if the method is invoked without a separator argument, the method returns t.strictEqual( str, expected, 'returns expected value' ); t.end(); }); - -tape( 'the method coerces non-string separators to strings', function test( t ) { - var expected; - var ctor; - var str; - var arr; - - ctor = factory( 'float64' ); - arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0 ] ); - - expected = '1true2true3'; - str = arr.join( true ); - t.strictEqual( str, expected, 'returns expected value' ); - - expected = '1null2null3'; - str = arr.join( null ); - t.strictEqual( str, expected, 'returns expected value' ); - - expected = '1[object Object]2[object Object]3'; - str = arr.join( {} ); - t.strictEqual( str, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/fixed-endian-factory/test/test.last-index-of.js b/fixed-endian-factory/test/test.last_index_of.js similarity index 90% rename from fixed-endian-factory/test/test.last-index-of.js rename to fixed-endian-factory/test/test.last_index_of.js index 8333bb84..54be9b62 100644 --- a/fixed-endian-factory/test/test.last-index-of.js +++ b/fixed-endian-factory/test/test.last_index_of.js @@ -204,3 +204,19 @@ tape( 'the method supports specifying a starting search index (negative)', funct t.end(); }); + +tape( 'when the method is provided a starting index which resolves to an index which exceeds the maximum array index, the method searches from the last array element', function test( t ) { + var ctor; + var arr; + var idx; + + ctor = factory( 'float64' ); + arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 2.0 ] ); + + idx = arr.lastIndexOf( 2.0, 10 ); + t.strictEqual( idx, 4, 'returns expected value' ); + + idx = arr.lastIndexOf( 5.0, 10 ); + t.strictEqual( idx, -1, 'returns expected value' ); + t.end(); +}); diff --git a/fixed-endian-factory/test/test.with.js b/fixed-endian-factory/test/test.with.js index 93a36b03..bf02d17e 100644 --- a/fixed-endian-factory/test/test.with.js +++ b/fixed-endian-factory/test/test.with.js @@ -21,6 +21,7 @@ // MODULES // var tape = require( 'tape' ); +var hasSameValues = require( './../../base/assert/has-same-values' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isFunction = require( '@stdlib/assert/is-function' ); var factory = require( './../lib' ); @@ -142,38 +143,6 @@ tape( 'the method throws an error if provided a first argument which is not in b } }); -tape( 'the method throws an error if provided a second argument which is not a number', function test( t ) { - var values; - var ctor; - var arr; - var i; - - ctor = factory( 'float64' ); - arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); - - values = [ - '5', - true, - false, - null, - void 0, - {}, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - return arr.with( 0, value ); - }; - } -}); - tape( 'the method does not change the array length', function test( t ) { var ctor; var arr; @@ -198,7 +167,7 @@ tape( 'the method returns a new boolean array with the element at a provided ind expected = new ctor( 'little-endian', [ 0.0, 2.0, 3.0, 4.0, 5.0 ] ); actual = arr.with( 0, 0.0 ); t.strictEqual( actual instanceof ctor, true, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); + t.strictEqual( hasSameValues( actual, expected ), true, 'returns expected value' ); t.notEqual( actual, arr, 'returns new instance' ); t.end(); }); @@ -212,9 +181,9 @@ tape( 'the method supports negative indices', function test( t ) { ctor = factory( 'float64' ); arr = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 5.0 ] ); expected = new ctor( 'little-endian', [ 1.0, 2.0, 3.0, 4.0, 0.0 ] ); - actual = arr.with( -5, 0.0 ); + actual = arr.with( -1, 0.0 ); t.strictEqual( actual instanceof ctor, true, 'returns expected value' ); - t.deepEqual( actual, expected, 'returns expected value' ); + t.strictEqual( hasSameValues( actual, expected ), true, 'returns expected value' ); t.notEqual( actual, arr, 'returns new instance' ); t.end(); });