|
16 | 16 | * limitations under the License. |
17 | 17 | */ |
18 | 18 |
|
| 19 | +/* eslint-disable space-in-parens */ |
| 20 | + |
| 21 | +import zeros = require( '@stdlib/ndarray/zeros' ); |
19 | 22 | import drev = require( './index' ); |
20 | 23 |
|
21 | 24 |
|
22 | 25 | // TESTS // |
23 | 26 |
|
24 | 27 | // The function returns an ndarray... |
25 | 28 | { |
26 | | - const Float64Array = require( '@stdlib/array/float64' ); |
27 | | - const ndarray = require( '@stdlib/ndarray/base/ctor' ); |
28 | | - |
29 | | - const xbuf = new Float64Array( [ 1.0, 2.0, 3.0 ] ); |
30 | | - const x = new ndarray( 'float64', xbuf, [ 3 ], [ 1 ], 0, 'row-major' ); |
| 29 | + const x = zeros( [ 3 ], { |
| 30 | + 'dtype': 'float64' |
| 31 | + }); |
31 | 32 |
|
32 | 33 | drev( x ); // $ExpectType float64ndarray |
33 | 34 | } |
34 | 35 |
|
35 | | -// The compiler throws an error if the function is provided a first argument which is not an array-like object containing an ndarray... |
| 36 | +// The compiler throws an error if the function is provided a first argument which is not an ndarray... |
36 | 37 | { |
37 | | - drev( 123 ); // $ExpectError |
| 38 | + drev( '10' ); // $ExpectError |
| 39 | + drev( 10 ); // $ExpectError |
38 | 40 | drev( true ); // $ExpectError |
39 | 41 | drev( false ); // $ExpectError |
40 | 42 | drev( null ); // $ExpectError |
41 | 43 | drev( undefined ); // $ExpectError |
| 44 | + drev( [] ); // $ExpectError |
42 | 45 | drev( {} ); // $ExpectError |
43 | | - drev( [ 123 ] ); // $ExpectError |
| 46 | + drev( ( x: number ): number => x ); // $ExpectError |
44 | 47 | } |
45 | 48 |
|
46 | 49 | // The compiler throws an error if the function is provided an unsupported number of arguments... |
47 | 50 | { |
48 | | - const Float64Array = require( '@stdlib/array/float64' ); |
49 | | - const ndarray = require( '@stdlib/ndarray/base/ctor' ); |
50 | | - |
51 | | - const xbuf = new Float64Array( [ 1.0, 2.0, 3.0 ] ); |
52 | | - const x = new ndarray( 'float64', xbuf, [ 3 ], [ 1 ], 0, 'row-major' ); |
| 51 | + const x = zeros( [ 3 ], { |
| 52 | + 'dtype': 'float64' |
| 53 | + }); |
53 | 54 |
|
54 | 55 | drev(); // $ExpectError |
55 | | - drev( x, 123 ); // $ExpectError |
| 56 | + drev( x, {} ); // $ExpectError |
56 | 57 | } |
0 commit comments