Skip to content

Commit 97e9f3d

Browse files
committed
test: apply suggestions from review
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 8e9e7c4 commit 97e9f3d

File tree

1 file changed

+47
-38
lines changed
  • lib/node_modules/@stdlib/math/base/special/bessely1/test

1 file changed

+47
-38
lines changed

lib/node_modules/@stdlib/math/base/special/bessely1/test/test.native.js

Lines changed: 47 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,23 @@
2020

2121
// MODULES //
2222

23+
var resolve = require( 'path' ).resolve;
2324
var tape = require( 'tape' );
2425
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2526
var randu = require( '@stdlib/random/base/randu' );
2627
var PINF = require( '@stdlib/constants/float64/pinf' );
2728
var NINF = require( '@stdlib/constants/float64/ninf' );
2829
var EPS = require( '@stdlib/constants/float64/eps' );
2930
var abs = require( '@stdlib/math/base/special/abs' );
30-
var y1 = require( './../lib' );
31+
var tryRequire = require( '@stdlib/utils/try-require' );
32+
33+
34+
// VARIABLES //
35+
36+
var y1 = tryRequire( resolve( __dirname, './../lib/native.js' ) );
37+
var opts = {
38+
'skip': ( y1 instanceof Error )
39+
};
3140

3241

3342
// FIXTURES //
@@ -45,13 +54,13 @@ var subnormal = require( './fixtures/julia/subnormal.json' );
4554

4655
// TESTS //
4756

48-
tape( 'main export is a function', function test( t ) {
57+
tape( 'main export is a function', opts, function test( t ) {
4958
t.ok( true, __filename );
5059
t.strictEqual( typeof y1, 'function', 'main export is a function' );
5160
t.end();
5261
});
5362

54-
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (very large positive values)', function test( t ) {
63+
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (very large positive values)', opts, function test( t ) {
5564
var expected;
5665
var delta;
5766
var tol;
@@ -64,17 +73,17 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
6473
for ( i = 0; i < x.length; i++ ) {
6574
y = y1( x[i] );
6675
if ( y === expected[i] ) {
67-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
76+
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
6877
} else {
6978
delta = abs( y - expected[i] );
7079
tol = 300.0 * EPS * abs( expected[i] );
71-
t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
80+
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
7281
}
7382
}
7483
t.end();
7584
});
7685

77-
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (large positive values)', function test( t ) {
86+
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (large positive values)', opts, function test( t ) {
7887
var expected;
7988
var delta;
8089
var tol;
@@ -87,17 +96,17 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
8796
for ( i = 0; i < x.length; i++ ) {
8897
y = y1( x[i] );
8998
if ( y === expected[i] ) {
90-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
99+
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
91100
} else {
92101
delta = abs( y - expected[i] );
93102
tol = 600.0 * EPS * abs( expected[i] );
94-
t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
103+
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
95104
}
96105
}
97106
t.end();
98107
});
99108

100-
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (medium positive values)', function test( t ) {
109+
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (medium positive values)', opts, function test( t ) {
101110
var expected;
102111
var delta;
103112
var tol;
@@ -110,17 +119,17 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
110119
for ( i = 0; i < x.length; i++ ) {
111120
y = y1( x[i] );
112121
if ( y === expected[i] ) {
113-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
122+
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
114123
} else {
115124
delta = abs( y - expected[i] );
116125
tol = 300.0 * EPS * abs( expected[i] );
117-
t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
126+
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
118127
}
119128
}
120129
t.end();
121130
});
122131

123-
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (small positive values)', function test( t ) {
132+
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (small positive values)', opts, function test( t ) {
124133
var expected;
125134
var delta;
126135
var tol;
@@ -133,17 +142,17 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
133142
for ( i = 0; i < x.length; i++ ) {
134143
y = y1( x[i] );
135144
if ( y === expected[i] ) {
136-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
145+
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
137146
} else {
138147
delta = abs( y - expected[i] );
139148
tol = 1800.0 * EPS * abs( expected[i] );
140-
t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
149+
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
141150
}
142151
}
143152
t.end();
144153
});
145154

