Index: trunk/psLib/test/collections/tst_psList.c
===================================================================
--- trunk/psLib/test/collections/tst_psList.c	(revision 1180)
+++ trunk/psLib/test/collections/tst_psList.c	(revision 1193)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-06-29 23:18:00 $
+ *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-07-08 01:05:01 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,20 +28,20 @@
 
 testDescription tests[] = {
-                              {testListAlloc,"487-testListAlloc",0},
-                              {testListAdd,"488-testListAdd",0},
-                              {testListGet,"489-testListGet",0},
-                              {testListRemove,"490-testListRemove",0},
-                              {testListConvert,"491-testListConvert",0},
-                              {testListIterator,"494-testListIterator",0},
-                              {testListFree,"627-testListFree",0},
-                              {testListSort,"624-testListSort",0},
+                              {testListAlloc,487,"psListAlloc",0,false},
+                              {testListAdd,488,"psListAdd",0,false},
+                              {testListGet,489,"psListGet",0,false},
+                              {testListRemove,490,"psListRemove",0,false},
+                              {testListConvert,491,"psListConvert",0,false},
+                              {testListIterator,494,"psListIterator",0,false},
+                              {testListFree,627,"psListFree",0,false},
+                              {testListSort,624,"psListSort",0,false},
                               {NULL}
                           };
 
