|
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 trunc = require( '@stdlib/math-base-special-trunc' ); |
25 | | -var randu = require( '@stdlib/random-base-randu' ); |
26 | | -var PINF = require( '@stdlib/constants-float64-pinf' ); |
27 | | -var NINF = require( '@stdlib/constants-float64-ninf' ); |
28 | | -var isNonNegativeInteger = 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 isNonNegativeInteger, 'function', 'main export is a function' ); |
36 | | - t.end(); |
37 | | -}); |
38 | | - |
39 | | -tape( 'the function returns `true` if provided a nonnegative integer', function test( t ) { |
40 | | - var i; |
41 | | - for ( i = 0; i < 101; i++ ) { |
42 | | - t.equal( isNonNegativeInteger( i ), true, 'returns true when provided '+i ); |
43 | | - } |
44 | | - t.end(); |
45 | | -}); |
46 | | - |
47 | | -tape( 'the function returns `false` if not provided a nonnegative integer', function test( t ) { |
48 | | - var i; |
49 | | - for ( i = -1; i > -101; i-- ) { |
50 | | - t.equal( isNonNegativeInteger( i ), false, 'returns false when provided '+i ); |
51 | | - } |
52 | | - t.end(); |
53 | | -}); |
54 | | - |
55 | | -tape( 'the function returns `false` if not provided an integer', function test( t ) { |
56 | | - var v; |
57 | | - var i; |
58 | | - for ( i = 0; i < 100; i++ ) { |
59 | | - v = ( randu()*100.0 ) - 50.0; |
60 | | - if ( trunc(v) !== v ) { |
61 | | - t.equal( isNonNegativeInteger( v ), false, 'returns false when provided '+v ); |
62 | | - } |
63 | | - } |
64 | | - t.end(); |
65 | | -}); |
66 | | - |
67 | | -tape( 'the function returns `false` if provided `NaN`', function test( t ) { |
68 | | - t.equal( isNonNegativeInteger( NaN ), false, 'returns false' ); |
69 | | - t.end(); |
70 | | -}); |
71 | | - |
72 | | -tape( 'WARNING: the function returns `true` if provided `+infinity`', function test( t ) { |
73 | | - t.equal( isNonNegativeInteger( PINF ), true, 'returns true' ); |
74 | | - t.end(); |
75 | | -}); |
76 | | - |
77 | | -tape( 'the function does not distinguish between positive and negative zero and returns `true` if provided `-0`', function test( t ) { |
78 | | - t.equal( isNonNegativeInteger( -0.0 ), true, 'returns true' ); |
79 | | - t.end(); |
80 | | -}); |
81 | | - |
82 | | -tape( 'the function returns `false` if provided `-infinity`', function test( t ) { |
83 | | - t.equal( isNonNegativeInteger( NINF ), false, 'returns false' ); |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
84 | 32 | t.end(); |
85 | 33 | }); |
0 commit comments