number-allocator
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -0,1 +1,5 @@ | ||
## 1.0.13 | ||
- **Important** Fixed invalid free operator. | ||
- Updated js-sdsl. | ||
## 1.0.12 | ||
@@ -2,0 +6,0 @@ - Updated js-sdsl. updateKeyByIterator() is used. |
@@ -179,5 +179,4 @@ // Copyright Takatoshi Kondo 2021 | ||
// Concat to right | ||
const low = it.pointer.high - 1 | ||
const high = it.pointer.high | ||
this.ss.updateKeyByIterator(it, new Interval(low, high)) | ||
this.ss.updateKeyByIterator(it, new Interval(num, high)) | ||
} else { | ||
@@ -198,4 +197,3 @@ // Insert new interval | ||
this.ss.eraseElementByIterator(it) | ||
const high = it.pointer.high | ||
this.ss.updateKeyByIterator(it, new Interval(lLow, high)) | ||
this.ss.updateKeyByIterator(it, new Interval(lLow, rHigh)) | ||
} else { | ||
@@ -202,0 +200,0 @@ // Concat to left |
{ | ||
"name": "number-allocator", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "A library for the unique number allocator", | ||
@@ -41,3 +41,3 @@ "main": "index.js", | ||
"debug": "^4.3.1", | ||
"js-sdsl": "4.1.4" | ||
"js-sdsl": "4.3.0" | ||
}, | ||
@@ -56,3 +56,3 @@ "devDependencies": { | ||
"karma-mocha": "^2.0.1", | ||
"mocha": "^8.2.1", | ||
"mocha": "^10.2.0", | ||
"nyc": "^15.1.0", | ||
@@ -59,0 +59,0 @@ "snazzy": "^9.0.0", |
@@ -290,2 +290,49 @@ // Copyright Takatoshi Kondo 2021 | ||
}) | ||
it('should concat to right on free', function (done) { | ||
const a = NumberAllocator(0, 3) | ||
assert.equal(a.alloc(), 0) | ||
assert.equal(a.alloc(), 1) | ||
a.free(1) | ||
assert.equal(a.alloc(), 1) | ||
done() | ||
}) | ||
it('should concat to left on free', function (done) { | ||
const a = NumberAllocator(0, 3) | ||
assert.equal(a.alloc(), 0) | ||
assert.equal(a.alloc(), 1) | ||
assert.equal(a.alloc(), 2) | ||
a.free(0) | ||
a.free(1) | ||
assert.equal(a.alloc(), 0) | ||
assert.equal(a.alloc(), 1) | ||
done() | ||
}) | ||
it('should concat to left and right on free', function (done) { | ||
const a = NumberAllocator(0, 3) | ||
assert.equal(a.alloc(), 0) | ||
assert.equal(a.alloc(), 1) | ||
assert.equal(a.alloc(), 2) | ||
a.free(0) | ||
a.free(2) | ||
a.free(1) | ||
assert.equal(a.alloc(), 0) | ||
assert.equal(a.alloc(), 1) | ||
assert.equal(a.alloc(), 2) | ||
done() | ||
}) | ||
it('should insert new interval on free', function (done) { | ||
const a = NumberAllocator(0, 4) | ||
assert.equal(a.alloc(), 0) | ||
assert.equal(a.alloc(), 1) | ||
assert.equal(a.alloc(), 2) | ||
assert.equal(a.alloc(), 3) | ||
assert.equal(a.alloc(), 4) | ||
a.free(0) | ||
a.free(4) | ||
a.free(2) | ||
assert.equal(a.alloc(), 0) | ||
assert.equal(a.alloc(), 2) | ||
assert.equal(a.alloc(), 4) | ||
done() | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29672
655
+ Addedjs-sdsl@4.3.0(transitive)
- Removedjs-sdsl@4.1.4(transitive)
Updatedjs-sdsl@4.3.0