Index: trunk/psLib/test/collections/tst_psList.c
===================================================================
--- trunk/psLib/test/collections/tst_psList.c	(revision 921)
+++ trunk/psLib/test/collections/tst_psList.c	(revision 923)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-08 19:12:05 $
+ *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-06-08 19:39:28 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -760,8 +760,126 @@
 {
     int currentId = psMemGetId();
+    psList* list = NULL;
+    int* data;
 
     psLogMsg(__func__,PS_LOG_INFO," psListSetIterator/psListGetNext/psListGetPrev"
              " shall move the list cursor to the specified location");
 
+    /*
+            psDlistSetIterator(list,where) shall:
+
+            1. output error message and do nothing if list=NULL
+            2. set list.cursor to list.head if where=PS_LIST_HEAD
+            3. set list.cursor to list.tail if where=PS_LIST_TAIL
+            4. set list.cursor to list.cursor->next if where=PS_LIST_NEXT
+            5. set list.cursor to list.cursor->prev if where=PS_LIST_PREV
+            6. leave list.cursor untouched if where=PS_LIST_UNKNOWN or PS_LIST_CURRENT
+
+            psDlistGetNext(list) shall be functionally equivalent to
+            psDlistSetIterator(list,PS_LIST_NEXT) but returns list.cursor.
+
+            psDlistGetPrev(list) shall be functionally equivalent to
+            psDlistSetIterator(list,PS_LIST_PREV) but returns list.cursor.
+    */
+
+    // create a list
+    list = psListAlloc(NULL);
+    for (int lcv=0;lcv<15;lcv++) {
+        data = psAlloc(sizeof(int));
+        *data = lcv;
+        list = psListAdd(list,data,PS_LIST_TAIL);
+        psMemDecrRefCounter(data);
+    }
+
+
+    // 1. output error message and do nothing if list=NULL
+    psLogMsg(__func__,PS_LOG_INFO,"Following should error with "
+             "'Unexpected null pointer'");
+    psListSetIterator(NULL,PS_LIST_HEAD);
+
+    // 3. set list.cursor to list.tail if where=PS_LIST_TAIL
+    psListSetIterator(list,PS_LIST_TAIL);
+    if (*(int*)psListGetCurrent(list) != 14) {
+        psError(__func__,"Didn't successfully move cursor to tail.");
+        return 1;
+    }
+
+    // 2. set list.cursor to list.head if where=PS_LIST_HEAD
+    psListSetIterator(list,PS_LIST_HEAD);
+    if (*(int*)psListGetCurrent(list) != 0) {
+        psError(__func__,"Didn't successfully move cursor to head.");
+        return 2;
+    }
+
+    // 4. set list.cursor to list.cursor->next if where=PS_LIST_NEXT
+    psListSetIterator(list,PS_LIST_NEXT);
+    if (*(int*)psListGetCurrent(list) != 1) {
+        psError(__func__,"Didn't successfully move cursor to next.");
+        return 3;
+    }
+    psListSetIterator(list,PS_LIST_NEXT);
+    if (*(int*)psListGetCurrent(list) != 2) {
+        psError(__func__,"Didn't successfully move cursor to next twice.");
+        return 4;
+    }
+
+    // 5. set list.cursor to list.cursor->prev if where=PS_LIST_PREV
+    psListSetIterator(list,PS_LIST_PREVIOUS);
+    if (*(int*)psListGetCurrent(list) != 1) {
+        psError(__func__,"Didn't successfully move cursor to previous.");
+        return 5;
+    }
+    psListSetIterator(list,PS_LIST_PREVIOUS);
+    if (*(int*)psListGetCurrent(list) != 0) {
+        psError(__func__,"Didn't successfully move cursor to previous twice.");
+        return 6;
+    }
+
+    // 6. leave list.cursor untouched if where=PS_LIST_UNKNOWN or PS_LIST_CURRENT
+    psListSetIterator(list,PS_LIST_NEXT);   // move off of head (works according to above)
+    psLogMsg(__func__,PS_LOG_INFO,"Following should error with 'Can't move to an unknown position.'");
+    psListSetIterator(list,PS_LIST_UNKNOWN);
+    if (*(int*)psListGetCurrent(list) != 1) {
+        psError(__func__,"PS_LIST_UNKNOWN moved cursor.");
+        return 7;
+    }
+    psListSetIterator(list,PS_LIST_CURRENT);
+    if (*(int*)psListGetCurrent(list) != 1) {
+        psError(__func__,"PS_LIST_CURRENT moved cursor.");
+        return 8;
+    }
+
+    // test psListGetPrevious/Next
+    if (*(int*)psListGetNext(list) != 2) {
+        psError(__func__,"psListGetNext didn't move cursor to next.");
+        return 9;
+    }
+    if (*(int*)psListGetNext(list) != 3) {
+        psError(__func__,"psListGetNext didn't move cursor to next.");
+        return 10;
+    }
+    if (*(int*)psListGetPrevious(list) != 2) {
+        psError(__func__,"psListGetPrevious didn't move cursor to previous.");
+        return 11;
+    }
+    if (*(int*)psListGetPrevious(list) != 1) {
+        psError(__func__,"psListGetPrevious didn't move cursor to previous.");
+        return 12;
+    }
+    if (*(int*)psListGetPrevious(list) != 0) {
+        psError(__func__,"psListGetPrevious didn't move cursor to previous..");
+        return 13;
+    }
+    if (psListGetPrevious(list) != NULL) {
+        psError(__func__,"psListGetPrevious moved cursor beyond head.");
+        return 14;
+    }
+
+    psListSetIterator(list,PS_LIST_TAIL); // works according to an above test
+    if (psListGetNext(list) != NULL) {
+        psError(__func__,"psListGetNext moved cursor beyond tail.");
+        return 15;
+    }
+
     psMemCheckLeaks(currentId,NULL,NULL);
     psMemCheckCorruption(1);