146-
tape( 'the function evaluates Bessel function of the second kind of one order (Y_1) (smaller positive values)', function test( t ) {
155+
tape( 'the function evaluates Bessel function of the second kind of one order (Y_1) (smaller positive values)', opts, function test( t ) {
147156
var expected;
148157
var delta;
149158
var tol;
@@ -156,17 +165,17 @@ tape( 'the function evaluates Bessel function of the second kind of one order (Y
156165
for ( i = 0; i < x.length; i++ ) {
157166
y = y1( x[i] );
158167
if ( y === expected[i] ) {
159-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
168+
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
160169
} else {
161170
delta = abs( y - expected[i] );
162171
tol = 4.5 * EPS * abs( expected[i] );
163-
t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
172+
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
164173
}
165174
}
166175
t.end();
167176
});
168177

169-
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (tiny positive values)', function test( t ) {
178+
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (tiny positive values)', opts, function test( t ) {
170179
var expected;
171180
var delta;
172181
var tol;
@@ -179,30 +188,30 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
179188
for ( i = 0; i < x.length; i++ ) {
180189
y = y1( x[i] );
181190
if ( y === expected[i] ) {
182-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
191+
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
183192
} else {
184193
delta = abs( y - expected[i] );
185194
tol = 8.0 * EPS * abs( expected[i] );
186-
t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
195+
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
187196
}
188197
}
189198
t.end();
190199
});
191200

192-
tape( 'The Bessel function of the second kind of one order (Y_1) (subnormal values)', function test( t ) {
201+
tape( 'The Bessel function of the second kind of one order (Y_1) (subnormal values)', opts, function test( t ) {
193202
var x;
194203
var y;
195204
var i;
196205

197206
x = subnormal.x;
198207
for ( i = 0; i < x.length; i++ ) {
199208
y = y1( x[i] );
200-
t.equal( y, NINF, 'returns expected value' );
209+
t.strictEqual( y, NINF, 'returns -Infinity' );
201210
}
202211
t.end();
203212
});
204213

205-
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (huge positive values)', function test( t ) {
214+
tape( 'the function evaluates the Bessel function of the second kind of one order (Y_1) (huge positive values)', opts, function test( t ) {
206215
var expected;
207216
var delta;
208217
var tol;
@@ -215,17 +224,17 @@ tape( 'the function evaluates the Bessel function of the second kind of one orde
215224
for ( i = 0; i < x.length; i++ ) {
216225
y = y1( x[i] );
217226
if ( y === expected[i] ) {
218-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
227+
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
219228
} else {
220229
delta = abs( y - expected[i] );
221230
tol = 4500.0 * EPS * abs( expected[i] );
222-
t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
231+
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. Tolerance: '+tol+'.' );
223232
}
224233
}
225234
t.end();
226235
});
227236

228-
tape( 'the function evaluates the Bessel function of the second kind of order one (Y_1) for positive x over a wide range of magnitudes', function test( t ) {
237+
tape( 'the function evaluates the Bessel function of the second kind of order one (Y_1) for positive x over a wide range of magnitudes', opts, function test( t ) {
229238
var expected;
230239
var delta;
231240
var tol;
@@ -238,49 +247,49 @@ tape( 'the function evaluates the Bessel function of the second kind of order on
238247
for ( i = 0; i < x.length; i++ ) {
239248
y = y1( x[i] );
240249
if ( y === expected[i] ) {
241-
t.equal( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
250+
t.strictEqual( y, expected[i], 'x: '+x[i]+', y: '+y+', expected: '+expected[i] );
242251
} else {
243252
delta = abs( y - expected[i] );
244253
tol = 16.0 * EPS * abs( expected[i] );
245-
t.equal( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
254+
t.strictEqual( delta <= tol, true, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. Δ: '+delta+'. tol: '+tol+'.' );
246255
}
247256
}
248257
t.end();
249258
});
250259

251-
tape( 'the function returns `NaN` for negative numbers', function test( t ) {
260+
tape( 'the function returns `NaN` for negative numbers', opts, function test( t ) {
252261
var v;
253262
var x;
254263
var i;
255264

256265
for ( i = 0; i < 1000; i++ ) {
257266
x = -( randu() * 100.0 ) - EPS;
258267
v = y1( x );
259-
t.equal( isnan( v ), true, 'returns expected value' );
268+
t.strictEqual( isnan( v ), true, 'returns expected value' );
260269
}
261270
t.end();
262271
});
263272

264-
tape( 'the function returns `-Infinity` if provided `0`', function test( t ) {
273+
tape( 'the function returns `-Infinity` if provided `0`', opts, function test( t ) {
265274
var v = y1( 0.0 );
266-
t.equal( v, NINF, 'returns expected value' );
275+
t.strictEqual( v, NINF, 'returns -Infinity' );
267276
t.end();
268277
});
269278

270-
tape( 'the function returns `NaN` if provided `NaN`', function test( t ) {
279+
tape( 'the function returns `NaN` if provided `NaN`', opts, function test( t ) {
271280
var v = y1( NaN );
272-
t.equal( isnan( v ), true, 'returns expected value' );
281+
t.strictEqual( isnan( v ), true, 'returns expected value' );
273282
t.end();
274283
});
275284

276-
tape( 'the function returns `0.0` if provided `+infinity`', function test( t ) {
285+
tape( 'the function returns `0.0` if provided `+infinity`', opts, function test( t ) {
277286
var v = y1( PINF );
278-
t.equal( v, 0.0, 'returns expected value' );
287+
t.strictEqual( v, 0.0, 'returns 0.0' );
279288
t.end();
280289
});
281290

282-
tape( 'the function returns `NaN` if provided `-infinity`', function test( t ) {
291+
tape( 'the function returns `NaN` if provided `-infinity`', opts, function test( t ) {
283292
var v = y1( NINF );
284-
t.equal( isnan( v ), true, 'returns expected value' );
293+
t.strictEqual( isnan( v ), true, 'returns expected value' );
285294
t.end();
286295
});

0 commit comments

Comments
 (0)