Skip to content

Commit 06e1536

Browse files
authored
test: migrate math/base/special/cabs to ULP-based testing
PR-URL: #11758 Reviewed-by: Athan Reines <kgryte@gmail.com> Ref: #11352
1 parent 35051b4 commit 06e1536

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

  • lib/node_modules/@stdlib/math/base/special/cabs/test

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

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

2323
var tape = require( 'tape' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
25-
var EPS = require( '@stdlib/constants/float64/eps' );
2625
var PINF = require( '@stdlib/constants/float64/pinf' );
2726
var NINF = require( '@stdlib/constants/float64/ninf' );
28-
var abs = require( '@stdlib/math/base/special/abs' );
27+
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
2928
var Complex128 = require( '@stdlib/complex/float64/ctor' );
3029
var cabs = require( './../lib' );
3130

@@ -45,8 +44,6 @@ tape( 'main export is a function', function test( t ) {
4544

4645
tape( 'the function computes the absolute value of a complex number', function test( t ) {
4746
var expected;
48-
var delta;
49-
var tol;
5047
var re;
5148
var im;
5249
var y;
@@ -58,13 +55,7 @@ tape( 'the function computes the absolute value of a complex number', function t
5855

5956
for ( i = 0; i < re.length; i++ ) {
6057
y = cabs( new Complex128( re[ i ], im[ i ] ) );
61-
if ( y === expected[ i ] ) {
62-
t.strictEqual( y, expected[ i ], 're: '+re[i]+'. im: '+im[i]+'. Expected: '+expected[i] );
63-
} else {
64-
delta = abs( y - expected[i] );
65-
tol = EPS * abs( expected[i] );
66-
t.ok( delta <= tol, 'within tolerance. re: '+re[i]+'. im: '+im[i]+' y: '+y+'. Expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' );
67-
}
58+
t.strictEqual( isAlmostSameValue( y, expected[ i ], 1 ), true, 'returns expected value' );
6859
}
6960
t.end();
7061
});

0 commit comments

Comments
 (0)