Skip to content

Commit bc1409c

Browse files
committed
test: add tests to achieve 100% code coverage
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 5470254 commit bc1409c

File tree

1 file changed

+28
-0
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/triangular/ctor/test

1 file changed

+28
-0
lines changed

lib/node_modules/@stdlib/stats/base/dists/triangular/ctor/test/test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var logcdf = require( '@stdlib/stats/base/dists/triangular/logcdf' );
2828
var logpdf = require( '@stdlib/stats/base/dists/triangular/logpdf' );
2929
var cdf = require( '@stdlib/stats/base/dists/triangular/cdf' );
3030
var pdf = require( '@stdlib/stats/base/dists/triangular/pdf' );
31+
var mgf = require( '@stdlib/stats/base/dists/triangular/mgf' );
3132
var kurtosis = require( '@stdlib/stats/base/dists/triangular/kurtosis' );
3233
var skewness = require( '@stdlib/stats/base/dists/triangular/skewness' );
3334
var variance = require( '@stdlib/stats/base/dists/triangular/variance' );
@@ -328,6 +329,19 @@ tape( 'the created distribution throws an error if one attempts to set `b` to a
328329
}
329330
});
330331

332+
tape( 'the created distribution has a property for getting and setting `c`', function test( t ) {
333+
var triangular;
334+
335+
triangular = new Triangular( 2.0, 4.0, 2.5 );
336+
t.strictEqual( hasOwnProp( triangular, 'c' ), true, 'has property' );
337+
t.strictEqual( triangular.c, 2.5, 'returns expected value' );
338+
339+
triangular.c = 3.0;
340+
t.strictEqual( triangular.c, 3.0, 'returns expected value' );
341+
342+
t.end();
343+
});
344+
331345
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 ) {
332346
var values;
333347
var i;
@@ -525,6 +539,20 @@ tape( 'the distribution prototype has a method for evaluating the probability de
525539
t.end();
526540
});
527541

542+
tape( 'the distribution prototype has a method for evaluating the moment-generating function (MGF)', function test( t ) {
543+
var triangular;
544+
var y;
545+
546+
t.strictEqual( hasOwnProp( Triangular.prototype, 'mgf' ), true, 'has property' );
547+
t.strictEqual( isFunction( Triangular.prototype.mgf ), true, 'has method' );
548+
549+
triangular = new Triangular();
550+
y = triangular.mgf( 0.2 );
551+
552+
t.strictEqual( y, mgf( 0.2, 0.0, 1.0, 0.5 ), 'returns expected value' );
553+
t.end();
554+
});
555+
528556
tape( 'the distribution prototype has a method for evaluating the quantile function', function test( t ) {
529557
var triangular;
530558
var y;

0 commit comments

Comments
 (0)