Skip to content

Commit d27c12a

Browse files
authored
fix: update test.native.js
Signed-off-by: Shabareesh Shetty <[email protected]>
1 parent 89aaef1 commit d27c12a

File tree

1 file changed

+15
-8
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/variance/test

1 file changed

+15
-8
lines changed

lib/node_modules/@stdlib/stats/base/dists/kumaraswamy/variance/test/test.native.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ var tape = require( 'tape' );
2525
var tryRequire = require( '@stdlib/utils/try-require' );
2626
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
2727
var isnan = require( '@stdlib/math/base/assert/is-nan' );
28-
var randu = require( '@stdlib/random/base/randu' );
2928
var PINF = require( '@stdlib/constants/float64/pinf' );
3029
var NINF = require( '@stdlib/constants/float64/ninf' );
3130
var EPS = require( '@stdlib/constants/float64/eps' );
3231

3332

33+
// FIXTURES //
34+
35+
var data = require( './fixtures/julia/data.json' );
36+
37+
3438
// VARIABLES //
3539

3640
var variance = tryRequire( resolve( __dirname, './../lib/native.js' ) );
@@ -112,17 +116,20 @@ tape( 'if provided a nonpositive `b`, the function returns `NaN`', opts, functio
112116
});
113117

114118
tape( 'the function returns the variance of a Kumaraswamy\'s double bounded distribution', opts, function test( t ) {
119+
var expected;
115120
var a;
116121
var b;
117-
var i;
118122
var y;
123+
var i;
119124

120-
// TODO: Add fixtures
121-
for ( i = 0; i < 100; i++ ) {
122-
a = ( randu()*5.0 ) + EPS;
123-
b = ( randu()*5.0 ) + EPS;
124-
y = variance( a, b );
125-
t.equal( isNumber( y ), true, 'returns a number' );
125+
expected = data.expected;
126+
a = data.a;
127+
b = data.b;
128+
for ( i in a ) {
129+
if (Object.prototype.hasOwnProperty.call(a, i)) {
130+
y = variance( a[i], b[i] );
131+
t.equal( y, expected[i], 'a :'+a[i]+', b: '+b[i]+', y: '+y+', expected: '+expected[i] );
132+
}
126133
}
127134
t.end();
128135
});

0 commit comments

Comments
 (0)