diff example/task_queue/testQueueInfo.cc @ 822:d0361d459338 draft

testQueueInfo 100% passed
author game@zeus.cr.ie.u-ryukyu.ac.jp
date Sun, 23 May 2010 17:14:50 +0900
parents 3c508c837ad8
children d30617ef4b20
line wrap: on
line diff
--- 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());
     }