Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions lib/node_modules/@stdlib/stats/chi2gof/test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
var tape = require( 'tape' );
var contains = require( '@stdlib/assert/contains' );
var poisson = require( '@stdlib/random/base/poisson' ).factory;
var abs = require( '@stdlib/math/base/special/abs' );
var EPS = require( '@stdlib/constants/float64/eps' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var zeros = require( '@stdlib/array/base/zeros' );
var chi2gof = require( './../lib' );

Expand Down Expand Up @@ -242,8 +241,6 @@

tape( 'the function correctly computes the chi-square goodness of fit test (when `y` is array of probabilities)', function test( t ) {
var expected;
var delta;
var tol;
var out;
var x;
var p;
Expand All @@ -254,23 +251,17 @@

// Tested against R:
expected = probs.pValue;
delta = abs( out.pValue - expected );
tol = 4.0 * EPS * abs( expected );
t.ok( delta <= tol, 'within tolerance. x: '+x+'. p: '+p+'. pValue: '+out.pValue+'. E: '+expected+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( isAlmostSameValue( out.pValue, expected, 4 ), true, 'returns expected value' );

expected = probs.statistic;
delta = abs( out.statistic - expected );
tol = 2.0 * EPS * abs( expected );
t.ok( delta <= tol, 'within tolerance. x: '+x+'. p: '+p+'. statistic: '+out.statistic+'. E: '+expected+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( isAlmostSameValue( out.statistic, expected, 2 ), true, 'returns expected value' );

t.end();
});

tape( 'the function correctly computes the chi-square goodness of fit test (when `y` is array of expected counts)', function test( t ) {
var expected;
var delta;
var out;
var tol;
var x;
var y;

Expand All @@ -280,14 +271,10 @@

// Tested against R:
expected = counts.pValue;
delta = abs( out.pValue - expected );
tol = 4.0 * EPS * abs( expected );
t.ok( delta <= tol, 'within tolerance. x: '+x+'. y: '+y+'. pValue: '+out.pValue+'. E: '+expected+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( isAlmostSameValue( out.pValue, expected, 4 ), true, 'returns expected value' );

expected = counts.statistic;
delta = abs( out.statistic - expected );
tol = 2.0 * EPS * abs( expected );
t.ok( delta <= tol, 'within tolerance. x: '+x+'. y: '+y+'. statistic: '+out.statistic+'. E: '+expected+'. Δ: '+delta+'. tol: '+tol );
t.strictEqual( isAlmostSameValue( out.statistic, expected, 2 ), true, 'returns expected value' );

t.end();
});
Expand Down Expand Up @@ -422,7 +409,7 @@
*/
t.strictEqual( typeof table, 'string', 'returns expected value' );

// FIXME: actually test for expected output; e.g., split into lines and do line-by-line comparison

Check warning on line 412 in lib/node_modules/@stdlib/stats/chi2gof/test/test.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'fixme' comment: 'FIXME: actually test for expected...'

t.end();
});
Expand Down Expand Up @@ -454,7 +441,7 @@
*/
t.strictEqual( typeof table, 'string', 'returns a pretty-printed table' );

// FIXME: this test does not actually assert the desired behavior!!!!

Check warning on line 444 in lib/node_modules/@stdlib/stats/chi2gof/test/test.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'fixme' comment: 'FIXME: this test does not actually...'

t.end();
});
Expand Down
Loading