Skip to content

Commit a3d0ee8

Browse files
committed
test: ensure deterministic test values
--- 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 9452043 commit a3d0ee8

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ tape( 'the function computes exp(z) for complex z', opts, function test( t ) {
129129
t.strictEqual( imag( q ), expim[ i ], 'returns expected imaginary component' );
130130
} else {
131131
delta = abs( imag( q ) - expim[ i ] );
132-
tol = EPS * abs( expim[ i ] );
132+
tol = 2.0 * EPS * abs( expim[ i ] );
133133
t.ok( delta <= tol, 'within tolerance. z: '+re[i]+'+ '+im[i]+'i. imag: '+imag( q )+'. expected: '+expim[i]+'. delta: '+delta+'. tol: '+tol+'.' );
134134
}
135135
}

lib/node_modules/@stdlib/math/base/special/log/test/test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
var tape = require( 'tape' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
25-
var randu = require( '@stdlib/random/base/randu' );
26-
var round = require( '@stdlib/math/base/special/round' );
25+
var uniform = require( '@stdlib/random/base/uniform' );
2726
var ln = require( '@stdlib/math/base/special/ln' );
2827
var EPS = require( '@stdlib/constants/float64/eps' );
2928
var PINF = require( '@stdlib/constants/float64/pinf' );
@@ -101,13 +100,18 @@ tape( 'the function returns positive zero if provided `x = 1.0` and a valid `b`'
101100
});
102101

103102
tape( 'the function returns `ln(x) / ln(b)`', function test( t ) {
103+
var rand;
104104
var b;
105105
var x;
106106
var i;
107107

108+
rand = uniform.factory({
109+
'seed': 123
110+
});
111+
108112
for ( i = 0; i < 100; i++ ) {
109-
x = round( randu() * 100.0 ) + EPS;
110-
b = round( randu() * 5.0 ) + EPS;
113+
x = rand( EPS, 100.0 );
114+
b = rand( EPS, 5.0 );
111115
t.strictEqual( log( x, b ), ln( x ) / ln( b ), 'returns ln(x) / ln(b)' );
112116
}
113117
t.end();

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
var resolve = require( 'path' ).resolve;
2424
var tape = require( 'tape' );
2525
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26-
var randu = require( '@stdlib/random/base/randu' );
27-
var round = require( '@stdlib/math/base/special/round' );
26+
var uniform = require( '@stdlib/random/base/uniform' );
2827
var ln = require( '@stdlib/math/base/special/ln' );
2928
var EPS = require( '@stdlib/constants/float64/eps' );
3029
var PINF = require( '@stdlib/constants/float64/pinf' );
@@ -110,13 +109,18 @@ tape( 'the function returns positive zero if provided `x = 1.0` and a valid `b`'
110109
});
111110

112111
tape( 'the function returns `ln(x) / ln(b)`', opts, function test( t ) {
112+
var rand;
113113
var b;
114114
var x;
115115
var i;
116116

117+
rand = uniform.factory({
118+
'seed': 123
119+
});
120+
117121
for ( i = 0; i < 100; i++ ) {
118-
x = round( randu() * 100.0 ) + EPS;
119-
b = round( randu() * 5.0 ) + EPS;
122+
x = rand( EPS, 100.0 );
123+
b = rand( EPS, 5.0 );
120124
t.strictEqual( log( x, b ), ln( x ) / ln( b ), 'returns ln(x) / ln(b)' );
121125
}
122126
t.end();

0 commit comments

Comments
 (0)