# Differences

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

 algorithm:queue_list-based [2015/02/02 08:28]127.0.0.1 external edit algorithm:queue_list-based [2016/04/03 00:21] (current)will Updated tests. Both sides previous revision Previous revision 2016/04/03 00:21 will Updated tests.2015/02/02 08:28 external edit2015/01/29 21:20 will 2015/01/29 09:37 will 2014/07/26 23:42 will 2014/07/12 22:26 will 2014/07/12 22:25 will created 2016/04/03 00:21 will Updated tests.2015/02/02 08:28 external edit2015/01/29 21:20 will 2015/01/29 09:37 will 2014/07/26 23:42 will 2014/07/12 22:26 will 2014/07/12 22:25 will created Line 61: Line 61: ======= Tests ======= ======= Tests ======= - 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."); }​ }