|
1 | 1 | /** |
2 | 2 | * @license Apache-2.0 |
3 | 3 | * |
4 | | -* Copyright (c) 2020 The Stdlib Authors. |
| 4 | +* Copyright (c) 2023 The Stdlib Authors. |
5 | 5 | * |
6 | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
7 | 7 | * you may not use this file except in compliance with the License. |
|
21 | 21 | // MODULES // |
22 | 22 |
|
23 | 23 | var tape = require( 'tape' ); |
24 | | -var ndarray = require( '@stdlib/ndarray-ctor' ); |
25 | | -var noop = require( '@stdlib/utils-noop' ); |
26 | | -var Float32Array = require( '@stdlib/array-float32' ); |
27 | | -var isFloat32VectorLike = require( './../../dist' ); |
| 24 | +var main = require( './../../dist' ); |
28 | 25 |
|
29 | 26 |
|
30 | 27 | // TESTS // |
31 | 28 |
|
32 | | -tape( 'main export is a function', function test( t ) { |
| 29 | +tape( 'main export is defined', function test( t ) { |
33 | 30 | t.ok( true, __filename ); |
34 | | - t.strictEqual( typeof isFloat32VectorLike, 'function', 'main export is a function' ); |
35 | | - t.end(); |
36 | | -}); |
37 | | - |
38 | | -tape( 'the function returns `true` if provided a 1-dimensional ndarray containing single-precision floating-point numbers', function test( t ) { |
39 | | - var arr = ndarray( 'float32', new Float32Array( [ 0, 0, 0, 0 ] ), [ 4 ], [ 1 ], 0, 'row-major' ); |
40 | | - |
41 | | - t.equal( isFloat32VectorLike( arr ), true, 'returns true' ); |
42 | | - t.end(); |
43 | | -}); |
44 | | - |
45 | | -tape( 'the function returns `true` if provided a 1-dimensional ndarray-like object containing single-precision floating-point numbers', function test( t ) { |
46 | | - var arr = { |
47 | | - 'data': new Float32Array( [ 0, 0, 0, 0 ] ), |
48 | | - 'shape': [ 4 ], |
49 | | - 'strides': [ 1 ], |
50 | | - 'offset': 0, |
51 | | - 'order': 'row-major', |
52 | | - 'ndims': 1, |
53 | | - 'dtype': 'float32', |
54 | | - 'length': 4, |
55 | | - 'flags': {}, |
56 | | - 'get': noop, |
57 | | - 'set': noop |
58 | | - }; |
59 | | - |
60 | | - t.equal( isFloat32VectorLike( arr ), true, 'returns true' ); |
61 | | - t.end(); |
62 | | -}); |
63 | | - |
64 | | -tape( 'the function returns `false` if not provided a 1-dimensional ndarray-like object containing single-precision floating-point numbers', function test( t ) { |
65 | | - var values; |
66 | | - var arr1; |
67 | | - var arr2; |
68 | | - var i; |
69 | | - |
70 | | - arr1 = ndarray( 'float32', new Float32Array( [ 0, 0, 0 ] ), [ 3, 1, 1 ], [ 1, 1, 1 ], 0, 'row-major' ); |
71 | | - |
72 | | - arr2 = ndarray( 'generic', [ 0, 0, 0 ], [ 3 ], [ 1 ], 0, 'row-major' ); |
73 | | - |
74 | | - values = [ |
75 | | - arr1, |
76 | | - arr2, |
77 | | - '5', |
78 | | - 5, |
79 | | - NaN, |
80 | | - null, |
81 | | - void 0, |
82 | | - true, |
83 | | - false, |
84 | | - [], |
85 | | - {}, |
86 | | - function noop() {} |
87 | | - ]; |
88 | | - |
89 | | - for ( i = 0; i < values.length; i++ ) { |
90 | | - t.equal( isFloat32VectorLike( values[i] ), false, 'returns false when provided '+values[i] ); |
91 | | - } |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
92 | 32 | t.end(); |
93 | 33 | }); |
0 commit comments