Skip to content

Commit

Permalink
fix: changes in test.native
Browse files Browse the repository at this point in the history
---
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: passed
---
  • Loading branch information
0PrashantYadav0 committed Dec 26, 2024
1 parent cb5c584 commit f7083fb
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@ var data = require( './fixtures/julia/data.json' );

// VARIABLES //

var median = tryRequire( resolve( __dirname, './../lib/native.js' ) );
var skewness = tryRequire( resolve( __dirname, './../lib/native.js' ) );
var opts = {
'skip': ( median instanceof Error )
'skip': ( skewness instanceof Error )
};


// TESTS //

tape( 'main export is a function', opts, function test( t ) {
t.ok( true, __filename );
t.strictEqual( typeof median, 'function', 'main export is a function' );
t.strictEqual( typeof skewness, 'function', 'main export is a function' );
t.end();
});

tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, function test( t ) {
var v = median( NaN, 1.0, 0.5 );
var v = skewness( NaN, 1.0, 0.5 );
t.equal( isnan( v ), true, 'returns NaN' );

v = median( 0.0, NaN, 0.5 );
v = skewness( 0.0, NaN, 0.5 );
t.equal( isnan( v ), true, 'returns NaN' );

v = median( 0.0, 10.0, NaN );
v = skewness( 0.0, 10.0, NaN );
t.equal( isnan( v ), true, 'returns NaN' );

t.end();
Expand All @@ -65,22 +65,22 @@ tape( 'if provided `NaN` for any parameter, the function returns `NaN`', opts, f
tape( 'if provided parameters not satisfying `a <= c <= b`, the function returns `NaN`', opts, function test( t ) {
var y;

y = median( -1.0, -1.1, -1.0 );
y = skewness( -1.0, -1.1, -1.0 );
t.equal( isnan( y ), true, 'returns NaN' );

y = median( 3.0, 2.0, 2.5 );
y = skewness( 3.0, 2.0, 2.5 );
t.equal( isnan( y ), true, 'returns NaN' );

y = median( 0.0, 1.0, -1.0 );
y = skewness( 0.0, 1.0, -1.0 );
t.equal( isnan( y ), true, 'returns NaN' );

y = median( 0.0, 1.0, 2.0 );
y = skewness( 0.0, 1.0, 2.0 );
t.equal( isnan( y ), true, 'returns NaN' );

t.end();
});

tape( 'the function returns the median of a triangular distribution', opts, function test( t ) {
tape( 'the function returns the skewness of a triangular distribution', opts, function test( t ) {
var expected;
var delta;
var tol;
Expand All @@ -95,7 +95,7 @@ tape( 'the function returns the median of a triangular distribution', opts, func
b = data.b;
c = data.c;
for ( i = 0; i < expected.length; i++ ) {
y = median( a[i], b[i], c[i] );
y = skewness( a[i], b[i], c[i] );
if ( y === expected[i] ) {
t.equal( y, expected[i], 'a: '+a[i]+', b: '+b[i]+', c: '+c[i]+', y: '+y+', expected: '+expected[i] );
} else {
Expand Down

0 comments on commit f7083fb

Please sign in to comment.