|
1 | 1 | /** |
2 | 2 | * @license Apache-2.0 |
3 | 3 | * |
4 | | -* Copyright (c) 2022 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 dtypes = require( '@stdlib/array-typed-float-dtypes' ); |
25 | | -var Float64Array = require( '@stdlib/array-float64' ); |
26 | | -var Float32Array = require( '@stdlib/array-float32' ); |
27 | | -var Complex128Array = require( '@stdlib/array-complex128' ); |
28 | | -var Complex64Array = require( '@stdlib/array-complex64' ); |
29 | | -var isFunction = require( '@stdlib/assert-is-function' ); |
30 | | -var ctors = require( './../../dist' ); |
| 24 | +var main = require( './../../dist' ); |
31 | 25 |
|
32 | 26 |
|
33 | 27 | // TESTS // |
34 | 28 |
|
35 | | -tape( 'main export is a function', function test( t ) { |
| 29 | +tape( 'main export is defined', function test( t ) { |
36 | 30 | t.ok( true, __filename ); |
37 | | - t.strictEqual( typeof ctors, 'function', 'main export is a function' ); |
38 | | - t.end(); |
39 | | -}); |
40 | | - |
41 | | -tape( 'the function returns typed array constructors', function test( t ) { |
42 | | - var expected; |
43 | | - var dtypes; |
44 | | - var ctor; |
45 | | - var i; |
46 | | - |
47 | | - dtypes = [ |
48 | | - 'float64', |
49 | | - 'float32', |
50 | | - 'complex128', |
51 | | - 'complex64' |
52 | | - ]; |
53 | | - expected = [ |
54 | | - Float64Array, |
55 | | - Float32Array, |
56 | | - Complex128Array, |
57 | | - Complex64Array |
58 | | - ]; |
59 | | - for ( i = 0; i < dtypes.length; i++ ) { |
60 | | - ctor = ctors( dtypes[ i ] ); |
61 | | - t.strictEqual( ctor, expected[ i ], 'returns expected value for ' + dtypes[ i ] ); |
62 | | - } |
63 | | - t.end(); |
64 | | -}); |
65 | | - |
66 | | -tape( 'the function returns a constructor for each supported typed array data type', function test( t ) { |
67 | | - var DTYPES; |
68 | | - var ctor; |
69 | | - var i; |
70 | | - |
71 | | - DTYPES = dtypes(); |
72 | | - for ( i = 0; i < DTYPES.length; i++ ) { |
73 | | - ctor = ctors( DTYPES[ i ] ); |
74 | | - |
75 | | - // Note: this is a weak test for a "constructor" |
76 | | - t.strictEqual( isFunction( ctor ), true, 'returns a function for ' + DTYPES[ i ] ); |
77 | | - } |
78 | | - t.end(); |
79 | | -}); |
80 | | - |
81 | | -tape( 'if provided an unknown/unsupported data type, the function returns `null`', function test( t ) { |
82 | | - var dtypes; |
83 | | - var i; |
84 | | - |
85 | | - dtypes = [ |
86 | | - 'binary', |
87 | | - 'buffer', |
88 | | - 'buf', |
89 | | - 'generic', |
90 | | - 'float', |
91 | | - 'double', |
92 | | - 'single', |
93 | | - 'int', |
94 | | - 'integer', |
95 | | - 'uint', |
96 | | - 'uinteger', |
97 | | - 'byte', |
98 | | - 'bits' |
99 | | - ]; |
100 | | - for ( i = 0; i < dtypes.length; i++ ) { |
101 | | - t.strictEqual( ctors( dtypes[i] ), null, 'returns expected value for ' + dtypes[ i ] ); |
102 | | - } |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
103 | 32 | t.end(); |
104 | 33 | }); |
0 commit comments