Index: /trunk/psLib/test/dataIO/tst_psLookupTable_01.c
===================================================================
--- /trunk/psLib/test/dataIO/tst_psLookupTable_01.c	(revision 2705)
+++ /trunk/psLib/test/dataIO/tst_psLookupTable_01.c	(revision 2706)
@@ -4,19 +4,14 @@
 *
 *  This test driver contains the following tests for psMetadata:
-*     Test A - Read 1st hdr from simple FITS file
-*     Test B - Read 2nd hdr from complex FITS file
-*     Test C - Read named hdr from complex FITS file
-*     Test D - Remove items with same name from all metadata
-*     Test E - Attempt to use null file descriptor
-*     Test F - Attempt to open nonexistant file
-*     Test G - Attempt to use two null inputs
-*     Test H - Attempt to use bad extNum
-*     Test I - Attempt to use bad extNameTest
-*     Test J - Free psMetadataData
+*     Test A - Read table and interpolate value
+*     Test B - Read table and interpolate all values
+*     Test C - Read beyond lower table bound
+*     Test D - Read beyond upper table bound
+*     Test E - Free data
 *
 *  @author  Ross Harman, MHPCC
 *
-*  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2004-11-22 21:10:52 $
+*  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2004-12-13 22:32:02 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -32,4 +27,8 @@
 int main(int argc, char* argv[])
 {
+
+
+    // Test A - Read table and interpolate value
+    printPositiveTestHeader(stdout, "psMetadata", "Test A - Read table and interpolate value");
     psLookupStatusType status1 = 0;
     psF64 index1 = 2450905.0;
@@ -37,14 +36,79 @@
     psLookupTable* table1 = NULL;
 
-    table1 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 0);
+    table1 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 2451179.6);
     table1 = psLookupTableRead(table1);
     out1 = psLookupTableInterpolate(table1, index1, 0, &status1);
-    printf("%lf\n", out1);
+    if(fabs(out1-31.5)>FLT_EPSILON) {
+        printf("ERROR: Incorrect value, %lf. Expected 31.5\n", out1);
+    } else if(status1 != PS_LOOKUP_SUCCESS) {
+        printf("ERROR: Bad return status, %d\n", status1);
+    }
+    printFooter(stdout, "psMetadata", "Test A - Read table and interpolate value", true);
 
 
-    // Test  - Free psMetadata
-    printPositiveTestHeader(stdout, "psMetadata", "Test J - Free psMetadata");
+    // Test B - Read table and interpolate all values
+    printPositiveTestHeader(stdout, "psMetadata", "Test B - Read table and interpolate all values");
+    psU64 i = 0;
+    psF64 index2 = 2450905.0;
+    psVector *out2 = NULL;
+    psLookupTable* table2 = NULL;
+    psVector *stats2 = NULL;
+    psF64 truthData2[] = {31.5, 41317, 0};
+
+    table2 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 2451179.6);
+    table2 = psLookupTableRead(table2);
+    stats2 = psVectorAlloc(table2->numCols, PS_TYPE_U32);
+    out2 = psLookupTableInterpolateAll(table2, index2, stats2);
+
+    for(i=0; i<table2->numCols; i++) {
+        if(fabs(out2->data.F64[i]-truthData2[i])>FLT_EPSILON) {
+            printf("ERROR: Incorrect value, %lf. Expected %lf\n", out2->data.F64[i], truthData2[i]);
+        } else if(status1 != PS_LOOKUP_SUCCESS) {
+            printf("ERROR: Bad return status, %d for column %lld\n", stats2->data.U32[i], i);
+        }
+    }
+    printFooter(stdout, "psMetadata", "Test B - Read table and interpolate all values", true);
+
+
+    // Test C - Read beyond lower table bound
+    printPositiveTestHeader(stdout, "psMetadata", "Test C - Read beyond lower table bound");
+    psLookupStatusType status3 = 0;
+    psF64 index3 = 2451179.7;
+    psF64 out3 = 0.0;
+    psLookupTable* table3 = NULL;
+
+    table3 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 2451179.6);
+    table3 = psLookupTableRead(table3);
+    out3 = psLookupTableInterpolate(table3, index3, 0, &status3);
+    if(status3 != PS_LOOKUP_PAST_BOTTOM) {
+        printf("ERROR: Bad return status, %d\n", status3);
+    }
+    printFooter(stdout, "psMetadata", "Test C - Read beyond lower table bound", true);
+
+    // Test D - Read beyond upper table bound
+    printPositiveTestHeader(stdout, "psMetadata", "Test D - Read beyond upper table bound");
+    psLookupStatusType status4 = 0;
+    psF64 index4 = 0.0;
+    psF64 out4 = 0.0;
+    psLookupTable* table4 = NULL;
+
+    table4 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 2451179.6);
+    table4 = psLookupTableRead(table4);
+    out4 = psLookupTableInterpolate(table4, index4, 0, &status4);
+    if(status4 != PS_LOOKUP_PAST_TOP) {
+        printf("ERROR: Bad return status, %d\n", status4);
+    }
+    printFooter(stdout, "psMetadata", "Test D - Read beyond upper table bound", true);
+
+
+    // Test E - Free data
+    printPositiveTestHeader(stdout, "psMetadata", "Test E - Free data");
     psFree(table1);
