2121// MODULES //
2222
2323var tape = require ( 'tape' ) ;
24+ var isAlmostSameValue = require ( '@stdlib/assert/is-almost-same-value' ) ;
2425var contains = require ( '@stdlib/assert/contains' ) ;
25- var abs = require ( '@stdlib/math/base/special/abs' ) ;
26- var EPS = require ( '@stdlib/constants/float64/eps' ) ;
2726var leveneTest = require ( './../lib' ) ;
2827
2928
@@ -162,8 +161,6 @@ tape( 'the function throws an error if the `groups` option array does not contai
162161
163162tape ( 'the function correctly computes Levene\'s test for homogeneity of variance' , function test ( t ) {
164163 var expected ;
165- var delta ;
166- var tol ;
167164 var out ;
168165
169166 out = leveneTest ( fixtures . x , {
@@ -172,14 +169,10 @@ tape( 'the function correctly computes Levene\'s test for homogeneity of varianc
172169
173170 // Tested against R:
174171 expected = fixtures . pValue ;
175- delta = abs ( out . pValue - expected ) ;
176- tol = 2.0 * EPS * abs ( expected ) ;
177- t . ok ( delta <= tol , 'within tolerance. p-value: ' + out . pValue + '. E: ' + expected + ' Δ: ' + delta + '. tol: ' + tol ) ;
172+ t . strictEqual ( isAlmostSameValue ( out . pValue , expected , 2 ) , true , 'returns expected value' ) ;
178173
179174 expected = fixtures . statistic ;
180- delta = abs ( out . statistic - expected ) ;
181- tol = 2.0 * EPS * abs ( expected ) ;
182- t . ok ( delta <= tol , 'within tolerance. test statistic: ' + out . statistic + '. E: ' + expected + ' Δ: ' + delta + '. tol: ' + tol ) ;
175+ t . strictEqual ( isAlmostSameValue ( out . statistic , expected , 1 ) , true , 'returns expected value' ) ;
183176
184177 t . end ( ) ;
185178} ) ;
0 commit comments