Skip to content

Commit

Permalink
Merge pull request #8 from noevents/master
Browse files Browse the repository at this point in the history
coverage and code fix
  • Loading branch information
Salakar authored Jul 28, 2017
2 parents 661843c + 867d692 commit 2849d26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ Denque.prototype.splice = function splice(index, count) {
if (count === 0) {
removed = [];
if (i != size) {
this._tail = (i - 1 + len) & this._capacityMask;
this._tail = (this._head + i + len) & this._capacityMask;
}
} else {
removed = this.remove(i, count);
Expand Down
8 changes: 7 additions & 1 deletion test/denque.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,13 @@ describe('Denque.prototype.splice', function () {
b.unshift(1, 2, 3);
b.splice(b.length, 0, 17, 18, 19);
assert.deepEqual(a.toArray(), b);
assert.deepEqual(a.splice(a.length - 1, 2), b.splice(b.length - 1, 2)); //remove
a.splice(18, 0, 18, 19);
b.splice(18, 0, 18, 19);
assert.deepEqual(a.toArray(), b);
a.splice(21, 0, 1, 2, 3, 4, 5, 6);
b.splice(21, 0, 1, 2, 3, 4, 5, 6);
assert.deepEqual(a.toArray(), b);
assert.deepEqual(a.splice(a.length-1,2), b.splice(b.length-1,2)); //remove
assert.deepEqual(a.toArray(), b);
});

Expand Down

0 comments on commit 2849d26

Please sign in to comment.