-    if ( psMemCheckLeaks(0, NULL, stdout, false) ) {
+    psFree(table2);
+    psFree(table3);
+    psFree(table4);
+    psFree(out2);
+    psFree(stats2);
+    if (psMemCheckLeaks(0, NULL, stdout, false)) {
         psError(PS_ERR_UNKNOWN,true,"Memory leaks detected");
         return 10;
@@ -55,23 +119,5 @@
         printf("ERROR: Found %d bad memory blocks\n", nBad);
     }
-    printFooter(stdout, "psMetadata", "Test J - Free psMetadata", true);
-
-
-    psU64 i = 0;
-    psF64 index2 = 2450905.0;
-    psVector *out2 = NULL;
-    psLookupTable* table2 = NULL;
-    psVector *stats2 = NULL;
-
-
-    table2 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 0);
-    table2 = psLookupTableRead(table2);
-    stats2 = psVectorAlloc(table2->numCols, PS_TYPE_MASK);
-    out2 = psLookupTableInterpolateAll(table2, index2, stats2);
-
-    for(i=0; i<table2->numCols; i++) {
-        printf("%lf\n", out2->data.F64[i]);
-        printf("%d\n", stats2->data.U8[i]);
-    }
+    printFooter(stdout, "psMetadata", "Test E - Free data", true);
 
 
Index: /trunk/psLib/test/fileUtils/tst_psLookupTable_01.c
===================================================================
--- /trunk/psLib/test/fileUtils/tst_psLookupTable_01.c	(revision 2705)
+++ /trunk/psLib/test/fileUtils/tst_psLookupTable_01.c	(revision 2706)
@@ -4,19 +4,14 @@
 *
 *  This test driver contains the following tests for psMetadata:
-*     Test A - Read 1st hdr from simple FITS file
-*     Test B - Read 2nd hdr from complex FITS file
-*     Test C - Read named hdr from complex FITS file
-*     Test D - Remove items with same name from all metadata
-*     Test E - Attempt to use null file descriptor
-*     Test F - Attempt to open nonexistant file
-*     Test G - Attempt to use two null inputs
-*     Test H - Attempt to use bad extNum
-*     Test I - Attempt to use bad extNameTest
-*     Test J - Free psMetadataData
+*     Test A - Read table and interpolate value
+*     Test B - Read table and interpolate all values
+*     Test C - Read beyond lower table bound
+*     Test D - Read beyond upper table bound
+*     Test E - Free data
 *
 *  @author  Ross Harman, MHPCC
 *
-*  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2004-11-22 21:10:52 $
+*  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2004-12-13 22:32:02 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -32,4 +27,8 @@
 int main(int argc, char* argv[])
 {
+
+
+    // Test A - Read table and interpolate value
+    printPositiveTestHeader(stdout, "psMetadata", "Test A - Read table and interpolate value");
     psLookupStatusType status1 = 0;
     psF64 index1 = 2450905.0;
@@ -37,14 +36,79 @@
     psLookupTable* table1 = NULL;
 
-    table1 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 0);
+    table1 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 2451179.6);
     table1 = psLookupTableRead(table1);
     out1 = psLookupTableInterpolate(table1, index1, 0, &status1);
