Index: /trunk/psLib/test/collections/Makefile
===================================================================
--- /trunk/psLib/test/collections/Makefile	(revision 2387)
+++ /trunk/psLib/test/collections/Makefile	(revision 2388)
@@ -3,6 +3,6 @@
 ##  Makefile:   test/collections
 ##
-##  $Revision: 1.23 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-09-14 20:01:52 $
+##  $Revision: 1.24 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-11-19 21:58:59 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -21,4 +21,5 @@
 TARGET = tst_psVector          \
          tst_psArray           \
+         tst_psArray01         \
          tst_psBitSet          \
          tst_psVectorSort_01   \
Index: /trunk/psLib/test/collections/tst_psArray01.c
===================================================================
--- /trunk/psLib/test/collections/tst_psArray01.c	(revision 2388)
+++ /trunk/psLib/test/collections/tst_psArray01.c	(revision 2388)
@@ -0,0 +1,133 @@
+/** @file  tst_psArray.c
+ *
+ *  @brief Test driver for psArray integer functions
+ *
+ *  This test driver contains the following tests for psArray test point 1:
+ *     A)  Create void pointer array
+ *     B)  Add data to void pointer array
+ *     C)  Sort data in array
+ *     D)  Attempt to sort data in invalid array
+ *     E)  Free void pointer array
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-11-19 21:58:59 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include <math.h>
+
+#include "pslib.h"
+#include "psTest.h"
+
+typedef struct
+{
+    psS32 x;
+    float y;
+}
+testStruct;
+
+int testStructCompare(const void **a, const void **b)
+{
+    testStruct* first = (testStruct*)*a;
+    testStruct* second = (testStruct*)*b;
+
+    if(first->x < second->x)
+        return -1;
+    else if (first->x > second->x)
+        return 1;
+    else
+        return 0;
+}
+
+psS32 main(psS32 argc,
+           char* argv[])
+{
+    // Create array of pointers
+    testStruct *mySt[10];
+    psArray *psArr1 = NULL;
+
+    // Test A - Create void pointer array
+    printPositiveTestHeader(stdout,"psArray", "Create void pointer array");
+    psArray *psArr = psArrayAlloc(10);
+    if (psArr->nalloc != 10) {
+        psError(PS_ERR_UNKNOWN, true,"psArray didn't have proper number of elements.");
+        return 1;
+    }
+    printFooter(stdout, "psArray", "Create void pointer array", true);
+
+    // Test B - Add data to void pointer array
+    printPositiveTestHeader(stdout, "psArray", "Add data to void pointer array");
+    for(psS32 i = 0; i < 10; i++) {
+        testStruct *ts = psAlloc(sizeof(testStruct));
+        ts->x = 10*(10-i);
+        ts->y = 10.1*(10-i);
+        mySt[i] = ts;
+        psArr->data[i] = ts;
+        psMemIncrRefCounter(ts);
+    }
+
+    for(psS32 i = 0; i < 10; i++) {
+        testStruct *ts = (testStruct*)psArr->data[i];
+        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
+        if (fabsf(ts->x - 10*(10-i)) > 0.01f || fabsf(ts->y - 10.1*(10-i)) > 0.01f) {
+            psError(PS_ERR_UNKNOWN, true,"Couldn't properly get elements from array.");
+            return 2;
+        }
+    }
+    printf("array size = %d\n", psArr->nalloc);
+    if (psArr->nalloc != 10) {
+        psError(PS_ERR_UNKNOWN, true,"Array Size wrong");
+        return 3;
+    }
+    printf("array population = %d\n", psArr->n);
+    if (psArr->n != 10) {
+        psError(PS_ERR_UNKNOWN, true,"Array population wrong");
+        return 4;
+    }
+    printFooter(stdout, "psArray", "Add data to void pointer array", true);
+
+    // Test C - Sort data in array
+    printPositiveTestHeader(stdout,"psArray","Sort data in array");
+    psArr = psArraySort(psArr,testStructCompare);
+    for(psS32 i = 0; i < 10; i++) {
+        testStruct *ts = (testStruct*)psArr->data[i];
+        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
+        if (fabsf(ts->x - 10*(i+1)) > 0.01f || fabsf(ts->y - 10.1*(i+1)) > 0.01f) {
+            psError(PS_ERR_UNKNOWN, true,"Couldn't properly get elements from array.");
+            return 5;
+        }
+    }
+    printFooter(stdout,"psArray","Sort data in array",true);
+
+    // Test D - Attempt to sort null array
+    printPositiveTestHeader(stdout,"psArray","Attempt to sort array");
+    psArray* tempArr = psArraySort(NULL,testStructCompare);
+    if(tempArr != NULL) {
+        psError(PS_ERR_UNKNOWN,true,"Array sort did not return null when sorting null array");
+        return 6;
+    }
+    printFooter(stdout,"psArray","Attempt to sort array",true);
+
+    // Test E - Free void pointer array
+    printPositiveTestHeader(stdout, "psArray", "Free void pointer array");
+    psFree(psArr);
+    for(psS32 i = 0; i < 10; i++) {
+        psFree(mySt[i]);
+    }
+    if( psMemCheckLeaks(0, NULL, stdout) != 0) {
+        psError(PS_ERR_UNKNOWN,true,"Memory leaks detected.");
+        return 110;
+    }
+    psS32 nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+        return 111;
+    }
+    printFooter(stdout, "psArray" ,"Free void pointer array", true);
+
+    return 0;
+}
Index: /trunk/psLib/test/collections/verified/tst_psArray01.stdout
===================================================================
--- /trunk/psLib/test/collections/verified/tst_psArray01.stdout	(revision 2388)
+++ /trunk/psLib/test/collections/verified/tst_psArray01.stdout	(revision 2388)
@@ -0,0 +1,67 @@
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psArray01.c                                            *
+*            TestPoint: psArray{Create void pointer array}                         *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psArray{Create void pointer array} | tst_psArray01.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psArray01.c                                            *
+*            TestPoint: psArray{Add data to void pointer array}                    *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+ts[0].x = 100 ts[0].y = 101.00
+ts[1].x = 90 ts[1].y = 90.90
+ts[2].x = 80 ts[2].y = 80.80
+ts[3].x = 70 ts[3].y = 70.70
+ts[4].x = 60 ts[4].y = 60.60
+ts[5].x = 50 ts[5].y = 50.50
+ts[6].x = 40 ts[6].y = 40.40
+ts[7].x = 30 ts[7].y = 30.30
+ts[8].x = 20 ts[8].y = 20.20
+ts[9].x = 10 ts[9].y = 10.10
+array size = 10
+array population = 10
+
+---> TESTPOINT PASSED (psArray{Add data to void pointer array} | tst_psArray01.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psArray01.c                                            *
+*            TestPoint: psArray{Sort data in array}                                *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+ts[0].x = 10 ts[0].y = 10.10
+ts[1].x = 20 ts[1].y = 20.20
+ts[2].x = 30 ts[2].y = 30.30
+ts[3].x = 40 ts[3].y = 40.40
+ts[4].x = 50 ts[4].y = 50.50
+ts[5].x = 60 ts[5].y = 60.60
+ts[6].x = 70 ts[6].y = 70.70
+ts[7].x = 80 ts[7].y = 80.80
+ts[8].x = 90 ts[8].y = 90.90
+ts[9].x = 100 ts[9].y = 101.00
+
+---> TESTPOINT PASSED (psArray{Sort data in array} | tst_psArray01.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psArray01.c                                            *
+*            TestPoint: psArray{Attempt to sort array}                             *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psArray{Attempt to sort array} | tst_psArray01.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psArray01.c                                            *
+*            TestPoint: psArray{Free void pointer array}                           *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psArray{Free void pointer array} | tst_psArray01.c)
+
