Return if the element is added to the ol.structs.PriorityQueue
This commit is contained in:
@@ -28,14 +28,25 @@ describe('ol.structs.PriorityQueue', function() {
|
||||
});
|
||||
|
||||
it('enqueue adds an element', function() {
|
||||
pq.enqueue(0);
|
||||
var added = pq.enqueue(0);
|
||||
expect(function() {
|
||||
pq.assertValid();
|
||||
}).not.to.throwException();
|
||||
expect(added).to.be(true);
|
||||
expect(pq.elements_).to.eql([0]);
|
||||
expect(pq.priorities_).to.eql([0]);
|
||||
});
|
||||
|
||||
it('do not enqueue element with DROP priority', function() {
|
||||
var added = pq.enqueue(Infinity);
|
||||
expect(function() {
|
||||
pq.assertValid();
|
||||
}).not.to.throwException();
|
||||
expect(added).to.be(false);
|
||||
expect(pq.elements_).to.eql([]);
|
||||
expect(pq.priorities_).to.eql([]);
|
||||
});
|
||||
|
||||
it('maintains the pq property while elements are enqueued', function() {
|
||||
var i;
|
||||
for (i = 0; i < 32; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user