tel8618217223380 / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

TQueue::peek returns the top not the bottom. Comments refer to pop() when the method does not exist in object #246

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
$queue = new TQueue();
$queue->enqueue(1);
$queue->enqueue(2);
$queue->enqueue(3);

echo($queue->peek());
echo($queue->dequeue());

What is the expected output? What do you see instead?
This should be echoing 1 and then 1.
What is produced is 3 and then 1

Please use labels and text to provide additional information.

Original issue reported on code.google.com by javalizard@gmail.com on 11 Apr 2010 at 10:47

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2799.

Original comment by Christophe.Boulain@gmail.com on 12 Apr 2010 at 7:09

GoogleCodeExporter commented 9 years ago
Fixed. 
The "pop" reference was a copy/paste error. We don't need a pop method in 
TQueue,
since dequeue will do the same thing.
Also updated the unit-test for TQueue, since the peek test was not good (and 
was not
reporting this error!)

Original comment by Christophe.Boulain@gmail.com on 12 Apr 2010 at 7:11