Index: /trunk/psModules/test/objects/tap_pmPeaks.c
===================================================================
--- /trunk/psModules/test/objects/tap_pmPeaks.c	(revision 15160)
+++ /trunk/psModules/test/objects/tap_pmPeaks.c	(revision 15161)
@@ -5,4 +5,14 @@
 #include "tap.h"
 #include "pstap.h"
+/* The following are tested:
+    pmPeakAlloc()
+    pmPeaksInVector()
+    pmPeaksInImage()
+    pmPeaksSubset()
+    pmPeaksCompareAscend()
+    pmPeaksCompareDescend()
+Must test
+    pmCullPeaks()
+*/
 
 #define TST01_VECTOR_LENGTH 10
@@ -13,8 +23,8 @@
 
 /******************************************************************************
-test01(): we first test pmFindVectorPeaks() with a variety of bad input
+test01(): we first test pmPeaksInVector() with a variety of bad input
 parameters.  Then we test it with a simple vector both 1- and multi-elements.
  *****************************************************************************/
-bool test_pmFindVectorPeaks(int n)
+bool test_pmPeaksInVector(int n)
 {
     psMemId id = psMemGetId();
@@ -29,7 +39,7 @@
     }
     inData->data.F32[0] = (float) n;
-    outData= pmFindVectorPeaks(inData, 0.0);
+    outData= pmPeaksInVector(inData, 0.0);
     if (outData == NULL) {
-        diag("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
+        diag("TEST ERROR: pmPeaksInVector returned a NULL psVector.\n");
         testStatus = false;
     } else {
@@ -53,7 +63,7 @@
     }
     inData->data.F32[0] = (float) n;
-    outData= pmFindVectorPeaks(inData, (float) (n*n));
+    outData= pmPeaksInVector(inData, (float) (n*n));
     if (outData == NULL) {
-        diag("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
+        diag("TEST ERROR: pmPeaksInVector returned a NULL psVector.\n");
         testStatus = false;
     } else {
@@ -78,7 +88,7 @@
     inData->data.F32[n-1] = (float) n;
 
-    outData= pmFindVectorPeaks(inData, 0.0);
+    outData= pmPeaksInVector(inData, 0.0);
     if (outData == NULL) {
-        diag("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
+        diag("TEST ERROR: pmPeaksInVector returned a NULL psVector.\n");
         testStatus = false;
     } else {
@@ -100,7 +110,7 @@
     }
     inData->data.F32[n-1] = (float) n;
-    outData= pmFindVectorPeaks(inData, (float) (n*n));
+    outData= pmPeaksInVector(inData, (float) (n*n));
     if (outData == NULL) {
-        diag("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
+        diag("TEST ERROR: pmPeaksInVector returned a NULL psVector.\n");
         testStatus = false;
     } else {
@@ -125,7 +135,7 @@
 
 
-    outData= pmFindVectorPeaks(inData, 0.0);
+    outData= pmPeaksInVector(inData, 0.0);
     if (outData == NULL) {
-        diag("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
+        diag("TEST ERROR: pmPeaksInVector returned a NULL psVector.\n");
         testStatus = false;
     } else {
@@ -146,7 +156,7 @@
     // Test interior peaks, with threshold = n*n.
     // Should generate an empty output psVector.
-    outData= pmFindVectorPeaks(inData, (float) (n*n));
+    outData= pmPeaksInVector(inData, (float) (n*n));
     if (outData == NULL) {
-        diag("TEST ERROR: pmFindVectorPeaks returned a NULL psVector.\n");
+        diag("TEST ERROR: pmPeaksInVector returned a NULL psVector.\n");
         testStatus = false;
     } else {
@@ -163,5 +173,5 @@
 
 
-bool test_pmFindImagePeaks(int numRows, int numCols)
+bool test_pmPeaksInImage(int numRows, int numCols)
 {
     psMemId id = psMemGetId();
@@ -183,9 +193,9 @@
     inData->data.F32[numRows/2][numCols/2] = PS_SQR(numRows) + PS_SQR(numCols);
 
-    // Call pmFindImagePeaks() with a threshold of 0.0.
-    outData = pmFindImagePeaks(inData, 0.0);
+    // Call pmPeaksInImage() with a threshold of 0.0.
+    outData = pmPeaksInImage(inData, 0.0);
 
     if (outData == NULL) {
-        diag("TEST ERROR: pmFindImagePeaks returned a NULL psList.\n");
+        diag("TEST ERROR: pmPeaksInImage returned a NULL psList.\n");
         testStatus = false;
     } else {
@@ -199,5 +209,5 @@
         }
         if (outData->n != expectedNumPeaks) {
-            diag("TEST ERROR: pmFindImagePeaks found %ld peaks (should be %d)\n", outData->n, expectedNumPeaks);
+            diag("TEST ERROR: pmPeaksInImage found %ld peaks (should be %d)\n", outData->n, expectedNumPeaks);
             testStatus = false;
         }
@@ -279,11 +289,11 @@
 
     // ----------------------------------------
-    // pmFindVectorPeaks() tests
-    // Test pmFindVectorPeaks() with bad input parameters.
-    // Calling pmFindVectorPeaks with NULL psVector.  Should generate error.
-    {
-        psMemId id = psMemGetId();
-        psVector *tmpVec = pmFindVectorPeaks(NULL, 0.0);
-        ok(tmpVec == NULL, "pmFindVectorPeaks() returned a NULL with NULL psVector input");
+    // pmPeaksInVector() tests
+    // Test pmPeaksInVector() with bad input parameters.
+    // Calling pmPeaksInVector with NULL psVector.  Should generate error.
+    {
+        psMemId id = psMemGetId();
+        psVector *tmpVec = pmPeaksInVector(NULL, 0.0);
+        ok(tmpVec == NULL, "pmPeaksInVector() returned a NULL with NULL psVector input");
         psFree(tmpVec);
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
@@ -291,10 +301,10 @@
 
 
-    // Calling pmFindVectorPeaks with empty psVector.  Should generate error.
+    // Calling pmPeaksInVector with empty psVector.  Should generate error.
     {
         psMemId id = psMemGetId();
         psVector *tmpVecEmpty = psVectorAlloc(0, PS_TYPE_F32);
-        psVector *tmpVec = pmFindVectorPeaks(tmpVecEmpty, 0.0);
-        ok(tmpVec == NULL, "pmFindVectorPeaks() returned a NULL with NULL psVector input");
+        psVector *tmpVec = pmPeaksInVector(tmpVecEmpty, 0.0);
+        ok(tmpVec == NULL, "pmPeaksInVector() returned a NULL with NULL psVector input");
         psFree(tmpVec);
         psFree(tmpVecEmpty);
@@ -303,26 +313,26 @@
 
 
-    // Calling pmFindVectorPeaks with PS_TYPE_F64 psVector.  Should generate error.
+    // Calling pmPeaksInVector with PS_TYPE_F64 psVector.  Should generate error.
     {
         psMemId id = psMemGetId();
         psVector *tmpVecF64 = psVectorAlloc(TST01_VECTOR_LENGTH, PS_TYPE_F64);
-        psVector *tmpVec = pmFindVectorPeaks(tmpVecF64, 0.0);
-        ok(tmpVec == NULL, "pmFindVectorPeaks() returned a NULL with F64 psVector input");
+        psVector *tmpVec = pmPeaksInVector(tmpVecF64, 0.0);
+        ok(tmpVec == NULL, "pmPeaksInVector() returned a NULL with F64 psVector input");
         psFree(tmpVecF64);
         psFree(tmpVec);
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     }
-    ok(test_pmFindVectorPeaks(1), "Tested pmFindVectorPeaks() on length 1 input vector");
-    ok(test_pmFindVectorPeaks(10), "Tested pmFindVectorPeaks() on length 10 input vector");
+    ok(test_pmPeaksInVector(1), "Tested pmPeaksInVector() on length 1 input vector");
+    ok(test_pmPeaksInVector(10), "Tested pmPeaksInVector() on length 10 input vector");
 
 
 
     // ----------------------------------------
-    // pmFindImagePeaks() tests
-    // Calling pmFindImagePeaks with NULL psImage.  Should generate error.
-    {
-        psMemId id = psMemGetId();
-        psArray *tmpArray = pmFindImagePeaks(NULL, 0.0);
-        ok(tmpArray == NULL, "pmFindImagePeaks() returned NULL with NULL input image");
+    // pmPeaksInImage() tests
+    // Calling pmPeaksInImage with NULL psImage.  Should generate error.
+    {
+        psMemId id = psMemGetId();
+        psArray *tmpArray = pmPeaksInImage(NULL, 0.0);
+        ok(tmpArray == NULL, "pmPeaksInImage() returned NULL with NULL input image");
         psFree(tmpArray);
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
@@ -330,10 +340,10 @@
 
 
-    // Calling pmFindImagePeaks with empty psImage.  Should generate error.
+    // Calling pmPeaksInImage with empty psImage.  Should generate error.
     {
         psMemId id = psMemGetId();
         psImage *tmpImageEmpty = psImageAlloc(0, 0, PS_TYPE_F32);
-        psArray *tmpArray = pmFindImagePeaks(tmpImageEmpty, 0.0);
-        ok(tmpArray == NULL, "pmFindImagePeaks() returned NULL with empty input image");
+        psArray *tmpArray = pmPeaksInImage(tmpImageEmpty, 0.0);
+        ok(tmpArray == NULL, "pmPeaksInImage() returned NULL with empty input image");
         psFree(tmpArray);
         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
@@ -341,10 +351,10 @@
     
 
-    // Calling pmFindImagePeaks with PS_TYPE_F64 psImage.  Should generate error
+    // Calling pmPeaksInImage with PS_TYPE_F64 psImage.  Should generate error
     {
         psMemId id = psMemGetId();
         psImage *tmpImageF64 = psImageAlloc(TST02_NUM_ROWS, TST02_NUM_COLS, PS_TYPE_F64);
-        psArray *tmpArray = pmFindImagePeaks(tmpImageF64, 0.0);
-        ok(tmpArray == NULL, "pmFindImagePeaks() returned NULL with F64 input image");
+        psArray *tmpArray = pmPeaksInImage(tmpImageF64, 0.0);
+        ok(tmpArray == NULL, "pmPeaksInImage() returned NULL with F64 input image");
         psFree(tmpImageF64);
         psFree(tmpArray);
@@ -353,17 +363,18 @@
 
 
-    //    testStatus&= test_pmFindImagePeaks(1, 1);
-    //    testStatus&= test_pmFindImagePeaks(2, 5);
-    //    testStatus&= test_pmFindImagePeaks(5, 2);
+    // XXX: Uncomment these and debug
+    //    testStatus&= test_pmPeaksInImage(1, 1);
+    //    testStatus&= test_pmPeaksInImage(2, 5);
+    //    testStatus&= test_pmPeaksInImage(5, 2);
     // HEY: add code for small images
-    //    testStatus&= test_pmFindImagePeaks(1, 1);
-    //    testStatus&= test_pmFindImagePeaks(1, 8);
-    //    testStatus&= test_pmFindImagePeaks(8, 1);
-    ok(test_pmFindImagePeaks(TST02_NUM_ROWS, TST02_NUM_COLS),
-      "Tested pmFindImagePeaks() on (%d, %d) image", TST02_NUM_ROWS, TST02_NUM_COLS);
-    ok(test_pmFindImagePeaks(2*TST02_NUM_ROWS, TST02_NUM_COLS),
-      "Tested pmFindImagePeaks() on (%d, %d) image", 2*TST02_NUM_ROWS, TST02_NUM_COLS);
-    ok(test_pmFindImagePeaks(TST02_NUM_ROWS, 2*TST02_NUM_COLS),
-      "Tested pmFindImagePeaks() on (%d, %d) image", TST02_NUM_ROWS, 2*TST02_NUM_COLS);
+    //    testStatus&= test_pmPeaksInImage(1, 1);
+    //    testStatus&= test_pmPeaksInImage(1, 8);
+    //    testStatus&= test_pmPeaksInImage(8, 1);
+    ok(test_pmPeaksInImage(TST02_NUM_ROWS, TST02_NUM_COLS),
+      "Tested pmPeaksInImage() on (%d, %d) image", TST02_NUM_ROWS, TST02_NUM_COLS);
+    ok(test_pmPeaksInImage(2*TST02_NUM_ROWS, TST02_NUM_COLS),
+      "Tested pmPeaksInImage() on (%d, %d) image", 2*TST02_NUM_ROWS, TST02_NUM_COLS);
+    ok(test_pmPeaksInImage(TST02_NUM_ROWS, 2*TST02_NUM_COLS),
+      "Tested pmPeaksInImage() on (%d, %d) image", TST02_NUM_ROWS, 2*TST02_NUM_COLS);
 
 
@@ -399,5 +410,5 @@
     {
         psMemId id = psMemGetId();
-        psArray *outData = pmFindImagePeaks(imgData, 0.0);
+        psArray *outData = pmPeaksInImage(imgData, 0.0);
         psArray *outData2 = pmPeaksSubset(outData, PS_MAX_F32, psRegionSet(20, 20, 20, 20));
         ok(outData2 != NULL && psMemCheckArray(outData),
@@ -415,5 +426,5 @@
     {
         psMemId id = psMemGetId();
-        psArray *outData = pmFindImagePeaks(imgData, 0.0);
+        psArray *outData = pmPeaksInImage(imgData, 0.0);
         psArray *outData2 = pmPeaksSubset(outData, 0.0, psRegionSet(20, 20, 20, 20));
         ok(outData2 != NULL && psMemCheckArray(outData),
@@ -431,5 +442,5 @@
     {
         psMemId id = psMemGetId();
-        psArray *outData = pmFindImagePeaks(imgData, 0.0);
+        psArray *outData = pmPeaksInImage(imgData, 0.0);
         psRegion tmpRegion = psRegionSet(-PS_MAX_F32, PS_MAX_F32, -PS_MAX_F32, PS_MAX_F32);
         psArray *outData2 = pmPeaksSubset(outData, PS_MAX_F32, tmpRegion);
@@ -448,5 +459,5 @@
     {
         psMemId id = psMemGetId();
-        psArray *outData = pmFindImagePeaks(imgData, 0.0);
+        psArray *outData = pmPeaksInImage(imgData, 0.0);
         psRegion tmpRegion = psRegionSet(-PS_MAX_F32, PS_MAX_F32, -PS_MAX_F32, PS_MAX_F32);
         psArray *outData2 = pmPeaksSubset(outData, 0.0, tmpRegion);
