|
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.
|
|
21 | 21 | // MODULES //
|
22 | 22 |
|
23 | 23 | var tape = require( 'tape' );
|
24 |
| -var Int16Array = require( '@stdlib/array-int16' ); |
25 |
| -var Int32Array = require( '@stdlib/array-int32' ); |
26 |
| -var Uint32Array = require( '@stdlib/array-uint32' ); |
27 |
| -var Number = require( '@stdlib/number-ctor' ); |
28 |
| -var isNonNegativeIntegerArray = require( './../../dist' ); |
| 24 | +var main = require( './../../dist' ); |
29 | 25 |
|
30 | 26 |
|
31 | 27 | // TESTS //
|
32 | 28 |
|
33 |
| -tape( 'main export is a function', function test( t ) { |
| 29 | +tape( 'main export is defined', function test( t ) { |
34 | 30 | t.ok( true, __filename );
|
35 |
| - t.strictEqual( typeof isNonNegativeIntegerArray, 'function', 'main export is a function' ); |
36 |
| - t.end(); |
37 |
| -}); |
38 |
| - |
39 |
| -tape( 'the function tests for an array-like object containing only nonnegative integer values', function test( t ) { |
40 |
| - var arr; |
41 |
| - |
42 |
| - arr = [ 5.0, new Number( 5 ), 0 ]; |
43 |
| - t.equal( isNonNegativeIntegerArray( arr ), true, 'returns true' ); |
44 |
| - |
45 |
| - arr = [ 5.0, '3', null ]; |
46 |
| - t.equal( isNonNegativeIntegerArray( arr ), false, 'returns false' ); |
47 |
| - |
48 |
| - arr = { |
49 |
| - 'length': 2, |
50 |
| - '0': 5, |
51 |
| - '1': 0 |
52 |
| - }; |
53 |
| - t.equal( isNonNegativeIntegerArray( arr ), true, 'returns true' ); |
54 |
| - |
55 |
| - arr = new Int32Array( [ 5, 0 ] ); |
56 |
| - t.equal( isNonNegativeIntegerArray( arr ), true, 'returns true' ); |
57 |
| - |
58 |
| - t.end(); |
59 |
| -}); |
60 |
| - |
61 |
| -tape( 'the function provides a method to test for an array-like object containing only primitive nonnegative integers', function test( t ) { |
62 |
| - var arr; |
63 |
| - |
64 |
| - arr = [ 5.0, 0.0 ]; |
65 |
| - t.equal( isNonNegativeIntegerArray.primitives( arr ), true, 'returns true' ); |
66 |
| - |
67 |
| - arr = [ new Number( 5 ), 1.0, 1.0 ]; |
68 |
| - t.equal( isNonNegativeIntegerArray.primitives( arr ), false, 'returns false' ); |
69 |
| - |
70 |
| - arr = { |
71 |
| - 'length': 2, |
72 |
| - '0': 5, |
73 |
| - '1': 0 |
74 |
| - }; |
75 |
| - t.equal( isNonNegativeIntegerArray.primitives( arr ), true, 'returns true' ); |
76 |
| - |
77 |
| - arr = new Int16Array( [ 5, 0 ] ); |
78 |
| - t.equal( isNonNegativeIntegerArray.primitives( arr ), true, 'returns true' ); |
79 |
| - |
80 |
| - t.end(); |
81 |
| -}); |
82 |
| - |
83 |
| -tape( 'the function provides a method to test for an array-like object containing only nonnegative object integers', function test( t ) { |
84 |
| - var arr; |
85 |
| - |
86 |
| - arr = [ new Number( 5 ), new Number( 5 ) ]; |
87 |
| - t.equal( isNonNegativeIntegerArray.objects( arr ), true, 'returns true' ); |
88 |
| - |
89 |
| - arr = [ 5.0, 0.0 ]; |
90 |
| - t.equal( isNonNegativeIntegerArray.objects( arr ), false, 'returns false' ); |
91 |
| - |
92 |
| - arr = { |
93 |
| - 'length': 2, |
94 |
| - '0': new Number( 5 ), |
95 |
| - '1': new Number( 0 ) |
96 |
| - }; |
97 |
| - t.equal( isNonNegativeIntegerArray.objects( arr ), true, 'returns true' ); |
98 |
| - |
99 |
| - arr = new Uint32Array( [ 5, 0 ] ); |
100 |
| - t.equal( isNonNegativeIntegerArray.objects( arr ), false, 'returns false' ); |
101 |
| - |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
102 | 32 | t.end();
|
103 | 33 | });
|
0 commit comments