diff --git a/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/README.md b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/README.md new file mode 100644 index 000000000000..c00b9355aae7 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/README.md @@ -0,0 +1,154 @@ + + +# structFactory + +> Create a new [`struct`][@stdlib/dstructs/struct] constructor tailored to a specified floating-point data type. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var structFactory = require( '@stdlib/stats/base/ztest/two-sample/results/struct-factory' ); +``` + +#### structFactory( dtype ) + +Returns a new [`struct`][@stdlib/dstructs/struct] constructor tailored to a specified floating-point data type. + +```javascript +var Struct = structFactory( 'float64' ); +// returns + +var s = new Struct(); +// returns +``` + +The function supports the following parameters: + +- **dtype**: floating-point data type for storing floating-point results. Must be either `'float64'` or `'float32'`. + +
+ + + + + +
+ +## Notes + +- A [`struct`][@stdlib/dstructs/struct] provides a fixed-width composite data structure for storing two-sample Z-test results and provides an ABI-stable data layout for JavaScript-C interoperation. + +
+ + + + + +
+ +## Examples + + + +```javascript +var resolveEnum = require( '@stdlib/stats/base/ztest/alternative-resolve-enum' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Float32Array = require( '@stdlib/array/float32' ); +var structFactory = require( '@stdlib/stats/base/ztest/two-sample/results/struct-factory' ); + +var Struct = structFactory( 'float64' ); +var results = new Struct({ + 'rejected': true, + 'alpha': 0.05, + 'pValue': 0.0132, + 'statistic': 2.4773, + 'nullValue': 0.0, + 'xmean': 3.7561, + 'ymean': 3.0129, + 'ci': new Float64Array( [ 0.1552, 1.3311 ] ), + 'alternative': resolveEnum( 'two-sided' ) +}); + +var str = results.toString({ + 'format': 'linear' +}); +console.log( str ); + +Struct = structFactory( 'float32' ); +results = new Struct({ + 'rejected': true, + 'alpha': 0.05, + 'pValue': 0.0132, + 'statistic': 2.4773, + 'nullValue': 0.0, + 'xmean': 3.7561, + 'ymean': 3.0129, + 'ci': new Float32Array( [ 0.1552, 1.3311 ] ), + 'alternative': resolveEnum( 'two-sided' ) +}); + +str = results.toString({ + 'format': 'linear' +}); +console.log( str ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/benchmark/benchmark.js new file mode 100644 index 000000000000..f4c4a1b9ec96 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/benchmark/benchmark.js @@ -0,0 +1,54 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 bench = require( '@stdlib/bench' ); +var isFunction = require( '@stdlib/assert/is-function' ); +var pkg = require( './../package.json' ).name; +var factory = require( './../lib' ); + + +// MAIN // + +bench( pkg, function benchmark( b ) { + var values; + var v; + var i; + + values = [ + 'float64', + 'float32' + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = factory( values[ i%values.length ] ); + if ( typeof v !== 'function' ) { + b.fail( 'should return a function' ); + } + } + b.toc(); + if ( !isFunction( v ) ) { + b.fail( 'should return a function' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/docs/repl.txt b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/docs/repl.txt new file mode 100644 index 000000000000..20a4d663e618 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/docs/repl.txt @@ -0,0 +1,25 @@ + +{{alias}}( dtype ) + Returns a new struct constructor tailored to a specified floating-point data + type. + + Parameters + ---------- + dtype: string + Floating-point data type for storing floating-point results. + + Returns + ------- + fcn: Function + Struct constructor. + + Examples + -------- + > var S = {{alias}}( 'float64' ); + > var r = new S(); + > r.toString( { 'format': 'linear' } ) + + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/docs/types/index.d.ts new file mode 100644 index 000000000000..2bfa92386959 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/docs/types/index.d.ts @@ -0,0 +1,189 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 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. +*/ + +// TypeScript Version: 4.1 + +/** +* Interface describing test results. +*/ +interface Results { + /** + * Boolean indicating whether the null hypothesis was rejected. + */ + rejected?: boolean; + + /** + * Alternative hypothesis. + */ + alternative?: number; + + /** + * Significance level. + */ + alpha?: number; + + /** + * p-value. + */ + pValue?: number; + + /** + * Test statistic. + */ + statistic?: number; + + /** + * Confidence interval. + */ + ci?: T; + + /** + * Value of the mean under the null hypothesis. + */ + nullValue?: number; + + /** + * Sample mean of `x`. + */ + xmean?: number; + + /** + * Sample mean of `y`. + */ + ymean?: number; +} + +/** +* Interface describing a struct data structure. +*/ +declare class Struct { + /** + * Struct constructor. + * + * @param arg - buffer or data object + * @param byteOffset - byte offset + * @param byteLength - maximum byte length + * @returns struct + */ + constructor( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number ); + + /** + * Boolean indicating whether the null hypothesis was rejected. + */ + rejected: boolean; + + /** + * Alternative hypothesis. + */ + alternative: number; + + /** + * Significance level. + */ + alpha: number; + + /** + * p-value. + */ + pValue: number; + + /** + * Test statistic. + */ + statistic: number; + + /** + * Confidence interval. + */ + ci: T; + + /** + * Value of the mean under the null hypothesis + */ + nullValue: number; + + /** + * Sample mean of `x`. + */ + xmean: number; + + /** + * Sample mean of `y`. + */ + ymean: number; +} + +/** +* Interface defining a struct constructor which is both "newable" and "callable". +*/ +interface StructConstructor { + /** + * Struct constructor. + * + * @param arg - buffer or data object + * @param byteOffset - byte offset + * @param byteLength - maximum byte length + * @returns struct + */ + new( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number ): Struct; + + /** + * Struct constructor. + * + * @param arg - buffer or data object + * @param byteOffset - byte offset + * @param byteLength - maximum byte length + * @returns struct + */ + ( arg?: ArrayBuffer | Results, byteOffset?: number, byteLength?: number ): Struct; +} + +/** +* Returns a new struct constructor tailored to a specified floating-point data type. +* +* @param dtype - floating-point data type for storing floating-point results +* @returns struct constructor +* +* @example +* var Struct = structFactory( 'float64' ); +* // returns +* +* var s = new Struct(); +* // returns +*/ +declare function structFactory( dtype: 'float64' ): StructConstructor; + +/** +* Returns a new struct constructor tailored to a specified floating-point data type. +* +* @param dtype - floating-point data type for storing floating-point results +* @returns struct constructor +* +* @example +* var Struct = structFactory( 'float32' ); +* // returns +* +* var s = new Struct(); +* // returns +*/ +declare function structFactory( dtype: 'float32' ): StructConstructor; + + +// EXPORTS // + +export = structFactory; diff --git a/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/docs/types/test.ts b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/docs/types/test.ts new file mode 100644 index 000000000000..dd8f7ba98f06 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/docs/types/test.ts @@ -0,0 +1,56 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 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. +*/ + +import structFactory = require( './index' ); + + +// TESTS // + +// The function returns a function... +{ + structFactory( 'float64' ); // $ExpectType StructConstructor + structFactory( 'float32' ); // $ExpectType StructConstructor +} + +// The compiler throws an error if not provided a supported data type... +{ + structFactory( 10 ); // $ExpectError + structFactory( true ); // $ExpectError + structFactory( false ); // $ExpectError + structFactory( null ); // $ExpectError + structFactory( undefined ); // $ExpectError + structFactory( [] ); // $ExpectError + structFactory( {} ); // $ExpectError + structFactory( ( x: number ): number => x ); // $ExpectError +} + +// The function returns a function which returns a struct object... +{ + const Struct = structFactory( 'float64' ); + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const s1 = new Struct( new ArrayBuffer( 80 ) ); // $ExpectType Struct + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const s2 = new Struct( new ArrayBuffer( 80 ), 8 ); // $ExpectType Struct + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const s3 = new Struct( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType Struct +} + +// TODO: add individual parameter tests diff --git a/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/examples/index.js b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/examples/index.js new file mode 100644 index 000000000000..1c41dbbe2a0e --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/examples/index.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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'; + +var resolveEnum = require( '@stdlib/stats/base/ztest/alternative-resolve-enum' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Float32Array = require( '@stdlib/array/float32' ); +var structFactory = require( './../lib' ); + +var Struct = structFactory( 'float64' ); +var results = new Struct({ + 'rejected': true, + 'alpha': 0.05, + 'pValue': 0.0132, + 'statistic': 2.4773, + 'nullValue': 0.0, + 'xmean': 3.7561, + 'ymean': 3.0129, + 'ci': new Float64Array( [ 0.1552, 1.3311 ] ), + 'alternative': resolveEnum( 'two-sided' ) +}); + +var str = results.toString({ + 'format': 'linear' +}); +console.log( str ); + +Struct = structFactory( 'float32' ); +results = new Struct({ + 'rejected': true, + 'alpha': 0.05, + 'pValue': 0.0132, + 'statistic': 2.4773, + 'nullValue': 0.0, + 'xmean': 3.7561, + 'ymean': 3.0129, + 'ci': new Float32Array( [ 0.1552, 1.3311 ] ), + 'alternative': resolveEnum( 'two-sided' ) +}); + +str = results.toString({ + 'format': 'linear' +}); +console.log( str ); diff --git a/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/lib/index.js b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/lib/index.js new file mode 100644 index 000000000000..6192dae6b83d --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/lib/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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'; + +/** +* Create a new struct constructor tailored to a specified floating-point data type. +* +* @module @stdlib/stats/base/ztest/two-sample/results/struct-factory +* +* @example +* var structFactory = require( '@stdlib/stats/base/ztest/two-sample/results/struct-factory' ); +* +* var Struct = structFactory( 'float64' ); +* // returns +* +* var s = new Struct(); +* // returns +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/lib/main.js b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/lib/main.js new file mode 100644 index 000000000000..7a8b5bc9f710 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/lib/main.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 struct = require( '@stdlib/dstructs/struct' ); + + +// MAIN // + +/** +* Returns a new struct constructor tailored to a specified floating-point data type. +* +* @param {string} dtype - floating-point data type +* @returns {Function} struct constructor +* +* @example +* var Struct = factory( 'float64' ); +* // returns +* +* var s = new Struct(); +* // returns +*/ +function factory( dtype ) { + var schema = [ + { + 'name': 'rejected', + 'description': 'boolean indicating whether the null hypothesis was rejected', + 'type': 'bool', + 'castingMode': 'none' + }, + { + 'name': 'alternative', + 'description': 'alternative hypothesis', + 'type': 'int8', + 'castingMode': 'none' + }, + { + 'name': 'alpha', + 'description': 'significance level', + 'type': dtype, + 'castingMode': 'mostly-safe' + }, + { + 'name': 'pValue', + 'description': 'p-value', + 'type': dtype, + 'castingMode': 'mostly-safe' + }, + { + 'name': 'statistic', + 'description': 'test statistic', + 'type': dtype, + 'castingMode': 'mostly-safe' + }, + { + 'name': 'ci', + 'description': 'confidence interval', + 'type': dtype, + 'length': 2, + 'castingMode': 'mostly-safe' + }, + { + 'name': 'nullValue', + 'description': 'null value', + 'type': dtype, + 'castingMode': 'mostly-safe' + }, + { + 'name': 'xmean', + 'description': 'sample mean of `x`', + 'type': dtype, + 'castingMode': 'mostly-safe' + }, + { + 'name': 'ymean', + 'description': 'sample mean of `y`', + 'type': dtype, + 'castingMode': 'mostly-safe' + } + ]; + return struct( schema ); +} + + +// EXPORTS // + +module.exports = factory; diff --git a/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/package.json b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/package.json new file mode 100644 index 000000000000..c065f7c62683 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/stats/base/ztest/two-sample/results/struct-factory", + "version": "0.0.0", + "description": "Create a new struct constructor tailored to a specified floating-point data type.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stats", + "statistics", + "ztest", + "z-test", + "utilities", + "utility", + "utils", + "util", + "struct", + "results" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/test/test.js b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/test/test.js new file mode 100644 index 000000000000..3301b44edd16 --- /dev/null +++ b/lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/struct-factory/test/test.js @@ -0,0 +1,157 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' ); +var isSameFloat32Array = require( '@stdlib/assert/is-same-float32array' ); +var Float64Array = require( '@stdlib/array/float64' ); +var Float32Array = require( '@stdlib/array/float32' ); +var resolveEnum = require( '@stdlib/stats/base/ztest/alternative-resolve-enum' ); +var f32 = require( '@stdlib/number/float64/base/to-float32' ); +var structFactory = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof structFactory, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function throws an error if provided a first argument which is not a supported data type', function test( t ) { + var values; + var i; + + values = [ + '5', + 5, + NaN, + true, + false, + null, + void 0, + [], + {}, + function noop() {} + ]; + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + structFactory( value ); + }; + } +}); + +tape( 'the function returns a constructor for creating a fixed-width results object (dtype=float64)', function test( t ) { + var expected; + var actual; + var Struct; + + Struct = structFactory( 'float64' ); + t.strictEqual( typeof Struct, 'function', 'returns expected value' ); + + actual = new Struct({ + 'rejected': true, + 'alpha': 0.05, + 'pValue': 0.0132, + 'statistic': 2.4773, + 'nullValue': 0.0, + 'xmean': 3.7561, + 'ymean': 3.0129, + 'ci': new Float64Array( [ 0.1552, 1.3311 ] ), + 'alternative': resolveEnum( 'two-sided' ) + }); + + expected = { + 'rejected': true, + 'alpha': 0.05, + 'pValue': 0.0132, + 'statistic': 2.4773, + 'nullValue': 0.0, + 'xmean': 3.7561, + 'ymean': 3.0129, + 'ci': new Float64Array( [ 0.1552, 1.3311 ] ), + 'alternative': resolveEnum( 'two-sided' ) + }; + + t.strictEqual( actual instanceof Struct, true, 'returns expected value' ); + t.strictEqual( actual.rejected, expected.rejected, 'returns expected value' ); + t.strictEqual( actual.alpha, expected.alpha, 'returns expected value' ); + t.strictEqual( actual.pValue, expected.pValue, 'returns expected value' ); + t.strictEqual( actual.statistic, expected.statistic, 'returns expected value' ); + t.strictEqual( actual.nullValue, expected.nullValue, 'returns expected value' ); + t.strictEqual( actual.xmean, expected.xmean, 'returns expected value' ); + t.strictEqual( actual.ymean, expected.ymean, 'returns expected value' ); + t.strictEqual( actual.alternative, expected.alternative, 'returns expected value' ); + t.strictEqual( isSameFloat64Array( actual.ci, expected.ci ), true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a constructor for creating a fixed-width results object (dtype=float32)', function test( t ) { + var expected; + var actual; + var Struct; + + Struct = structFactory( 'float32' ); + t.strictEqual( typeof Struct, 'function', 'returns expected value' ); + + actual = new Struct({ + 'rejected': true, + 'alpha': f32( 0.05 ), + 'pValue': f32( 0.3364 ), + 'statistic': f32( 11.7586 ), + 'nullValue': f32( 0.0 ), + 'xmean': f32( 3.7561 ), + 'ymean': f32( 3.0129 ), + 'ci': new Float32Array( [ 9.9983, 11.4123 ] ), + 'alternative': resolveEnum( 'two-sided' ) + }); + + expected = { + 'rejected': true, + 'alpha': f32( 0.05 ), + 'pValue': f32( 0.3364 ), + 'statistic': f32( 11.7586 ), + 'nullValue': f32( 0.0 ), + 'xmean': f32( 3.7561 ), + 'ymean': f32( 3.0129 ), + 'ci': new Float32Array( [ 9.9983, 11.4123 ] ), + 'alternative': resolveEnum( 'two-sided' ) + }; + + t.strictEqual( actual instanceof Struct, true, 'returns expected value' ); + t.strictEqual( actual.rejected, expected.rejected, 'returns expected value' ); + t.strictEqual( actual.alpha, expected.alpha, 'returns expected value' ); + t.strictEqual( actual.pValue, expected.pValue, 'returns expected value' ); + t.strictEqual( actual.statistic, expected.statistic, 'returns expected value' ); + t.strictEqual( actual.nullValue, expected.nullValue, 'returns expected value' ); + t.strictEqual( actual.xmean, expected.xmean, 'returns expected value' ); + t.strictEqual( actual.ymean, expected.ymean, 'returns expected value' ); + t.strictEqual( actual.alternative, expected.alternative, 'returns expected value' ); + t.strictEqual( isSameFloat32Array( actual.ci, expected.ci ), true, 'returns expected value' ); + t.end(); +});