User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
algorithm:queue_list-based [2015/01/29 21:20]
will
algorithm:queue_list-based [2016/04/03 00:21]
will Updated tests.
Line 61: Line 61:
 ======= Tests ======= ======= Tests =======
 <syntax js> <syntax js>
-function ​test123() {+function ​testA() {
     var q = new Queue();     var q = new Queue();
     q.enqueue(1);​     q.enqueue(1);​
     q.enqueue(2);​     q.enqueue(2);​
     q.enqueue(3);​     q.enqueue(3);​
-    assert(q.dequeue() === 1, "​1"​); +    ​ 
-    assert(q.dequeue() === 2, "2"); +    ​assert(q.dequeue() === 1); 
-    assert(q.dequeue() === 3, "3"); +    assert(q.dequeue() === 2); 
-    assert(q.dequeue() === null, "Nothing left.");+    assert(q.dequeue() === 3); 
 +    assert(q.dequeue() === null, "End of queue."); 
 +
 + 
 +function testB() { 
 +    var q = new Queue(); 
 +    q.enqueue(1);​ 
 +    q.enqueue(2);​ 
 +    ​ 
 +    assert(q.dequeue() === 1); 
 +     
 +    q.enqueue(3); 
 +    q.enqueue(4);​ 
 +     
 +    assert(q.dequeue() === 2); 
 +     
 +    q.enqueue(5);​ 
 +     
 +    assert(q.dequeue() === 3); 
 +    assert(q.dequeue() === 4); 
 +    assert(q.dequeue() === 5); 
 +    assert(q.dequeue() === null, "End of queue.");
 }</​syntax>​ }</​syntax>​
  
algorithm/queue_list-based.txt · Last modified: 2016/04/03 00:21 by will