2222
2323var resolve = require ( 'path' ) . resolve ;
2424var tape = require ( 'tape' ) ;
25+ var isAlmostSameValue = require ( '@stdlib/assert/is-almost-same-value' ) ;
2526var isnan = require ( '@stdlib/math/base/assert/is-nan' ) ;
2627var tryRequire = require ( '@stdlib/utils/try-require' ) ;
27- var abs = require ( '@stdlib/math/base/special/abs' ) ;
2828var PINF = require ( '@stdlib/constants/float64/pinf' ) ;
2929var NINF = require ( '@stdlib/constants/float64/ninf' ) ;
30- var EPS = require ( '@stdlib/constants/float64/eps' ) ;
3130
3231
3332// FIXTURES //
@@ -105,10 +104,8 @@ tape( 'if provided `beta <= 0`, the function returns `NaN`', opts, function test
105104
106105tape ( 'the function returns the differential entropy of a beta distribution' , opts , function test ( t ) {
107106 var expected ;
108- var delta ;
109107 var alpha ;
110108 var beta ;
111- var tol ;
112109 var i ;
113110 var y ;
114111
@@ -117,13 +114,7 @@ tape( 'the function returns the differential entropy of a beta distribution', op
117114 beta = data . beta ;
118115 for ( i = 0 ; i < expected . length ; i ++ ) {
119116 y = entropy ( alpha [ i ] , beta [ i ] ) ;
120- if ( y === expected [ i ] ) {
121- t . strictEqual ( y , expected [ i ] , 'alpha: ' + alpha [ i ] + ', beta: ' + beta [ i ] + ', y: ' + y + ', expected: ' + expected [ i ] ) ;
122- } else {
123- delta = abs ( y - expected [ i ] ) ;
124- tol = 250.0 * EPS * abs ( expected [ i ] ) ;
125- t . ok ( delta <= tol , 'within tolerance. alpha: ' + alpha [ i ] + '. beta: ' + beta [ i ] + '. y: ' + y + '. E: ' + expected [ i ] + '. Δ: ' + delta + '. tol: ' + tol + '.' ) ;
126- }
117+ t . strictEqual ( isAlmostSameValue ( y , expected [ i ] , 384 ) , true , 'returns expected value' ) ;
127118 }
128119 t . end ( ) ;
129120} ) ;
0 commit comments