Skip to content

Commit

Permalink
test: add tests for hasItems method in FreeList
Browse files Browse the repository at this point in the history
PR-URL: #27588
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
rpgeeganage authored and targos committed May 11, 2019
1 parent 119a590 commit 3801859
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/parallel/test-freelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,13 @@ assert.strictEqual(flist1.free({ id: 'test5' }), false);
assert.strictEqual(flist1.alloc().id, 'test3');
assert.strictEqual(flist1.alloc().id, 'test2');
assert.strictEqual(flist1.alloc().id, 'test1');

// Check list has elements
const flist2 = new FreeList('flist2', 2, Object);
assert.strictEqual(flist2.hasItems(), false);

flist2.free({ id: 'test1' });
assert.strictEqual(flist2.hasItems(), true);

flist2.alloc();
assert.strictEqual(flist2.hasItems(), false);

0 comments on commit 3801859

Please sign in to comment.