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
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var logcdf = require( '@stdlib/stats/base/dists/triangular/logcdf' );
var logpdf = require( '@stdlib/stats/base/dists/triangular/logpdf' );
var cdf = require( '@stdlib/stats/base/dists/triangular/cdf' );
var pdf = require( '@stdlib/stats/base/dists/triangular/pdf' );
var mgf = require( '@stdlib/stats/base/dists/triangular/mgf' );
var kurtosis = require( '@stdlib/stats/base/dists/triangular/kurtosis' );
var skewness = require( '@stdlib/stats/base/dists/triangular/skewness' );
var variance = require( '@stdlib/stats/base/dists/triangular/variance' );
Expand Down Expand Up @@ -328,6 +329,19 @@ tape( 'the created distribution throws an error if one attempts to set `b` to a
}
});

tape( 'the created distribution has a property for getting and setting `c`', function test( t ) {
var triangular;

triangular = new Triangular( 2.0, 4.0, 2.5 );
t.strictEqual( hasOwnProp( triangular, 'c' ), true, 'has property' );
t.strictEqual( triangular.c, 2.5, 'returns expected value' );

triangular.c = 3.0;
t.strictEqual( triangular.c, 3.0, 'returns expected value' );

t.end();
});

tape( 'the created distribution throws an error if one attempts to set `c` to a value which is not a number primitive', function test( t ) {
var values;
var i;
Expand Down Expand Up @@ -525,6 +539,20 @@ tape( 'the distribution prototype has a method for evaluating the probability de
t.end();
});

tape( 'the distribution prototype has a method for evaluating the moment-generating function (MGF)', function test( t ) {
var triangular;
var y;

t.strictEqual( hasOwnProp( Triangular.prototype, 'mgf' ), true, 'has property' );
t.strictEqual( isFunction( Triangular.prototype.mgf ), true, 'has method' );

triangular = new Triangular();
y = triangular.mgf( 0.2 );

t.strictEqual( y, mgf( 0.2, 0.0, 1.0, 0.5 ), 'returns expected value' );
t.end();
});

tape( 'the distribution prototype has a method for evaluating the quantile function', function test( t ) {
var triangular;
var y;
Expand Down