Index: /trunk/psLib/test/mathtypes/tap_psVector.c
===================================================================
--- /trunk/psLib/test/mathtypes/tap_psVector.c	(revision 7777)
+++ /trunk/psLib/test/mathtypes/tap_psVector.c	(revision 7778)
@@ -5,5 +5,5 @@
 int main (void)
 {
-    plan_tests(11);
+    plan_tests(39);
 
     {
@@ -44,107 +44,76 @@
     }
 
-    return exit_status();
-}
-
-#if 0
-psS32 testVectorRealloc(void)
-{
-    // create new psVector
-    psVector *psVec = psVectorAlloc(5, PS_TYPE_S32);
-    if (psVec == NULL) {
-        fprintf(stderr,"ERROR: Return is NULL\n");
-        return 30;
-    }
-    for(psS32 i = 0; i < 5; i++) {
-        psVec->data.S32[i] = i*10;
-        psVec->n++;
-    }
-
-    // Test C - Reallocate S32 vector bigger
-    psVec = psVectorRealloc(psVec,10);
-    if (psVec == NULL) {
-        fprintf(stderr,"ERROR: Return is NULL\n");
-        return 1;
-    }
-    if (psVec->nalloc != 10) {
-        fprintf(stderr,"Vector size = %ld\n", psVec->nalloc);
-        return 1;
-    }
-    if (psVec->n != 5) {
-        fprintf(stderr,"Vector population = %ld\n", psVec->n);
-        return 2;
-    }
-
-    if (psVec->type.type != PS_TYPE_S32) {
-        fprintf(stderr,"Vector type = %d\n", psVec->type.type);
-        return 3;
-    }
-    if (psVec->type.dimen != PS_DIMEN_VECTOR) {
-        fprintf(stderr,"Vector dimen = %d\n", psVec->type.dimen);
-        return 4;
-    }
-
-    for(psS32 i = 5; i < 10; i++) {
-        psVec->data.S32[i] = i*10;
-        psVec->n++;
-    }
-
-    for(psS32 i = 0; i < 10; i++) {
-        if (psVec->data.S32[i] != i*10) {
-            fprintf(stderr,"Elem %d = %d, expected %d\n", i,
-                    psVec->data.S32[i], i*10);
-            return 5;
-        }
-    }
-
-    // Test D - Reallocate S32 vector smaller
-    psVec = psVectorRealloc(psVec,3);
-    if (psVec == NULL) {
-        fprintf(stderr,"ERROR: Return is NULL\n");
-        return 9;
-    }
-    if (psVec->nalloc != 3) {
-        fprintf(stderr,"Vector size = %ld\n", psVec->nalloc);
-        return 10;
-    }
-    if (psVec->n != 3) {
-        fprintf(stderr,"Vector population = %ld\n", psVec->n);
-        return 11;
-    }
-
-    for(psS32 i = 0; i < 3; i++) {
-        if (psVec->data.S32[i] != i*10) {
-            fprintf(stderr,"Elem %d = %d, expected %d\n", i,
-                    psVec->data.S32[i], i*10);
-            return 12;
-        }
-    }
-
-    psVec = psVectorRealloc(psVec,0);
-    if (psVec == NULL) {
-        fprintf(stderr,"ERROR: Return is NULL\n");
-        return 20;
-    }
-    if (psVec->nalloc != 0) {
-        fprintf(stderr,"Vector size = %ld\n", psVec->nalloc);
-        return 21;
-    }
-    if (psVec->n != 0) {
-        fprintf(stderr,"Vector population = %ld\n", psVec->n);
-        return 22;
-    }
-
-    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
-    psVector* vecBogus = psVectorRealloc(NULL, 6);
-    if (vecBogus != NULL) {
-        fprintf(stderr,"Huh!  bogus type generated a psVector?");
-        return 25;
-    }
-
-    // Test E - Free S32 vector
-    psFree(psVec);
-
-    return 0;
-}
+    {
+        // create new psVector
+        psVector *psVec = psVectorAlloc(5, PS_TYPE_S32);
+
+        diag("psVector Realloc tests");
+        ok (psVec != NULL, "test vector allocated");
+
+        // generate first part of vector
+        for(psS32 i = 0; i < 5; i++) {
+            psVec->data.S32[i] = i*10;
+            psVec->n++;
+        }
+
+        // Test C - Reallocate S32 vector bigger
+        psVec = psVectorRealloc(psVec,10);
+        ok (psVec != NULL, "test vector reallocated to bigger size");
+        ok (psVec->nalloc == 10, "Vector size = %ld", psVec->nalloc);
+        ok (psVec->n == 5, "Vector population = %ld", psVec->n);
+        ok (psVec->type.type == PS_TYPE_S32, "Vector type = %d", psVec->type.type);
+        ok (psVec->type.dimen == PS_DIMEN_VECTOR, "Vector dimen = %d", psVec->type.dimen);
+
+        // generate test data values
+        for(psS32 i = 5; i < 10; i++) {
+            psVec->data.S32[i] = i*10;
+            psVec->n++;
+        }
+
+        // test data values
+        for(psS32 i = 0; i < 10; i++) {
+            ok (psVec->data.S32[i] == i*10, "Elem %d = %d, expected %d", i, psVec->data.S32[i], i*10);
+        }
+
+        // Test D - Reallocate S32 vector smaller
+        psVec = psVectorRealloc(psVec,3);
+        ok (psVec != NULL, "test vector reallocated to smaller size");
+        ok (psVec->nalloc == 3, "Vector size = %ld", psVec->nalloc);
+        ok (psVec->n == 3, "Vector population = %ld", psVec->n);
+
+        // test data values
+        for(psS32 i = 0; i < 3; i++) {
+            ok (psVec->data.S32[i] == i*10, "Elem %d = %d, expected %d", i, psVec->data.S32[i], i*10);
+        }
+
+        // reallocate to 0 length
+        psVec = psVectorRealloc(psVec,0);
+        ok (psVec != NULL, "test vector reallocated to zero length");
+        ok (psVec->nalloc == 0, "Vector size = %ld", psVec->nalloc);
+        ok (psVec->n == 0, "Vector population = %ld", psVec->n);
+
+        // Test E - Free S32 vector
+        // XXX not really a test...
+        psFree(psVec);
+    }
+
+    {
+        psVector* vecBogus = psVectorRealloc(NULL, 6);
+
+        ok(vecBogus == NULL, "psVectorAlloc() doesn't not accept bogus type");
+        psErr *err = psErrorLast();
+
+        skip_start(err == NULL, 2, "Skipping 2 tests because psVectorAlloc() didn't fail as expect");
+        ok(strstr(err->name, "psVectorRealloc"), "alloc failure - got error name %s", err->name);
+        ok(err->code == PS_ERR_BAD_PARAMETER_NULL, "alloc failure - got error code %d", err->code);
+        skip_end();
+
+        psFree(vecBogus);
+
+        return exit_status();
+    }
+}
+
+# if 0
 
 psS32 testVectorExtend(void)
