Skip to content

Commit 70b1817

Browse files
committed
fix: apply suggestions from code review
1 parent f44a562 commit 70b1817

2 files changed

Lines changed: 58 additions & 6 deletions

File tree

  • lib/node_modules/@stdlib/ndarray/base/full-by

lib/node_modules/@stdlib/ndarray/base/full-by/docs/types/test.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ import fullBy = require( './index' );
5050
fullBy( 'uint8c', [ 2, 2 ], 'column-major', () => 10 ); // $ExpectType uint8cndarray
5151
fullBy( 'bool', [ 2, 2 ], 'column-major', () => true ); // $ExpectType boolndarray
5252
fullBy( 'generic', [ 2, 2 ], 'column-major', () => 10.0 ); // $ExpectType genericndarray<number>
53+
54+
fullBy( 'float64', [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectType float64ndarray
55+
fullBy( 'float32', [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectType float32ndarray
56+
fullBy( 'complex128', [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectType complex128ndarray
57+
fullBy( 'complex64', [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectType complex64ndarray
58+
fullBy( 'int32', [ 2, 2 ], 'row-major', () => 10, {} ); // $ExpectType int32ndarray
59+
fullBy( 'int16', [ 2, 2 ], 'row-major', () => 10, {} ); // $ExpectType int16ndarray
60+
fullBy( 'int8', [ 2, 2 ], 'row-major', () => 10, {} ); // $ExpectType int8ndarray
61+
fullBy( 'uint32', [ 2, 2 ], 'row-major', () => 10, {} ); // $ExpectType uint32ndarray
62+
fullBy( 'uint16', [ 2, 2 ], 'row-major', () => 10, {} ); // $ExpectType uint16ndarray
63+
fullBy( 'uint8', [ 2, 2 ], 'row-major', () => 10, {} ); // $ExpectType uint8ndarray
64+
fullBy( 'uint8c', [ 2, 2 ], 'row-major', () => 10, {} ); // $ExpectType uint8cndarray
65+
fullBy( 'bool', [ 2, 2 ], 'row-major', () => true, {} ); // $ExpectType boolndarray
66+
fullBy( 'generic', [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectType genericndarray<number>
5367
}
5468

5569
// The compiler throws an error if the function is provided a first argument which is an unrecognized/unsupported data type...
@@ -62,6 +76,15 @@ import fullBy = require( './index' );
6276
fullBy( [], [ 2, 2 ], 'row-major', () => 10.0 ); // $ExpectError
6377
fullBy( {}, [ 2, 2 ], 'row-major', () => 10.0 ); // $ExpectError
6478
fullBy( ( x: number ): number => x, [ 2, 2 ], 'row-major', () => 10.0 ); // $ExpectError
79+
80+
fullBy( '10', [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectError
81+
fullBy( 10, [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectError
82+
fullBy( false, [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectError
83+
fullBy( true, [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectError
84+
fullBy( null, [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectError
85+
fullBy( [], [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectError
86+
fullBy( {}, [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectError
87+
fullBy( ( x: number ): number => x, [ 2, 2 ], 'row-major', () => 10.0, {} ); // $ExpectError
6588
}
6689

6790
// The compiler throws an error if the function is not provided a valid shape for the second argument...
@@ -74,6 +97,15 @@ import fullBy = require( './index' );
7497
fullBy( 'float32', [ '5' ], 'row-major', () => 10.0 ); // $ExpectError
7598
fullBy( 'float32', {}, 'row-major', () => 10.0 ); // $ExpectError
7699
fullBy( 'float32', ( x: number ): number => x, 'row-major', () => 10.0 ); // $ExpectError
100+
101+
fullBy( 'float32', '5', 'row-major', () => 10.0, {} ); // $ExpectError
102+
fullBy( 'float32', false, 'row-major', () => 10.0, {} ); // $ExpectError
103+
fullBy( 'float32', true, 'row-major', () => 10.0, {} ); // $ExpectError
104+
fullBy( 'float32', null, 'row-major', () => 10.0, {} ); // $ExpectError
105+
fullBy( 'float32', undefined, 'row-major', () => 10.0, {} ); // $ExpectError
106+
fullBy( 'float32', [ '5' ], 'row-major', () => 10.0, {} ); // $ExpectError
107+
fullBy( 'float32', {}, 'row-major', () => 10.0, {} ); // $ExpectError
108+
fullBy( 'float32', ( x: number ): number => x, 'row-major', () => 10.0, {} ); // $ExpectError
77109
}
78110

79111
// The compiler throws an error if the function is not provided a valid order for the third argument...
@@ -86,6 +118,15 @@ import fullBy = require( './index' );
86118
fullBy( 'float32', [ 2, 2 ], [ '5' ], () => 10.0 ); // $ExpectError
87119
fullBy( 'float32', [ 2, 2 ], {}, () => 10.0 ); // $ExpectError
88120
fullBy( 'float32', [ 2, 2 ], ( x: number ): number => x, () => 10.0 ); // $ExpectError
121+
122+
fullBy( 'float32', [ 2, 2 ], '5', () => 10.0, {} ); // $ExpectError
123+
fullBy( 'float32', [ 2, 2 ], false, () => 10.0, {} ); // $ExpectError
124+
fullBy( 'float32', [ 2, 2 ], true, () => 10.0, {} ); // $ExpectError
125+
fullBy( 'float32', [ 2, 2 ], null, () => 10.0, {} ); // $ExpectError
126+
fullBy( 'float32', [ 2, 2 ], undefined, () => 10.0, {} ); // $ExpectError
127+
fullBy( 'float32', [ 2, 2 ], [ '5' ], () => 10.0, {} ); // $ExpectError
128+
fullBy( 'float32', [ 2, 2 ], {}, () => 10.0, {} ); // $ExpectError
129+
fullBy( 'float32', [ 2, 2 ], ( x: number ): number => x, () => 10.0, {} ); // $ExpectError
89130
}
90131

91132
// The compiler throws an error if the function is not provided a callback function for the fourth argument...
@@ -97,6 +138,14 @@ import fullBy = require( './index' );
97138
fullBy( 'float32', [ 2, 2 ], 'row-major', null ); // $ExpectError
98139
fullBy( 'float32', [ 2, 2 ], 'row-major', [] ); // $ExpectError
99140
fullBy( 'float32', [ 2, 2 ], 'row-major', {} ); // $ExpectError
141+
142+
fullBy( 'float32', [ 2, 2 ], 'row-major', '10', {} ); // $ExpectError
143+
fullBy( 'float32', [ 2, 2 ], 'row-major', 10, {} ); // $ExpectError
144+
fullBy( 'float32', [ 2, 2 ], 'row-major', false, {} ); // $ExpectError
145+
fullBy( 'float32', [ 2, 2 ], 'row-major', true, {} ); // $ExpectError
146+
fullBy( 'float32', [ 2, 2 ], 'row-major', null, {} ); // $ExpectError
147+
fullBy( 'float32', [ 2, 2 ], 'row-major', [], {} ); // $ExpectError
148+
fullBy( 'float32', [ 2, 2 ], 'row-major', {}, {} ); // $ExpectError
100149
}
101150

102151
// The compiler throws an error if the function is provided an unsupported number of arguments...

lib/node_modules/@stdlib/ndarray/base/full-by/test/test.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ var BooleanArray = require( '@stdlib/array/bool' );
3636
var Buffer = require( '@stdlib/buffer/ctor' );
3737
var Complex128 = require( '@stdlib/complex/float64/ctor' );
3838
var Complex64 = require( '@stdlib/complex/float32/ctor' );
39+
var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' );
40+
var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' );
41+
var isEqualBooleanArray = require( '@stdlib/assert/is-equal-booleanarray' );
3942
var instanceOf = require( '@stdlib/assert/instance-of' );
4043
var ndarray = require( '@stdlib/ndarray/base/ctor' );
4144
var getShape = require( '@stdlib/ndarray/base/shape' );
@@ -632,7 +635,7 @@ tape( 'the function returns a filled array (dtype=complex128, order=row-major)',
632635
t.strictEqual( String( getDType( arr ) ), 'complex128', 'returns expected value' );
633636
t.deepEqual( getShape( arr ), [ 2, 2 ], 'returns expected value' );
634637
t.strictEqual( instanceOf( getData( arr ), Complex128Array ), true, 'returns expected value' );
635-
t.deepEqual( getData( arr ), expected, 'returns expected value' );
638+
t.strictEqual( isSameComplex128Array( getData( arr ), expected ), true, 'returns expected value' );
636639
t.strictEqual( getOrder( arr ), 'row-major', 'returns expected value' );
637640

638641
t.end();
@@ -662,7 +665,7 @@ tape( 'the function returns a filled array (dtype=complex128, order=column-major
662665
t.strictEqual( String( getDType( arr ) ), 'complex128', 'returns expected value' );
663666
t.deepEqual( getShape( arr ), [ 2, 2 ], 'returns expected value' );
664667
t.strictEqual( instanceOf( getData( arr ), Complex128Array ), true, 'returns expected value' );
665-
t.deepEqual( getData( arr ), expected, 'returns expected value' );
668+
t.strictEqual( isSameComplex128Array( getData( arr ), expected ), true, 'returns expected value' );
666669
t.strictEqual( getOrder( arr ), 'column-major', 'returns expected value' );
667670

668671
t.end();
@@ -692,7 +695,7 @@ tape( 'the function returns a filled array (dtype=complex64, order=row-major)',
692695
t.strictEqual( String( getDType( arr ) ), 'complex64', 'returns expected value' );
693696
t.deepEqual( getShape( arr ), [ 2, 2 ], 'returns expected value' );
694697
t.strictEqual( instanceOf( getData( arr ), Complex64Array ), true, 'returns expected value' );
695-
t.deepEqual( getData( arr ), expected, 'returns expected value' );
698+
t.strictEqual( isSameComplex64Array( getData( arr ), expected ), true, 'returns expected value' );
696699
t.strictEqual( getOrder( arr ), 'row-major', 'returns expected value' );
697700

698701
t.end();
@@ -722,7 +725,7 @@ tape( 'the function returns a filled array (dtype=complex64, order=column-major)
722725
t.strictEqual( String( getDType( arr ) ), 'complex64', 'returns expected value' );
723726
t.deepEqual( getShape( arr ), [ 2, 2 ], 'returns expected value' );
724727
t.strictEqual( instanceOf( getData( arr ), Complex64Array ), true, 'returns expected value' );
725-
t.deepEqual( getData( arr ), expected, 'returns expected value' );
728+
t.strictEqual( isSameComplex64Array( getData( arr ), expected ), true, 'returns expected value' );
726729
t.strictEqual( getOrder( arr ), 'column-major', 'returns expected value' );
727730

728731
t.end();
@@ -748,7 +751,7 @@ tape( 'the function returns a filled array (dtype=bool, order=row-major)', funct
748751
t.strictEqual( String( getDType( arr ) ), 'bool', 'returns expected value' );
749752
t.deepEqual( getShape( arr ), [ 2, 2 ], 'returns expected value' );
750753
t.strictEqual( instanceOf( getData( arr ), BooleanArray ), true, 'returns expected value' );
751-
t.deepEqual( getData( arr ), expected, 'returns expected value' );
754+
t.strictEqual( isEqualBooleanArray( getData( arr ), expected ), true, 'returns expected value' );
752755
t.strictEqual( getOrder( arr ), 'row-major', 'returns expected value' );
753756

754757
t.end();
@@ -774,7 +777,7 @@ tape( 'the function returns a filled array (dtype=bool, order=column-major)', fu
774777
t.strictEqual( String( getDType( arr ) ), 'bool', 'returns expected value' );
775778
t.deepEqual( getShape( arr ), [ 2, 2 ], 'returns expected value' );
776779
t.strictEqual( instanceOf( getData( arr ), BooleanArray ), true, 'returns expected value' );
777-
t.deepEqual( getData( arr ), expected, 'returns expected value' );
780+
t.strictEqual( isEqualBooleanArray( getData( arr ), expected ), true, 'returns expected value' );
778781
t.strictEqual( getOrder( arr ), 'column-major', 'returns expected value' );
779782

780783
t.end();

0 commit comments

Comments
 (0)