|
1 | 1 | /** |
2 | 2 | * @license Apache-2.0 |
3 | 3 | * |
4 | | -* Copyright (c) 2018 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. |
|
16 | 16 | * limitations under the License. |
17 | 17 | */ |
18 | 18 |
|
19 | | -/* eslint-disable no-new-wrappers */ |
20 | | - |
21 | 19 | 'use strict'; |
22 | 20 |
|
23 | 21 | // MODULES // |
24 | 22 |
|
25 | 23 | var tape = require( 'tape' ); |
26 | | -var Number = require( '@stdlib/number-ctor' ); |
27 | | -var isFiniteArray = 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 isFiniteArray, 'function', 'main export is a function' ); |
35 | | - t.end(); |
36 | | -}); |
37 | | - |
38 | | -tape( 'the function tests for an array-like object containing only finite numbers', function test( t ) { |
39 | | - var arr; |
40 | | - |
41 | | - arr = [ 5.0, new Number( 5.0 ), -3.14 ]; |
42 | | - t.strictEqual( isFiniteArray( arr ), true, 'returns true' ); |
43 | | - |
44 | | - arr = { |
45 | | - 'length': 2, |
46 | | - '0': 2.0, |
47 | | - '1': 1.0 |
48 | | - }; |
49 | | - t.strictEqual( isFiniteArray( arr ), true, 'returns true' ); |
50 | | - |
51 | | - arr = [ 5.0, 2.3, 11.1, 1.0/0.0 ]; |
52 | | - t.strictEqual( isFiniteArray( arr ), false, 'returns false' ); |
53 | | - |
54 | | - arr = [ 5.0, '3', null ]; |
55 | | - t.strictEqual( isFiniteArray( arr ), false, 'returns false' ); |
56 | | - |
57 | | - t.end(); |
58 | | -}); |
59 | | - |
60 | | -tape( 'the function provides a method to test for an array-like object containing only primitive finite numbers', function test( t ) { |
61 | | - var arr; |
62 | | - |
63 | | - arr = [ 5.0, -0.0, 0.0, 3.14 ]; |
64 | | - t.strictEqual( isFiniteArray.primitives( arr ), true, 'returns true' ); |
65 | | - |
66 | | - arr = { |
67 | | - 'length': 2, |
68 | | - '0': 1.0, |
69 | | - '1': -3.0 |
70 | | - }; |
71 | | - t.strictEqual( isFiniteArray.primitives( arr ), true, 'returns true' ); |
72 | | - |
73 | | - arr = [ 5.0, -0.0, 0.0, 1.0/0.0 ]; |
74 | | - t.strictEqual( isFiniteArray.primitives( arr ), false, 'returns false' ); |
75 | | - |
76 | | - arr = [ new Number( 5.0 ), 1.0, 1.0 ]; |
77 | | - t.strictEqual( isFiniteArray.primitives( arr ), false, 'returns false' ); |
78 | | - |
79 | | - t.end(); |
80 | | -}); |
81 | | - |
82 | | -tape( 'the function provides a method to test for an array-like object containing only `Number` objects having finite values', function test( t ) { |
83 | | - var arr; |
84 | | - |
85 | | - arr = [ new Number( 5.0 ), new Number( -0.0 ), new Number( 0.0 ) ]; |
86 | | - t.strictEqual( isFiniteArray.objects( arr ), true, 'returns true' ); |
87 | | - |
88 | | - arr = { |
89 | | - 'length': 2, |
90 | | - '0': new Number( 2.0 ), |
91 | | - '1': new Number( -3.0 ) |
92 | | - }; |
93 | | - t.strictEqual( isFiniteArray.objects( arr ), true, 'returns true' ); |
94 | | - |
95 | | - arr = [ new Number( 5.0 ), new Number( -0.0 ), new Number( 1.0/0.0 ) ]; |
96 | | - t.strictEqual( isFiniteArray.objects( arr ), false, 'returns false' ); |
97 | | - |
98 | | - arr = [ new Number( 5.0 ), 1.0, 1.0 ]; |
99 | | - t.strictEqual( isFiniteArray.objects( arr ), false, 'returns false' ); |
100 | | - |
101 | | - arr = [ -5.0, 1.0, 1.0 ]; |
102 | | - t.strictEqual( isFiniteArray.objects( arr ), false, 'returns false' ); |
103 | | - |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
104 | 32 | t.end(); |
105 | 33 | }); |
0 commit comments