# HG changeset patch # User game@zeus.cr.ie.u-ryukyu.ac.jp # Date 1274602490 -32400 # Node ID ba45c7b81d2a985928ef6f561993749e6a92c54c # Parent 6e8f8eb1e407702c7409f5788c57f67d4d44e4a6 testQueueInfo 100% passed diff -r 6e8f8eb1e407 -r ba45c7b81d2a 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 6e8f8eb1e407 -r ba45c7b81d2a 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()); }