Skip to content

Commit 8ffdf69

Browse files
authored
test: update tests
Signed-off-by: Athan <kgryte@gmail.com>
1 parent 5e6e74e commit 8ffdf69

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

  • lib/node_modules/@stdlib/stats/strided/nancount/test

lib/node_modules/@stdlib/stats/strided/nancount/test/test.main.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,29 @@ tape( 'the function supports a `stride` parameter', function test( t ) {
119119
t.end();
120120
});
121121

122+
tape( 'the function supports a `stride` parameter (accessors)', function test( t ) {
123+
var x;
124+
var v;
125+
126+
x = [
127+
1.0, // 0
128+
2.0,
129+
2.0, // 1
130+
-7.0,
131+
-2.0, // 2
132+
3.0,
133+
4.0, // 3
134+
2.0,
135+
NaN, // 4
136+
NaN
137+
];
138+
139+
v = nancount( 5, toAccessorArray( x ), 2 );
140+
141+
t.strictEqual( v, 4, 'returns expected value' );
142+
t.end();
143+
});
144+
122145
tape( 'the function supports a negative `stride` parameter', function test( t ) {
123146
var x;
124147
var v;
@@ -142,6 +165,29 @@ tape( 'the function supports a negative `stride` parameter', function test( t )
142165
t.end();
143166
});
144167

168+
tape( 'the function supports a negative `stride` parameter (accessors)', function test( t ) {
169+
var x;
170+
var v;
171+
172+
x = [
173+
NaN, // 4
174+
NaN,
175+
1.0, // 3
176+
2.0,
177+
2.0, // 2
178+
-7.0,
179+
-2.0, // 1
180+
3.0,
181+
4.0, // 0
182+
2.0
183+
];
184+
185+
v = nancount( 5, toAccessorArray( x ), -2 );
186+
187+
t.strictEqual( v, 4, 'returns expected value' );
188+
t.end();
189+
});
190+
145191
tape( 'if provided a `stride` parameter equal to `0`, the function returns `N` if first element is valid', function test( t ) {
146192
var x;
147193
var v;

0 commit comments

Comments
 (0)