-    printf("%lf\n", out1);
+    if(fabs(out1-31.5)>FLT_EPSILON) {
+        printf("ERROR: Incorrect value, %lf. Expected 31.5\n", out1);
+    } else if(status1 != PS_LOOKUP_SUCCESS) {
+        printf("ERROR: Bad return status, %d\n", status1);
+    }
+    printFooter(stdout, "psMetadata", "Test A - Read table and interpolate value", true);
 
 
-    // Test  - Free psMetadata
-    printPositiveTestHeader(stdout, "psMetadata", "Test J - Free psMetadata");
+    // Test B - Read table and interpolate all values
+    printPositiveTestHeader(stdout, "psMetadata", "Test B - Read table and interpolate all values");
+    psU64 i = 0;
+    psF64 index2 = 2450905.0;
+    psVector *out2 = NULL;
+    psLookupTable* table2 = NULL;
+    psVector *stats2 = NULL;
+    psF64 truthData2[] = {31.5, 41317, 0};
+
+    table2 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 2451179.6);
+    table2 = psLookupTableRead(table2);
+    stats2 = psVectorAlloc(table2->numCols, PS_TYPE_U32);
+    out2 = psLookupTableInterpolateAll(table2, index2, stats2);
+
+    for(i=0; i<table2->numCols; i++) {
+        if(fabs(out2->data.F64[i]-truthData2[i])>FLT_EPSILON) {
+            printf("ERROR: Incorrect value, %lf. Expected %lf\n", out2->data.F64[i], truthData2[i]);
+        } else if(status1 != PS_LOOKUP_SUCCESS) {
+            printf("ERROR: Bad return status, %d for column %lld\n", stats2->data.U32[i], i);
+        }
+    }
+    printFooter(stdout, "psMetadata", "Test B - Read table and interpolate all values", true);
+
+
+    // Test C - Read beyond lower table bound
+    printPositiveTestHeader(stdout, "psMetadata", "Test C - Read beyond lower table bound");
+    psLookupStatusType status3 = 0;
+    psF64 index3 = 2451179.7;
+    psF64 out3 = 0.0;
+    psLookupTable* table3 = NULL;
+
+    table3 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 2451179.6);
+    table3 = psLookupTableRead(table3);
+    out3 = psLookupTableInterpolate(table3, index3, 0, &status3);
+    if(status3 != PS_LOOKUP_PAST_BOTTOM) {
+        printf("ERROR: Bad return status, %d\n", status3);
+    }
+    printFooter(stdout, "psMetadata", "Test C - Read beyond lower table bound", true);
+
+    // Test D - Read beyond upper table bound
+    printPositiveTestHeader(stdout, "psMetadata", "Test D - Read beyond upper table bound");
+    psLookupStatusType status4 = 0;
+    psF64 index4 = 0.0;
+    psF64 out4 = 0.0;
+    psLookupTable* table4 = NULL;
+
+    table4 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 2451179.6);
+    table4 = psLookupTableRead(table4);
+    out4 = psLookupTableInterpolate(table4, index4, 0, &status4);
+    if(status4 != PS_LOOKUP_PAST_TOP) {
+        printf("ERROR: Bad return status, %d\n", status4);
+    }
+    printFooter(stdout, "psMetadata", "Test D - Read beyond upper table bound", true);
+
+
+    // Test E - Free data
+    printPositiveTestHeader(stdout, "psMetadata", "Test E - Free data");
     psFree(table1);
-    if ( psMemCheckLeaks(0, NULL, stdout, false) ) {
+    psFree(table2);
+    psFree(table3);
+    psFree(table4);
+    psFree(out2);
+    psFree(stats2);
+    if (psMemCheckLeaks(0, NULL, stdout, false)) {
         psError(PS_ERR_UNKNOWN,true,"Memory leaks detected");
         return 10;
@@ -55,23 +119,5 @@
         printf("ERROR: Found %d bad memory blocks\n", nBad);
     }
-    printFooter(stdout, "psMetadata", "Test J - Free psMetadata", true);
-
-
-    psU64 i = 0;
-    psF64 index2 = 2450905.0;
-    psVector *out2 = NULL;
-    psLookupTable* table2 = NULL;
-    psVector *stats2 = NULL;
-
-
-    table2 = psLookupTableAlloc("../../data/tai_utc.dat", 0, 0);
-    table2 = psLookupTableRead(table2);
-    stats2 = psVectorAlloc(table2->numCols, PS_TYPE_MASK);
-    out2 = psLookupTableInterpolateAll(table2, index2, stats2);
-
-    for(i=0; i<table2->numCols; i++) {
-        printf("%lf\n", out2->data.F64[i]);
-        printf("%d\n", stats2->data.U8[i]);
-    }
+    printFooter(stdout, "psMetadata", "Test E - Free data", true);
 
 
