# HG changeset patch # User game@zeus.cr.ie.u-ryukyu.ac.jp # Date 1274602490 -32400 # Node ID d0361d45933827b85064884bd7e9bf73a57798cf # Parent 4691b6ae44ec90a1331a1ed04ead2bb7d320373e testQueueInfo 100% passed diff -r 4691b6ae44ec -r d0361d459338 TaskManager/kernel/ppe/QueueInfo.h --- a/TaskManager/kernel/ppe/QueueInfo.h Sun May 23 16:23:52 2010 +0900 +++ b/TaskManager/kernel/ppe/QueueInfo.h Sun May 23 17:14:50 2010 +0900 @@ -249,7 +249,7 @@ { T* e = first->next; for (int i = 0; i < index; i++) { - if (e == this) return NULL; + if (e->next == this) return NULL; e = e->next; } return e; @@ -283,7 +283,7 @@ templateint QueueInfo::length() { - int i = 1; + int i = 0; if (empty()) return 0; T* e = first; while((e = e->next) != this ) i++; diff -r 4691b6ae44ec -r d0361d459338 example/task_queue/testQueueInfo.cc --- a/example/task_queue/testQueueInfo.cc Sun May 23 16:23:52 2010 +0900 +++ b/example/task_queue/testQueueInfo.cc Sun May 23 17:14:50 2010 +0900 @@ -20,9 +20,10 @@ for (i = 0; i < count; i++) { q->addLast(q->create()); } - + i = 0; for(TaskListPtr t= q->getFirst(); t ;t = q->getNext(t) ) { - t->length = i; + t->length = i++; + } i = 0; @@ -39,14 +40,14 @@ printf("Length %d = %d - 1\n", q->length(), count); - q->moveToFirst(q->get(count-1)); + q->moveToFirst(q->get(count-2)); i = 0; for(TaskListPtr t= q->getFirst(); t ;t = q->getNext(t) ) { printf(" No. %d %ld\n", i++, t->length); } - for(TaskListPtr t= q->getFirst(); t ;t = q->getNext(t) ) { + while(!q->empty()){ r->addFirst(q->poll()); }