|
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 Float64Array = require( '@stdlib/array-float64' ); |
25 | | -var Number = require( '@stdlib/number-ctor' ); |
26 | | -var isProbabilityArray = require( './../../dist' ); |
| 24 | +var main = require( './../../dist' ); |
27 | 25 |
|
28 | 26 |
|
29 | 27 | // TESTS // |
30 | 28 |
|
31 | | -tape( 'main export is a function', function test( t ) { |
| 29 | +tape( 'main export is defined', function test( t ) { |
32 | 30 | t.ok( true, __filename ); |
33 | | - t.strictEqual( typeof isProbabilityArray, 'function', 'main export is a function' ); |
34 | | - t.end(); |
35 | | -}); |
36 | | - |
37 | | -tape( 'the function tests for an array-like object containing only probabilities', function test( t ) { |
38 | | - var arr; |
39 | | - |
40 | | - arr = [ 0.9, new Number( 0.8 ), 0.0 ]; // eslint-disable-line no-new-wrappers |
41 | | - t.equal( isProbabilityArray( arr ), true, 'returns true' ); |
42 | | - |
43 | | - arr = new Float64Array( [ 0.9, 0.5, 0.3 ] ); |
44 | | - t.equal( isProbabilityArray( arr ), true, 'returns true' ); |
45 | | - |
46 | | - arr = { |
47 | | - 'length': 2, |
48 | | - '0': 0.3, |
49 | | - '1': 0.8 |
50 | | - }; |
51 | | - t.equal( isProbabilityArray( arr ), true, 'returns true' ); |
52 | | - |
53 | | - arr = [ 0.9, '3', null ]; |
54 | | - t.equal( isProbabilityArray( arr ), false, 'returns false' ); |
55 | | - |
56 | | - arr = new Float64Array( [ 0.9, NaN, 0.3 ] ); |
57 | | - t.equal( isProbabilityArray( arr ), false, 'returns false' ); |
58 | | - |
59 | | - t.end(); |
60 | | -}); |
61 | | - |
62 | | -tape( 'the function provides a method to test for an array-like object containing only primitive probabilities', function test( t ) { |
63 | | - var arr; |
64 | | - |
65 | | - arr = [ 1.0, 0.0 ]; |
66 | | - t.equal( isProbabilityArray.primitives( arr ), true, 'returns true' ); |
67 | | - |
68 | | - arr = new Float64Array( [ 0.9, 0.5, 0.3 ] ); |
69 | | - t.equal( isProbabilityArray( arr ), true, 'returns true' ); |
70 | | - |
71 | | - arr = [ new Number( 5 ), 1.0, 1.0 ]; // eslint-disable-line no-new-wrappers |
72 | | - t.equal( isProbabilityArray.primitives( arr ), false, 'returns false' ); |
73 | | - |
74 | | - t.end(); |
75 | | -}); |
76 | | - |
77 | | -tape( 'the function provides a method to test for an array-like object containing only containing only Number objects whose values are probabilities', function test( t ) { |
78 | | - var arr; |
79 | | - |
80 | | - arr = [ new Number( 0.5 ), new Number( 0.5 ) ]; // eslint-disable-line no-new-wrappers |
81 | | - t.equal( isProbabilityArray.objects( arr ), true, 'returns true' ); |
82 | | - |
83 | | - arr = { |
84 | | - 'length': 2, |
85 | | - '0': new Number( 0.3 ), // eslint-disable-line no-new-wrappers |
86 | | - '1': new Number( 0.8 ) // eslint-disable-line no-new-wrappers |
87 | | - }; |
88 | | - t.equal( isProbabilityArray( arr ), true, 'returns true' ); |
89 | | - |
90 | | - arr = [ 0.5, 0.0 ]; |
91 | | - t.equal( isProbabilityArray.objects( arr ), false, 'returns false' ); |
92 | | - |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
93 | 32 | t.end(); |
94 | 33 | }); |
0 commit comments