Skip to content

Commit baced22

Browse files
chore: update test cases
1 parent 9cca594 commit baced22

2 files changed

Lines changed: 10 additions & 17 deletions

File tree

lib/node_modules/@stdlib/dstructs/fifo/docs/repl.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,8 @@
9999
--------
100100
> var q = {{alias}}();
101101
> q.push( 1 ).push( 2 ).push( 3 );
102-
> q.every( function( v ) { return v > 0; } )
102+
> q.every( predicate )
103103
true
104-
> q.every( function( v ) { return v % 1 === 0; } )
105-
false
106-
> q.every( function( v ) { return v > 2; } )
107-
false
108104

109105

110106
{{alias}}.prototype.get( index )

lib/node_modules/@stdlib/dstructs/fifo/test/test.every.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ tape( 'the method returns `false` if one or more elements fail a test', function
164164
});
165165

166166
tape( 'the method returns `false` on first element that fails the test', function test( t ) {
167+
var count;
167168
var bool;
168169
var q;
169-
var count;
170170

171171
q = new FIFO();
172172
q.push( 2 );
@@ -215,9 +215,9 @@ tape( 'the method supports providing an execution context', function test( t ) {
215215
});
216216

217217
tape( 'the method provides the element value, index, and queue as arguments to the predicate', function test( t ) {
218-
var q;
219218
var indices;
220219
var values;
220+
var q;
221221

222222
q = new FIFO();
223223
q.push( 'a' );
@@ -251,9 +251,7 @@ tape( 'the method works with different data types', function test( t ) {
251251
q.push( 1 );
252252
q.push( 2 );
253253

254-
bool = q.every( function( v ) {
255-
return typeof v === 'number';
256-
});
254+
bool = q.every( predicate );
257255

258256
t.strictEqual( bool, true, 'works with numbers' );
259257

@@ -262,9 +260,7 @@ tape( 'the method works with different data types', function test( t ) {
262260
q.push( 'bar' );
263261
q.push( 'baz' );
264262

265-
bool = q.every( function( v ) {
266-
return typeof v === 'string';
267-
});
263+
bool = q.every( predicate );
268264

269265
t.strictEqual( bool, true, 'works with strings' );
270266

@@ -273,11 +269,12 @@ tape( 'the method works with different data types', function test( t ) {
273269
q.push( false );
274270
q.push( true );
275271

276-
bool = q.every( function( v ) {
277-
return typeof v === 'boolean';
278-
});
272+
bool = q.every( predicate );
279273

280274
t.strictEqual( bool, true, 'works with booleans' );
281-
282275
t.end();
276+
277+
function predicate( v ) {
278+
return v !== void 0;
279+
}
283280
});

0 commit comments

Comments
 (0)