2222
2323var tape = require ( 'tape' ) ;
2424var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
25- var EPS = require ( '@stdlib/constants/float64/eps' ) ;
2625var PINF = require ( '@stdlib/constants/float64/pinf' ) ;
2726var 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 ' ) ;
2928var Complex128 = require ( '@stdlib/complex/float64/ctor' ) ;
3029var cabs = require ( './../lib' ) ;
3130
@@ -45,8 +44,6 @@ tape( 'main export is a function', function test( t ) {
4544
4645tape ( '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