Skip to content

Commit ba29660

Browse files
committed
test: migrate stats/base/dists/weibull/stdev to ULP-based assertions
Ref: #11352 --- 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: skipped - task: lint_markdown_pkg_readmes status: na - task: lint_markdown_docs status: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent d6dab16 commit ba29660

2 files changed

Lines changed: 4 additions & 22 deletions

File tree

‎lib/node_modules/@stdlib/stats/base/dists/weibull/stdev/test/test.js‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
// MODULES //
2222

2323
var tape = require( 'tape' );
24-
var abs = require( '@stdlib/math/base/special/abs' );
24+
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2626
var PINF = require( '@stdlib/constants/float64/pinf' );
2727
var NINF = require( '@stdlib/constants/float64/ninf' );
28-
var EPS = require( '@stdlib/constants/float64/eps' );
2928
var stdev = require( './../lib' );
3029

3130

@@ -97,8 +96,6 @@ tape( 'if provided `lambda <= 0`, the function returns `NaN`', function test( t
9796
tape( 'the function returns the standard deviation of a Weibull distribution', function test( t ) {
9897
var expected;
9998
var lambda;
100-
var delta;
101-
var tol;
10299
var k;
103100
var i;
104101
var y;
@@ -108,13 +105,7 @@ tape( 'the function returns the standard deviation of a Weibull distribution', f
108105
lambda = data.lambda;
109106
for ( i = 0; i < expected.length; i++ ) {
110107
y = stdev( k[i], lambda[i] );
111-
if ( y === expected[i] ) {
112-
t.strictEqual( y, expected[i], 'k: '+k[i]+', lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );
113-
} else {
114-
delta = abs( y - expected[ i ] );
115-
tol = 170.0 * EPS * abs( expected[ i ] );
116-
t.ok( delta <= tol, 'within tolerance. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
117-
}
108+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 277 ), true, 'returns expected value' );
118109
}
119110
t.end();
120111
});

‎lib/node_modules/@stdlib/stats/base/dists/weibull/stdev/test/test.native.js‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var tape = require( 'tape' );
25+
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
2526
var tryRequire = require( '@stdlib/utils/try-require' );
26-
var abs = require( '@stdlib/math/base/special/abs' );
2727
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2828
var PINF = require( '@stdlib/constants/float64/pinf' );
2929
var NINF = require( '@stdlib/constants/float64/ninf' );
30-
var EPS = require( '@stdlib/constants/float64/eps' );
3130

3231

3332
// VARIABLES //
@@ -106,8 +105,6 @@ tape( 'if provided `lambda <= 0`, the function returns `NaN`', opts, function te
106105
tape( 'the function returns the standard deviation of a Weibull distribution', opts, function test( t ) {
107106
var expected;
108107
var lambda;
109-
var delta;
110-
var tol;
111108
var k;
112109
var i;
113110
var y;
@@ -117,13 +114,7 @@ tape( 'the function returns the standard deviation of a Weibull distribution', o
117114
lambda = data.lambda;
118115
for ( i = 0; i < expected.length; i++ ) {
119116
y = stdev( k[i], lambda[i] );
120-
if ( y === expected[i] ) {
121-
t.strictEqual( y, expected[i], 'k: '+k[i]+', lambda: '+lambda[i]+', y: '+y+', expected: '+expected[i] );
122-
} else {
123-
delta = abs( y - expected[ i ] );
124-
tol = 180.0 * EPS * abs( expected[ i ] );
125-
t.ok( delta <= tol, 'within tolerance. k: '+k[i]+'. lambda: '+lambda[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' );
126-
}
117+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 277 ), true, 'returns expected value' );
127118
}
128119
t.end();
129120
});

0 commit comments

Comments
 (0)