diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/benchmark.native.js b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/benchmark.native.js index e800bb6313e4..cfe0aee8e78b 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/benchmark.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/benchmark.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,8 +23,8 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); var uniform = require( '@stdlib/random/array/uniform' ); -var format = require( '@stdlib/string/format' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var EPS = require( '@stdlib/constants/float64/eps' ); var tryRequire = require( '@stdlib/utils/try-require' ); var pkg = require( './../package.json' ).name; @@ -39,16 +39,16 @@ var opts = { // MAIN // -bench( format( '%s::native', pkg ), opts, function benchmark( b ) { - var opts; +bench( pkg+'::native', opts, function benchmark( b ) { + var kopts; var k; var y; var i; - opts = { + kopts = { 'dtype': 'float64' }; - k = uniform( 100, 1.0, 10.0, opts ); + k = uniform( 100, EPS, 20.0, kopts ); b.tic(); for ( i = 0; i < b.iterations; i++ ) { diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/c/Makefile index a4bd7b38fd74..77797913103d 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/c/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,10 +24,6 @@ else QUIET := endif -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 OS ?= $(shell uname) ifneq (, $(findstring MINGW,$(OS))) OS := WINNT @@ -45,101 +41,46 @@ endif endif endif -# Define the program used for compiling C source files: ifdef C_COMPILER CC := $(C_COMPILER) else CC := gcc endif -# Define the command-line options when compiling C files: CFLAGS ?= \ -std=c99 \ -O3 \ -Wall \ -pedantic -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option ifeq ($(OS), WINNT) fPIC ?= else fPIC ?= -fPIC endif -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): INCLUDE ?= - -# List of source files: SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): LIBPATH ?= -# List of C targets: c_targets := benchmark.out # RULES # -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ all: $(c_targets) .PHONY: all -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ $(c_targets): %.out: %.c $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) -#/ -# Runs compiled benchmarks. -# -# @example -# make run -#/ run: $(c_targets) $(QUIET) ./$< .PHONY: run -#/ -# Removes generated files. -# -# @example -# make clean -#/ clean: $(QUIET) -rm -f *.o *.out diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/c/benchmark.c b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/c/benchmark.c index 8e7c7ce9ef8e..2e537a450a61 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/c/benchmark.c +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/benchmark/c/benchmark.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/binding.gyp b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/binding.gyp index 68a1ca11d160..0d6508a12e99 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/binding.gyp +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/binding.gyp @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/examples/c/Makefile b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/examples/c/Makefile index 25ced822f96a..44ee674a1205 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/examples/c/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/examples/c/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,10 +24,6 @@ else QUIET := endif -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 OS ?= $(shell uname) ifneq (, $(findstring MINGW,$(OS))) OS := WINNT @@ -45,101 +41,46 @@ endif endif endif -# Define the program used for compiling C source files: ifdef C_COMPILER CC := $(C_COMPILER) else CC := gcc endif -# Define the command-line options when compiling C files: CFLAGS ?= \ -std=c99 \ -O3 \ -Wall \ -pedantic -# Determine whether to generate position independent code ([1][1], [2][2]). -# -# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options -# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option ifeq ($(OS), WINNT) fPIC ?= else fPIC ?= -fPIC endif -# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): INCLUDE ?= - -# List of source files: SOURCE_FILES ?= - -# List of libraries (e.g., `-lopenblas -lpthread`): LIBRARIES ?= - -# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): LIBPATH ?= -# List of C targets: c_targets := example.out # RULES # -#/ -# Compiles source files. -# -# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) -# @param {string} [CFLAGS] - C compiler options -# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) -# @param {string} [SOURCE_FILES] - list of source files -# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) -# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) -# -# @example -# make -# -# @example -# make all -#/ all: $(c_targets) .PHONY: all -#/ -# Compiles C source files. -# -# @private -# @param {string} CC - C compiler (e.g., `gcc`) -# @param {string} CFLAGS - C compiler options -# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) -# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) -# @param {string} SOURCE_FILES - list of source files -# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) -# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) -#/ $(c_targets): %.out: %.c $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) -#/ -# Runs compiled examples. -# -# @example -# make run -#/ run: $(c_targets) $(QUIET) ./$< .PHONY: run -#/ -# Removes generated files. -# -# @example -# make clean -#/ clean: $(QUIET) -rm -f *.o *.out diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/examples/c/example.c b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/examples/c/example.c index 69b7d92805ae..402d2472e16e 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/examples/c/example.c +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/examples/c/example.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,6 @@ int main( void ) { for ( i = 0; i < 25; i++ ) { k = random_uniform( 1.0, 10.0 ); y = stdlib_base_dists_chi_skewness( k ); - printf( "k: %lf, skew(X,k): %lf\n", k, y ); + printf( "k: %lf, skewness(X,k): %lf\n", k, y ); } } diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/include.gypi b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/include.gypi index ecfaf82a3279..bee8d41a2caf 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/include.gypi +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/include.gypi @@ -1,6 +1,6 @@ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/include/stdlib/stats/base/dists/chi/skewness.h b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/include/stdlib/stats/base/dists/chi/skewness.h index c4555aa33564..432f1aff61d1 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/include/stdlib/stats/base/dists/chi/skewness.h +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/include/stdlib/stats/base/dists/chi/skewness.h @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,9 @@ extern "C" { /** * Returns the skewness of a chi distribution. +* +* @param k degrees of freedom +* @return skewness */ double stdlib_base_dists_chi_skewness( const double k ); diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/lib/native.js b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/lib/native.js index 8ca45ba9f91c..d9646fad0f17 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/lib/native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/lib/native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ var addon = require( './../src/addon.node' ); * @returns {number} skewness * * @example -* var y = skewness( 9.0 ); +* var v = skewness( 9.0 ); * // returns ~0.252 * * @example @@ -41,11 +41,11 @@ var addon = require( './../src/addon.node' ); * // returns ~0.995 * * @example -* var v = skewness( 2.0 ); -* // returns ~0.631 +* var v = skewness( -0.2 ); +* // returns NaN * * @example -* var y = skewness( NaN ); +* var v = skewness( NaN ); * // returns NaN */ function skewness( k ) { diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/Makefile b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/Makefile index 7733b6180cb4..1ff65622ecb8 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/Makefile +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/Makefile @@ -1,7 +1,7 @@ #/ # @license Apache-2.0 # -# Copyright (c) 2025 The Stdlib Authors. +# Copyright (c) 2026 The Stdlib Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,47 +24,17 @@ else QUIET := endif -# Determine the OS ([1][1], [2][2]). -# -# [1]: https://en.wikipedia.org/wiki/Uname#Examples -# [2]: http://stackoverflow.com/a/27776822/2225624 -OS ?= $(shell uname) -ifneq (, $(findstring MINGW,$(OS))) - OS := WINNT -else -ifneq (, $(findstring MSYS,$(OS))) - OS := WINNT -else -ifneq (, $(findstring CYGWIN,$(OS))) - OS := WINNT -else -ifneq (, $(findstring Windows_NT,$(OS))) - OS := WINNT -endif -endif -endif -endif - # RULES # -#/ -# Removes generated files for building an add-on. -# -# @example -# make clean-addon -#/ -clean-addon: - $(QUIET) -rm -f *.o *.node - -.PHONY: clean-addon - #/ # Removes generated files. # # @example # make clean #/ -clean: clean-addon +clean: + $(QUIET) rm -f *.node + $(QUIET) rm -rf build .PHONY: clean diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/addon.c b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/addon.c index 11cfdbcb708b..2652eb7b3b6f 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/addon.c +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/addon.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,7 @@ * limitations under the License. */ -#include "stdlib/math/base/napi/unary.h" #include "stdlib/stats/base/dists/chi/skewness.h" +#include "stdlib/math/base/napi/unary.h" -// cppcheck-suppress shadowFunction STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_dists_chi_skewness ) diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/main.c b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/main.c index a60a6399ea8a..d2507d76c5fa 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/main.c +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/src/main.c @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,9 +18,9 @@ #include "stdlib/stats/base/dists/chi/skewness.h" #include "stdlib/math/base/assert/is_nan.h" -#include "stdlib/math/base/special/sqrt.h" -#include "stdlib/stats/base/dists/chi/mean.h" #include "stdlib/stats/base/dists/chi/variance.h" +#include "stdlib/stats/base/dists/chi/mean.h" +#include "stdlib/math/base/special/sqrt.h" /** * Returns the skewness of a chi distribution. @@ -41,11 +41,9 @@ double stdlib_base_dists_chi_skewness( const double k ) { if ( stdlib_base_is_nan( k ) || k <= 0.0 ) { return 0.0 / 0.0; // NaN } - mu = stdlib_base_dists_chi_mean( k ); - sigma2 = stdlib_base_dists_chi_variance( k ); - sigma = stdlib_base_sqrt( sigma2 ); + sigma = stdlib_base_sqrt( stdlib_base_dists_chi_variance( k ) ); + sigma2 = sigma * sigma; sigma3 = sigma2 * sigma; - return ( mu / sigma3 ) * ( 1.0 - ( 2.0 * sigma2 ) ); } diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/test/test.main.js b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/test/test.main.js new file mode 100644 index 000000000000..dd90c83f5a8e --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/test/test.main.js @@ -0,0 +1,101 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var proxyquire = require( 'proxyquire' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); + + +// FIXTURES // + +var data = require( './fixtures/julia/data.json' ); + + +// TESTS // + +tape( 'main export is a function (pure JavaScript fallback)', function test( t ) { + var skewness = proxyquire( './../lib/index.js', { + './native.js': new Error( 'Addon not found' ) + }); + + t.ok( true, __filename ); + t.strictEqual( typeof skewness, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'if provided `NaN` for `k`, the function returns `NaN` (pure JavaScript fallback)', function test( t ) { + var skewness = proxyquire( './../lib/index.js', { + './native.js': new Error( 'Addon not found' ) + }); + + var v = skewness( NaN ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'if provided a degrees of freedom parameter `k` that is not a positive number, the function returns `NaN` (pure JavaScript fallback)', function test( t ) { + var skewness = proxyquire( './../lib/index.js', { + './native.js': new Error( 'Addon not found' ) + }); + + var v; + + v = skewness( -1.0 ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + + v = skewness( 0.0 ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + + v = skewness( NINF ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function returns the skewness of a chi distribution (pure JavaScript fallback)', function test( t ) { + var skewness = proxyquire( './../lib/index.js', { + './native.js': new Error( 'Addon not found' ) + }); + + var expected; + var delta; + var tol; + var k; + var i; + var y; + + expected = data.expected; + k = data.k; + for ( i = 0; i < expected.length; i++ ) { + y = skewness( k[i] ); + if ( y === expected[i] ) { + t.strictEqual( y, expected[i], 'k:'+k[i]+', y: '+y+', expected: '+expected[i] ); + } else { + delta = abs( y - expected[ i ] ); + tol = 1e-11 * abs( expected[ i ] ); + t.ok( delta <= tol, 'within tolerance. k: '+k[i]+'. y: '+y+'. E: '+expected[ i ]+'. Δ: '+delta+'. tol: '+tol+'.' ); + } + } + t.end(); +}); diff --git a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/test/test.native.js b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/test/test.native.js index 2e2abe0e9b32..7962c88c62f4 100644 --- a/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/test/test.native.js +++ b/lib/node_modules/@stdlib/stats/base/dists/chi/skewness/test/test.native.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2025 The Stdlib Authors. +* Copyright (c) 2026 The Stdlib Authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,14 +22,10 @@ var resolve = require( 'path' ).resolve; var tape = require( 'tape' ); -var tryRequire = require( '@stdlib/utils/try-require' ); var isnan = require( '@stdlib/math/base/assert/is-nan' ); var abs = require( '@stdlib/math/base/special/abs' ); - - -// FIXTURES // - -var data = require( './fixtures/julia/data.json' ); +var NINF = require( '@stdlib/constants/float64/ninf' ); +var tryRequire = require( '@stdlib/utils/try-require' ); // VARIABLES // @@ -40,6 +36,11 @@ var opts = { }; +// FIXTURES // + +var data = require( './fixtures/julia/data.json' ); + + // TESTS // tape( 'main export is a function', opts, function test( t ) { @@ -48,20 +49,23 @@ tape( 'main export is a function', opts, function test( t ) { t.end(); }); -tape( 'if provided `NaN` for the parameter, the function returns `NaN`', opts, function test( t ) { - var y = skewness( NaN ); - t.strictEqual( isnan( y ), true, 'returns expected value' ); +tape( 'if provided `NaN` for `k`, the function returns `NaN`', opts, function test( t ) { + var v = skewness( NaN ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); }); -tape( 'if provided a non-positive `k`, the function returns `NaN`', opts, function test( t ) { - var y; +tape( 'if provided a degrees of freedom parameter `k` that is not a positive number, the function returns `NaN`', opts, function test( t ) { + var v; + + v = skewness( -1.0 ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); - y = skewness( -1.0 ); - t.strictEqual( isnan( y ), true, 'returns expected value' ); + v = skewness( 0.0 ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); - y = skewness( 0.0 ); - t.strictEqual( isnan( y ), true, 'returns expected value' ); + v = skewness( NINF ); + t.strictEqual( isnan( v ), true, 'returns expected value' ); t.end(); });