-int main()
+int main(int argc, char* argv[])
 {
     psLogSetLevel(PS_LOG_INFO);
 
-    if (! runTestSuite(stderr,"psList",tests)) {
+    if (! runTestSuite(stderr,"psList",tests,argc,argv) ) {
         psError(__FILE__,"One or more tests failed");
         return 1;
@@ -138,12 +138,9 @@
 
     //  1. list is NULL (error)
-    list = psListAdd(NULL,data,PS_LIST_HEAD);
-
-    if (list != NULL) {
-        psError(__func__,"psListAdd was given a NULL list, but returned a non-NULL list.");
-        return 1;
-    }
-
-    //  2. data is NULL (error, list should not grow)
+    if (psListAdd(NULL,data,PS_LIST_HEAD)) {
+        psError(__func__,"psListAdd was given a NULL list, but returned a true/success.");
+        return 1;
+    }
+
     list = psListAlloc(data);
     psFree(data);
@@ -153,8 +150,11 @@
     }
 
-    list = psListAdd(list, NULL,PS_LIST_HEAD);
-
-    if (list->size != 1) {
-        psError(__func__,"psListAdd with a NULL data element changed the list size.");
+    //  2. data is NULL (error, list should not grow)
+    if (psListAdd(list, NULL,PS_LIST_HEAD)) {
+        psError(__func__,"psListAdd successfully added a NULL data item?");
+        return 40;
+    }
+    if ( list->size != 1) {
+        psError(__func__,"psListAdd with a NULL data element changed the list size or returned success.");
         return 3;
     }
@@ -163,5 +163,9 @@
     data = psAlloc(sizeof(int));
     *data = 2;
-    list = psListAdd(list,data,PS_LIST_HEAD);
+    if ( ! psListAdd(list,data,PS_LIST_HEAD) ) {
+        psError(__func__,"psListAdd failed to add a data item to head.");
+        return 21;
+    }
+
     if (psMemGetRefCounter(data) != 2) {
         psError(__func__,"psListAdd didn't increment the data reference count.");
@@ -169,4 +173,5 @@
     }
     psFree(data);
+
     // verify that the size incremented
     if (list->size != 2) {
@@ -183,8 +188,12 @@
     data = psAlloc(sizeof(int));
     *data = 3;
-    list = psListAdd(list,data,PS_LIST_TAIL);
+    if ( ! psListAdd(list,data,PS_LIST_TAIL) ) {
+        psError(__func__,"psListAdd failed to add a data item to tail.");
+        return 21;
+    }
+
     if (psMemGetRefCounter(data) != 2) {
         psError(__func__,"psListAdd didn't increment the data reference count.");
-        return 20;
+        return 22;
     }
     psFree(data);
@@ -211,13 +220,17 @@
     data = psAlloc(sizeof(int));
     *data = 4;
-    psLogMsg(__func__,PS_LOG_INFO,"Following should warn with invalid insert location");
-    list = psListAdd(list,data,-10);
-    if (psMemGetRefCounter(data) != 2) {
-        psError(__func__,"psListAdd didn't increment the data reference count.");
-        return 20;
-    }
-    psFree(data);
-    // verify that the size incremented
-    if (list->size != 4 || *(int*)list->head->data != 4) {
+    psLogMsg(__func__,PS_LOG_INFO,"Following should error with invalid insert location");
+
+    if ( psListAdd(list,data,-10) ) {
+        psError(__func__,"psListAdd successfully added data to a -10 position?");
+        return 30;
+    }
+    if (psMemGetRefCounter(data) != 1) {
+        psError(__func__,"psListAdd incremented the data reference count.");
+        return 24;
+    }
+    psFree(data);
+    // verify that the size wasn't incremented
+    if (list->size != 3) {
         printListInt(list);
         psError(__func__,"psListAdd didn't insert to head when where was invalid.");
@@ -228,45 +241,56 @@
     data = psAlloc(sizeof(int));
     *data = 5;
-    list = psListAdd(list,data,1);
+
+    if ( ! psListAdd(list,data,1) ) {
+        psError(__func__,"psListAdd failed to add data to 1 position.");
+        return 30;
+    }
+
     if (psMemGetRefCounter(data) != 2) {
         psError(__func__,"psListAdd didn't increment the data reference count.");
-        return 20;
+        return 25;
     }
     psFree(data);
     // verify that the size incremented
-    if (list->size != 5 || *(int*)list->head->next->data != 5) {
+    if (list->size != 4 || *(int*)list->head->next->data != 5) {
         printListInt(list);
         psError(__func__,"psListAdd didn't insert to position #1.");
-        return 9;
+        return 10;
     }
 
     data = psAlloc(sizeof(int));
     *data = 6;
-    list = psListAdd(list,data,4);
+    if ( ! psListAdd(list,data,3) ) {
+        psError(__func__,"psListAdd failed to add data to 4 position.");
+        return 31;
+    }
     if (psMemGetRefCounter(data) != 2) {
         psError(__func__,"psListAdd didn't increment the data reference count.");
-        return 20;
+        return 26;
     }
     psFree(data);
     // verify that the size incremented
-    if (list->size != 6  || *(int *)list->head->next->next->next->next->data != 6) {
+    if (list->size != 5  || *(int *)list->head->next->next->next->data != 6) {
         printListInt(list);
         psError(__func__,"psListAdd didn't insert to position #4.");
-        return 9;
+        return 50;
     }
 
     data = psAlloc(sizeof(int));
     *data = 7;
-    list = psListAdd(list,data,2);
+    if ( ! psListAdd(list,data,2) ) {
+        psError(__func__,"psListAdd failed to add data to 2 position.");
+        return 32;
+    }
     if (psMemGetRefCounter(data) != 2) {
         psError(__func__,"psListAdd didn't increment the data reference count.");
-        return 20;
+        return 28;
     }
     psFree(data);
     // verify that the size incremented
-    if (list->size != 7  || *(int *)list->head->next->next->data != 7) {
+    if (list->size != 6  || *(int *)list->head->next->next->data != 7) {
         printListInt(list);
         psError(__func__,"psListAdd didn't insert to position #2.");
-        return 9;
+        return 11;
     }
 
@@ -274,15 +298,22 @@
     *data = 7;
     psLogMsg(__func__,PS_LOG_INFO,"Following should be a warning.");
-    list = psListAdd(list,data,9);
+
+    if ( ! psListAdd(list,data,9) ) {
+        psError(__func__,"psListAdd failed to add data to a 9 position?");
+        return 30;
+    }
+
     if (psMemGetRefCounter(data) != 2) {
         psError(__func__,"psListAdd didn't increment the data reference count.");
-        return 20;
-    }
-    psFree(data);
+        return 29;
+    }
+
+    psFree(data);
+
     // verify that the size incremented
-    if (list->size != 8) {
+    if (list->size != 7) {
         printListInt(list);
         psError(__func__,"psListAdd didn't insert to position #9.");
-        return 9;
+        return 12;
     }
 
@@ -347,15 +378,15 @@
     data = psAlloc(sizeof(int));
     *data = 1;
-    list = psListAdd(list,data,PS_LIST_TAIL);
+    psListAdd(list,data,PS_LIST_TAIL);
     psFree(data);
 
     data = psAlloc(sizeof(int));
     *data = 2;
-    list = psListAdd(list,data,PS_LIST_TAIL);
+    psListAdd(list,data,PS_LIST_TAIL);
     psFree(data);
 
     data = psAlloc(sizeof(int));
     *data = 3;
-    list = psListAdd(list,data,PS_LIST_TAIL);
+    psListAdd(list,data,PS_LIST_TAIL);
     psFree(data);
 
@@ -452,5 +483,5 @@
         data = psAlloc(sizeof(int));
         *data = lcv;
-        list = psListAdd(list,data,PS_LIST_TAIL);
+        psListAdd(list,data,PS_LIST_TAIL);
         psMemDecrRefCounter(data);
     }
@@ -671,5 +702,5 @@
         data = psAlloc(sizeof(int));
         *data = lcv;
-        list = psListAdd(list,data,PS_LIST_TAIL);
+        psListAdd(list,data,PS_LIST_TAIL);
         psMemDecrRefCounter(data);
     }
@@ -809,5 +840,5 @@
         data = psAlloc(sizeof(int));
         *data = lcv;
-        list = psListAdd(list,data,PS_LIST_TAIL);
+        psListAdd(list,data,PS_LIST_TAIL);
         psFree(data);
     }
@@ -926,5 +957,5 @@
         data[lcv] = psAlloc(sizeof(int));
         *data[lcv] = lcv;
-        list = psListAdd(list,data[lcv],PS_LIST_TAIL);
+        psListAdd(list,data[lcv],PS_LIST_TAIL);
         if (psMemGetRefCounter(data[lcv]) != 2) {
             psError(__func__,"Reference counter for data was not incremented");
@@ -980,5 +1011,5 @@
             *data = lcv*2-12;
         }
-        list = psListAdd(list,data,PS_LIST_TAIL);
+        psListAdd(list,data,PS_LIST_TAIL);
         psFree(data);
 
@@ -1046,5 +1077,5 @@
             *data = lcv*2-12;
         }
-        list = psListAdd(list,data,PS_LIST_TAIL);
+        psListAdd(list,data,PS_LIST_TAIL);
         psFree(data);
 
