Skip to content

Commit eaf388a

Browse files
committed
fixup! feat: add protocol support to stats/base/varianceyc
--- 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 ---
1 parent 3437c9c commit eaf388a

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

lib/node_modules/@stdlib/stats/base/varianceyc/test/test.ndarray.js

+42
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,21 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu
130130
t.end();
131131
});
132132

133+
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `NaN` (accessor)', function test( t ) {
134+
var x;
135+
var v;
136+
137+
x = toAccessorArray([ 1.0, -2.0, -4.0, 5.0, 3.0 ]);
138+
139+
v = varianceyc( 0, 1, x, 1, 0 );
140+
t.strictEqual( isnan( v ), true, 'returns expected value' );
141+
142+
v = varianceyc( -1, 1, x, 1, 0 );
143+
t.strictEqual( isnan( v ), true, 'returns expected value' );
144+
145+
t.end();
146+
});
147+
133148
tape( 'if provided an `N` parameter equal to `1`, the function returns a population variance of `0`', function test( t ) {
134149
var x;
135150
var v;
@@ -142,6 +157,18 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns a populat
142157
t.end();
143158
});
144159

160+
tape( 'if provided an `N` parameter equal to `1`, the function returns a population variance of `0` (accessor)', function test( t ) {
161+
var x;
162+
var v;
163+
164+
x = toAccessorArray([ 1.0, -2.0, -4.0, 5.0, 3.0 ]);
165+
166+
v = varianceyc( 1, 0, x, 1, 0 );
167+
t.strictEqual( v, 0.0, 'returns expected value' );
168+
169+
t.end();
170+
});
171+
145172
tape( 'if provided a `correction` parameter yielding `N-correction` less than or equal to `0`, the function returns `NaN`', function test( t ) {
146173
var x;
147174
var v;
@@ -157,6 +184,21 @@ tape( 'if provided a `correction` parameter yielding `N-correction` less than or
157184
t.end();
158185
});
159186

187+
tape( 'if provided a `correction` parameter yielding `N-correction` less than or equal to `0`, the function returns `NaN (accessor)`', function test( t ) {
188+
var x;
189+
var v;
190+
191+
x = toAccessorArray([ 1.0, -2.0, -4.0, 5.0, 3.0 ]);
192+
193+
v = varianceyc( x.length, x.length, x, 1, 0 );
194+
t.strictEqual( isnan( v ), true, 'returns expected value' );
195+
196+
v = varianceyc( x.length, x.length+1, x, 1, 0 );
197+
t.strictEqual( isnan( v ), true, 'returns expected value' );
198+
199+
t.end();
200+
});
201+
160202
tape( 'the function supports a `stride` parameter', function test( t ) {
161203
var x;
162204
var v;

lib/node_modules/@stdlib/stats/base/varianceyc/test/test.varianceyc.js

+42
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,21 @@ tape( 'if provided an `N` parameter less than or equal to `0`, the function retu
131131
t.end();
132132
});
133133

134+
tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `NaN (accessor)`', function test( t ) {
135+
var x;
136+
var v;
137+
138+
x = toAccessorArray([ 1.0, -2.0, -4.0, 5.0, 3.0 ]);
139+
140+
v = varianceyc( 0, 1, x, 1 );
141+
t.strictEqual( isnan( v ), true, 'returns expected value' );
142+
143+
v = varianceyc( -1, 1, x, 1 );
144+
t.strictEqual( isnan( v ), true, 'returns expected value' );
145+
146+
t.end();
147+
});
148+
134149
tape( 'if provided an `N` parameter equal to `1`, the function returns a population variance of `0`', function test( t ) {
135150
var x;
136151
var v;
@@ -143,6 +158,18 @@ tape( 'if provided an `N` parameter equal to `1`, the function returns a populat
143158
t.end();
144159
});
145160

161+
tape( 'if provided an `N` parameter equal to `1`, the function returns a population variance of `0` (accessor)', function test( t ) {
162+
var x;
163+
var v;
164+
165+
x = toAccessorArray([ 1.0, -2.0, -4.0, 5.0, 3.0 ]);
166+
167+
v = varianceyc( 1, 0, x, 1 );
168+
t.strictEqual( v, 0.0, 'returns expected value' );
169+
170+
t.end();
171+
});
172+
146173
tape( 'if provided a `correction` parameter yielding `N-correction` less than or equal to `0`, the function returns `NaN`', function test( t ) {
147174
var x;
148175
var v;
@@ -158,6 +185,21 @@ tape( 'if provided a `correction` parameter yielding `N-correction` less than or
158185
t.end();
159186
});
160187

188+
tape( 'if provided a `correction` parameter yielding `N-correction` less than or equal to `0`, the function returns `NaN` (accessor)', function test( t ) {
189+
var x;
190+
var v;
191+
192+
x = toAccessorArray([ 1.0, -2.0, -4.0, 5.0, 3.0 ]);
193+
194+
v = varianceyc( x.length, x.length, x, 1 );
195+
t.strictEqual( isnan( v ), true, 'returns expected value' );
196+
197+
v = varianceyc( x.length, x.length+1, x, 1 );
198+
t.strictEqual( isnan( v ), true, 'returns expected value' );
199+
200+
t.end();
201+
});
202+
161203
tape( 'the function supports a `stride` parameter', function test( t ) {
162204
var x;
163205
var v;

0 commit comments

Comments
 (0)