Index: /trunk/psLib/test/collections/tst_psVector_01.c
===================================================================
--- /trunk/psLib/test/collections/tst_psVector_01.c	(revision 690)
+++ /trunk/psLib/test/collections/tst_psVector_01.c	(revision 690)
@@ -0,0 +1,86 @@
+/** @file  tst_psVector_01.c
+ *
+ *  @brief Test driver for psVector integer functions
+ *
+ *  This test driver contains the following tests for psVector test point 1:
+ *     A)  Create INT32 vector
+ *     B)  Add data to INT32 vector
+ *     C)  Reallocate INT32 vector bigger
+ *     D)  Reallocate INT32 vector smaller
+ *     E)  Free INT32 vector
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-05-14 21:15:14 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "psLib.h"
+#include "psTest.h"
+
+int main(int argc,
+         char* argv[])
+{
+
+
+    // Test A - Create INT32 vector
+    printPositiveTestHeader(stdout,"psVector", "Create INT32 vector");
+    psVector *psVec = psVectorAlloc(PS_TYPE_INT32, 5);
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Create INT32 vector", true);
+
+
+    // Test B - Add data to integer vector
+    printPositiveTestHeader(stdout, "psVector", "Add data to INT32 vector");
+    for(int i = 0; i < 5; i++) {
+        psVec->vec.i32[i] = i*10;
+        psVec->n++;
+        printf("Elem %d = %d\n", i, psVec->vec.i32[i]);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Add data to INT32 vector", true);
+
+
+    // Test C - Reallocate INT32 vector bigger
+    printPositiveTestHeader(stdout,"psVector", "Reallocate INT32 vector bigger");
+    psVec = psVectorRealloc(psVec, 10);
+    printf("Adding more elements to INT32 vector...\n");
+    for(int i = 5; i < 10; i++) {
+        psVec->vec.i32[i] = i*10;
+        psVec->n++;
+        printf("Elem %d = %d\n", i, psVec->vec.i32[i]);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Reallocate INT32 vector bigger", true);
+
+
+    // Test D - Reallocate INT32 vector smaller
+    printPositiveTestHeader(stdout,"psVector","Reallocate INT32 vector smaller");
+    psVec = psVectorRealloc(psVec, 3);
+    printf("Vector size = %d\n", psVec->nalloc);
+    for(int i = 0; i < 3; i++) {
+        printf("Elem %d = %d\n", i, psVec->vec.i32[i]);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Reallocate integer INT32 smaller", true);
+
+
+    // Test E - Free INT32 vector
+    printPositiveTestHeader(stdout, "psVector", "Free INT32 vector");
+    psVectorFree(psVec);
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psVector" ,"Free INT32 vector", true);
+
+    return 0;
+}
Index: /trunk/psLib/test/collections/tst_psVector_02.c
===================================================================
--- /trunk/psLib/test/collections/tst_psVector_02.c	(revision 690)
+++ /trunk/psLib/test/collections/tst_psVector_02.c	(revision 690)
@@ -0,0 +1,117 @@
+/** @file  tst_psVector_02.c
+ *
+ *  @brief Test driver for psVector integer functions
+ *
+ *  This test driver contains the following tests for psVector test point 1:
+ *     A)  Create void pointer vector
+ *     B)  Add data to void pointer vector
+ *     C)  Reallocate void pointer vector bigger
+ *     D)  Reallocate void pointer vector smaller
+ *     E)  Free void pointer vector
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-05-14 21:15:14 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "psLib.h"
+#include "psTest.h"
+
+typedef struct
+{
+    int x;
+    float y;
+}
+testStruct;
+
+
+int main(int argc,
+         char* argv[])
+{
+    // Create array of pointers
+    testStruct *mySt[10];
+
+
+    // Test A - Create void pointer vector
+    printPositiveTestHeader(stdout,"psVector", "Create void pointer vector");
+    psVector *psVec = psVectorAlloc(PS_TYPE_PTR, 5);
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Create void pointer vector", true);
+
+
+    // Test B - Add data to void pointer vector
+    printPositiveTestHeader(stdout, "psVector", "Add data to void pointer vector");
+    for(int i = 0; i < 5; i++) {
+        testStruct *ts = psAlloc(sizeof(testStruct));
+        ts->x = 10*i;
+        ts->y = 10.1*i;
+        mySt[i] = ts;
+        psVec->vec.vp[i] = ts;
+        psVec->n++;
+        psMemIncrRefCounter(ts);
+    }
+
+    for(int i = 0; i < 5; i++) {
+        testStruct *ts = (testStruct*)psVec->vec.vp[i];
+        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Add data to void pointer vector", true);
+
+
+    // Test C - Reallocate void pointer vector bigger
+    printPositiveTestHeader(stdout,"psVector", "Reallocate void pointer vector bigger");
+    psVec = psVectorRealloc(psVec, 10);
+    printf("Adding more elements to void pointer vector...\n");
+    for(int i = 5; i < 10; i++) {
+        testStruct *ts = psAlloc(sizeof(testStruct));
+        ts->x = 10*i;
+        ts->y = 10.1*i;
+        mySt[i] = ts;
+        psVec->vec.vp[i] = ts;
+        psVec->n++;
+        psMemIncrRefCounter(ts);
+    }
+    for(int i = 0; i < 10; i++) {
+        testStruct *ts = (testStruct*)psVec->vec.vp[i];
+        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Reallocate void pointer vector bigger", true);
+
+
+    // Test D - Reallocate void pointer vector smaller
+    printPositiveTestHeader(stdout,"psVector","Reallocate void pointer vector smaller");
+    psVec = psVectorRealloc(psVec, 3);
+    for(int i = 0; i < 3; i++) {
+        testStruct *ts = (testStruct*)psVec->vec.vp[i];
+        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Reallocate integer void pointer smaller", true);
+
+
+    // Test E - Free void pointer vector
+    printPositiveTestHeader(stdout, "psVector", "Free void pointer vector");
+    psVectorElementFree(psVec, NULL);
+    psVectorFree(psVec);
+    for(int i = 0; i < 10; i++) {
+        psFree(mySt[i]);
+    }
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psVector" ,"Free void pointer vector", true);
+
+    return 0;
+}
Index: /trunk/psLib/test/collections/tst_psVector_03.c
===================================================================
--- /trunk/psLib/test/collections/tst_psVector_03.c	(revision 690)
+++ /trunk/psLib/test/collections/tst_psVector_03.c	(revision 690)
@@ -0,0 +1,126 @@
+/** @file  tst_psVector_03.c
+ *
+ *  @brief Test driver for psVector integer functions
+ *
+ *  This test driver contains the following tests for psVector test point 1:
+ *     A)  Create void pointer vector
+ *     B)  Add data to void pointer vector
+ *     C)  Reallocate void pointer vector bigger
+ *     D)  Reallocate void pointer vector smaller
+ *     E)  Free void pointer array with function callback
+ *
+ *  @author  Ross Harman, MHPCC
+ *
+ *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+ *  @date  $Date: 2004-05-14 21:15:14 $
+ *
+ *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+ *
+ */
+
+#include "psLib.h"
+#include "psTest.h"
+
+typedef struct
+{
+    int x;
+    float y;
+}
+testStruct;
+
+static void freeData(void *data)
+{
+    psFree(data);
+}
+
+
+int main(int argc,
+         char* argv[])
+{
+    // Create array of pointers
+    testStruct *mySt[10];
+
+
+    // Test A - Create void pointer vector
+    printPositiveTestHeader(stdout,"psVector", "Create void pointer vector");
+    psVector *psVec = psVectorAlloc(PS_TYPE_PTR, 5);
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Create void pointer vector", true);
+
+
+    // Test B - Add data to void pointer vector
+    printPositiveTestHeader(stdout, "psVector", "Add data to void pointer vector");
+    for(int i = 0; i < 5; i++) {
+        testStruct *ts = psAlloc(sizeof(testStruct));
+        ts->x = 10*i;
+        ts->y = 10.1*i;
+        mySt[i] = ts;
+        psVec->vec.vp[i] = ts;
+        psVec->n++;
+        psMemIncrRefCounter(ts);
+    }
+
+    for(int i = 0; i < 5; i++) {
+        testStruct *ts = (testStruct*)psVec->vec.vp[i];
+        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Add data to void pointer vector", true);
+
+
+    // Test C - Reallocate void pointer vector bigger
+    printPositiveTestHeader(stdout,"psVector", "Reallocate void pointer vector bigger");
+    psVec = psVectorRealloc(psVec, 10);
+    printf("Adding more elements to void pointer vector...\n");
+    for(int i = 5; i < 10; i++) {
+        testStruct *ts = psAlloc(sizeof(testStruct));
+        ts->x = 10*i;
+        ts->y = 10.1*i;
+        mySt[i] = ts;
+        psVec->vec.vp[i] = ts;
+        psVec->n++;
+        psMemIncrRefCounter(ts);
+    }
+    for(int i = 0; i < 10; i++) {
+        testStruct *ts = (testStruct*)psVec->vec.vp[i];
+        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Reallocate void pointer vector bigger", true);
+
+
+    // Test D - Reallocate void pointer vector smaller
+    printPositiveTestHeader(stdout,"psVector","Reallocate void pointer vector smaller");
+    psVec = psVectorRealloc(psVec, 3);
+    for(int i = 0; i < 3; i++) {
+        testStruct *ts = (testStruct*)psVec->vec.vp[i];
+        printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y);
+    }
+    printf("Vector size = %d\n", psVec->nalloc);
+    printf("Vector population = %d\n", psVec->n);
+    printFooter(stdout, "psVector", "Reallocate integer void pointer smaller", true);
+
+
+    // Test E - Free void pointer array with function callback
+    printPositiveTestHeader(stdout, "psVector", "Free void pointer array with function callback");
+
+    // Free void pointer array struct and its 3 internal elements
+    psVectorElementFree(psVec, freeData);
+    psVectorFree(psVec);
+
+    // Free 7 elements manually that were lost after array was reallocated smaller
+    for(int i = 3; i < 10; i++) {
+        psFree(mySt[i]);
+    }
+    psMemCheckLeaks(0, NULL, stdout);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psVector" ,"Free void pointer array with function callback", true);
+
+    return 0;
+}
