Index: trunk/psLib/src/types/psLookupTable.c
===================================================================
--- trunk/psLib/src/types/psLookupTable.c	(revision 9690)
+++ trunk/psLib/src/types/psLookupTable.c	(revision 9714)
@@ -7,6 +7,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-10-20 02:36:51 $
+*  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-10-22 00:49:57 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
@@ -69,6 +69,6 @@
 static void lookupTableFree(psLookupTable* table);
 
-/** Determines if a line is blank (whitespace only) or a commentline. It returns true if so. The input string
- *  must be null terminated. */
+/* Determines if a line is blank (whitespace only) or a commentline. It returns true if so.
+   The input string must be null terminated. */
 static bool ignoreLine(char *inString)
 {
@@ -83,6 +83,6 @@
 
 
-/** Removes leading and trailing whitespace and # characters from a string. The cleaned string is a new null
- *  terminated copy of the original input string. */
+/* Removes leading and trailing whitespace and # characters from a string. The
+   cleaned string is a new null terminated copy of the original input string. */
 static char *cleanString(char *inString,
                          int sLen)
@@ -95,7 +95,7 @@
 
     // Skip over leading # or whitespace
-    while (isspace(*ptrB) || *ptrB=='#') {
-        ptrB++;
-    }
+    //    while (isspace(*ptrB) || *ptrB=='#') {
+    //        ptrB++;
+    //    }
 
     // Skip over trailing whitespace, null terminators, and # characters
@@ -115,6 +115,7 @@
 
 
-/** Returns cleaned token based on delimiter, but not including delimiter. Also changes the pointer location
- * the beginning of the string. Tokens are newly allocated null terminated strings. */
+/* Returns cleaned token based on delimiter, but not including delimiter. Also changes
+   the pointer location the beginning of the string. Tokens are newly allocated null
+    terminated strings. */
 static char* getToken(char **inString,
                       char *delimiter,
@@ -138,12 +139,14 @@
         // Move to end of token
         (*inString) += sLen;
-    } else if(**inString!='\0' && sLen==0) {
-        *status = PS_PARSE_ERROR_GENERAL;
-    }
-
+    }
+    /*    else if(**inString!='\0' && sLen==0) {
+            *status = PS_PARSE_ERROR_GENERAL;
+        }
+    */
     return cleanToken;
 }
 
-/** Returns single parsed value as a psS32. The input string must be cleaned and null terminated. */
+/* Returns single parsed value as a psS32. The input string must be cleaned and
+   null terminated. */
 static psS32 parseS32(char *inString,
                       psParseErrorType *status)
@@ -164,5 +167,6 @@
 }
 
-/** Returns single parsed value as a psS64. The input string must be cleaned and null terminated. */
+/* Returns single parsed value as a psS64. The input string must be cleaned and
+   null terminated. */
 static psS64 parseS64(char *inString,
                       psParseErrorType *status)
@@ -182,5 +186,6 @@
 }
 
-/** Returns single parsed value as a psF32. The input string must be cleaned and null terminated. */
+/* Returns single parsed value as a psF32. The input string must be cleaned and
+   null terminated. */
 static psF32 parseF32(char *inString,
                       psParseErrorType *status)
@@ -200,5 +205,6 @@
 }
 
-/** Returns single parsed value as a psF64. The input string must be cleaned and null terminated. */
+/* Returns single parsed value as a psF64. The input string must be cleaned and
+   null terminated. */
 static psF64 parseF64(char *inString,
                       psParseErrorType *status)
@@ -218,6 +224,6 @@
 }
 
-/** Returns single parsed value as a double precision number. The input string must be cleaned and null
- * terminated. */
+/* Returns single parsed value as a double precision number. The input string must be
+   cleaned and null terminated. */
 static void parseValue(psVector *vec,
                        psU64 index,
@@ -474,5 +480,6 @@
             // Don't increase number of columns
         } else {
-            psError(PS_ERR_BAD_PARAMETER_VALUE,true,"Invalid format specifier");
+            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                    "Invalid format specifier");
             psFree(strValue);
             numCols = 0;
@@ -500,5 +507,6 @@
 
             // Loop through file to get numRows, numCols, and column data types
-            while((fgets(line, MAX_STRING_LENGTH, fp) != NULL) && (parseStatus == PS_PARSE_SUCCESS)) {
+            while((fgets(line, MAX_STRING_LENGTH, fp) != NULL) &&
+                    (parseStatus == PS_PARSE_SUCCESS))   {
 
                 // Copy pointer to line for parsing
@@ -515,7 +523,6 @@
 
                     // Loop through format and line strings to get values in text table file
-                    while((strValue=getToken((char**)&tempFormat," \t",&parseStatus)) &&
-                            (strNum=getToken((char**)&linePtr," \t",&parseStatus)) ) {
-
+                    while((strValue=getToken((char**)&tempFormat," \t",&parseStatus))
+                            && (strNum=getToken((char**)&linePtr," \t",&parseStatus)) ) {
                         // Set column vector
                         colVector = outputArray->data[arrayIndex];
@@ -523,17 +530,21 @@
                         // Set column entries based on format string defining the type
                         if(strcmp(strValue,"\%d") == 0 ) {
-                            colVector = psVectorRecycle(colVector, numRows, colVector->type.type);
+                            colVector = psVectorRecycle(colVector, numRows,
+                                                        colVector->type.type);
                             parseValue(colVector,numRows-1,strNum,&parseStatus);
                             arrayIndex++;
                         } else if (strcmp(strValue,"\%ld") == 0) {
-                            colVector = psVectorRecycle(colVector, numRows, colVector->type.type);
+                            colVector = psVectorRecycle(colVector, numRows,
+                                                        colVector->type.type);
                             parseValue(colVector,numRows-1,strNum,&parseStatus);
                             arrayIndex++;
                         } else if (strcmp(strValue,"\%f") == 0) {
-                            colVector = psVectorRecycle(colVector, numRows, colVector->type.type);
+                            colVector = psVectorRecycle(colVector, numRows,
+                                                        colVector->type.type);
                             parseValue(colVector,numRows-1,strNum,&parseStatus);
                             arrayIndex++;
                         } else if (strcmp(strValue,"\%lf") == 0) {
-                            colVector = psVectorRecycle(colVector, numRows, colVector->type.type);
+                            colVector = psVectorRecycle(colVector, numRows,
+                                                        colVector->type.type);
                             parseValue(colVector,numRows-1,strNum,&parseStatus);
                             arrayIndex++;
@@ -544,7 +555,9 @@
                         psFree(strNum);
 
-                        // If the file line was not parsed successful report error and return NULL
+                        // If the file line was not parsed successful report
+                        // error and return NULL
                         if(parseStatus != PS_PARSE_SUCCESS) {
-                            psError(PS_ERR_UNKNOWN,true,"Parsing text file failed.");
+                            psError(PS_ERR_UNKNOWN, true,
+                                    "Parsing text file failed.");
                             fclose(fp);
                             psFree(outputArray);
@@ -556,4 +569,14 @@
             }
 
+            //Return NULL for an empty table
+            if (numRows == 0) {
+                psError(PS_ERR_UNKNOWN, true,
+                        "Parsing text file failed - input table is empty.");
+                fclose(fp);
+                psFree(outputArray);
+                psFree(line);
+                return NULL;
+            }
+
             // Read on the lines in the file - close file pointer
             fclose(fp);
@@ -562,5 +585,6 @@
     } else {
         // Format string parse error detected
-        psError(PS_ERR_UNKNOWN,true,"Format string was not parsed sucessfully");
+        psError(PS_ERR_UNKNOWN, true,
+                "Format string was not parsed sucessfully");
         psFree(outputArray);
         return NULL;
@@ -588,11 +612,12 @@
     // Check for invalid index column
     if(indexCol < 0 ) {
-        psError(PS_ERR_BAD_PARAMETER_VALUE,true,"Index column cannot be less than zero");
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                "Index column cannot be less than zero");
         return NULL;
     }
 
     if (indexCol >= vectors->n) {
-        psError(PS_ERR_BAD_PARAMETER_VALUE,true,"Index column, %ld, is larger than number of columns, %ld.",
-                indexCol, vectors->n);
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Index column, %ld, is larger"
+                " than number of columns, %ld.", indexCol, vectors->n);
         return NULL;
     }
@@ -647,5 +672,6 @@
     } else {
         // Index vector is already sorted
-        // Assign array vector specified by indexCol to table index vector and increment memory ref
+        // Assign array vector specified by indexCol to table index vector
+        // and increment memory ref
         table->index = vectors->data[indexCol];
         table->values = (psArray*)vectors;
@@ -806,5 +832,5 @@
 
     // Verify the index is within the bounds of the table
-    CHECK_LOWER_UPPER_BOUND(table,index,column)
+    CHECK_LOWER_UPPER_BOUND(table,index,column);
 
     // Find location in table where specified index is between to entries
@@ -812,9 +838,11 @@
     while(index > convertVal ) {
         hiIdx++;
-        if(hiIdx >= numRows) {
-            psError(PS_ERR_BAD_PARAMETER_VALUE, true,
-                    _("High index too big, %" PRIu64 "."), hiIdx);
-            return NAN;
-        }
+        /*  XXX:  following is unreachable.
+                if(hiIdx >= numRows) {
+                    psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                            _("High index too big, %" PRIu64 "."), hiIdx);
+                    return NAN;
+                }
+        */
         CONVERT_VALUE_TO_F64(indexVec, hiIdx, convertVal)
     }
@@ -833,5 +861,6 @@
     denom -= convertVal;
     if(fabs(denom) < FLT_EPSILON) {
-        psError(PS_ERR_BAD_PARAMETER_VALUE, true, _("Divide by zero error during interpolation."));
+        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
+                _("Divide by zero error during interpolation."));
         return NAN;
     } else {
@@ -848,7 +877,6 @@
 }
 
-psVector* psLookupTableInterpolateAll(
-    const psLookupTable *table,
-    double index)
+psVector* psLookupTableInterpolateAll(const psLookupTable *table,
+                                      double index)
 {
     long numCols = 0;
Index: trunk/psLib/src/types/psLookupTable.h
===================================================================
--- trunk/psLib/src/types/psLookupTable.h	(revision 9690)
+++ trunk/psLib/src/types/psLookupTable.h	(revision 9714)
@@ -7,6 +7,6 @@
 *  @author Ross Harman, MHPCC
 *
-*  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2006-06-13 23:54:57 $
+*  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2006-10-22 00:49:57 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -80,7 +80,7 @@
  */
 psLookupTable* psLookupTableAlloc(
-    const char *filename,           ///< Name of file to read
-    const char *format,             ///< scanf-like format string
-    long indexCol                    ///< Column of the index vector (starting at zero)
+    const char *filename,              ///< Name of file to read
+    const char *format,                ///< scanf-like format string
+    long indexCol                      ///< Column of the index vector (starting at zero)
 );
 
@@ -92,6 +92,6 @@
  */
 psArray *psVectorsReadFromFile(
-    const char* filename,            ///< File to be read
-    const char* format               ///< scanf-like format string
+    const char* filename,              ///< File to be read
+    const char* format                 ///< scanf-like format string
 );
 
@@ -115,5 +115,5 @@
  */
 long psLookupTableRead(
-    psLookupTable *table            ///< Table to read
+    psLookupTable *table               ///< Table to read
 );
 
@@ -140,5 +140,5 @@
 psVector* psLookupTableInterpolateAll(
     const psLookupTable *table,         ///< Table with data
-    double index                       ///< Value to be interpolated
+    double index                        ///< Value to be interpolated
 );
 
Index: trunk/psLib/test/types/table.dat
===================================================================
--- trunk/psLib/test/types/table.dat	(revision 9714)
+++ trunk/psLib/test/types/table.dat	(revision 9714)
@@ -0,0 +1,9 @@
+#  Table with valid types and index-values
+#
+#psF32     psU16    psU32     psU64    psS8    psS16    psS32    psS64    psU8   psF64
+-10.05    2        4         8        0       -2       -4       -8       5      -1.5
+ 1.009     4        8         16       -1      -4       -8       -16      0      -1.0
+23.45     6        12        24       -2      -6       -12      -24      5      -0.25
+3500.67   8        16        32       -3      -8       -16      -32      75     1.75
+   
+#
Index: trunk/psLib/test/types/table2.dat
===================================================================
--- trunk/psLib/test/types/table2.dat	(revision 9714)
+++ trunk/psLib/test/types/table2.dat	(revision 9714)
@@ -0,0 +1,9 @@
+#  Table with valid types and index-values
+#
+#psF32     psU16    psU32     psU64    psS8    psS16    psS32    psS64    psU8   psF64
+-10.05    2        4         8        0       -2        1       -8       5      -1.5
+ 1e-20     4        8         16       -1      -4       1       -16      0      -1.0
+2e-20     6        12        24       -2      -6        1       -24      5      -0.25
+3500.67   8        16        32       -3      -8        1      -32      75     1.75
+
+#
Index: trunk/psLib/test/types/tableF32.dat
===================================================================
--- trunk/psLib/test/types/tableF32.dat	(revision 9690)
+++ 	(revision )
@@ -1,9 +1,0 @@
-#  Table with valid types and index-values
-#
-#psF32     psU16    psU32     psU64    psS8    psS16    psS32    psS64    psU8   psF64
--10.05    2        4         8        0       -2       -4       -8       5      -1.5
- 1.009     4        8         16       -1      -4       -8       -16      0      -1.0
-23.45     6        12        24       -2      -6       -12      -24      5      -0.25
-3500.67   8        16        32       -3      -8       -16      -32      75     1.75
-   
-#
Index: trunk/psLib/test/types/tableF32_err.dat
===================================================================
--- trunk/psLib/test/types/tableF32_err.dat	(revision 9714)
+++ trunk/psLib/test/types/tableF32_err.dat	(revision 9714)
@@ -0,0 +1,9 @@
+#  Table with valid types and index-values
+#
+#psF32     psU16    psU32     psU64    psS8    psS16    psS32    psS64    psU8   psF64
+-10.05    2        4         8        0       -2       -4       -8       5      -1.5
+ k.009     4        8         16       -1      -4       -8       -16      0      -1.0
+23.45     6        12        24       -2      -6       -12      -24      5      -0.25
+3500.67   8        16        32       -3      -8       -16      -32      75     1.75
+   
+#
Index: trunk/psLib/test/types/tableF64_err.dat
===================================================================
--- trunk/psLib/test/types/tableF64_err.dat	(revision 9714)
+++ trunk/psLib/test/types/tableF64_err.dat	(revision 9714)
@@ -0,0 +1,9 @@
+#  Table with valid types and index-values
+#
+#psF32     psU16    psU32     psU64    psS8    psS16    psS32    psS64    psU8   psF64
+-10.05    2        4         8        0       -2       -4       -8       5      -1.5  #
+ 1.009     4        8         16       -1      -4       -8       -16      0      -1.k
+23.45     6        12        24       -2      -6       -12      -24      5      -0.25
+3500.67   8        16        32       -3      -8       -16      -32      75     1.75
+
+#
Index: trunk/psLib/test/types/tableS32_err.dat
===================================================================
--- trunk/psLib/test/types/tableS32_err.dat	(revision 9714)
+++ trunk/psLib/test/types/tableS32_err.dat	(revision 9714)
@@ -0,0 +1,9 @@
+#  Table with valid types and index-values
+#
+#psF32     psU16    psU32     psU64    psS8    psS16    psS32    psS64    psU8   psF64
+-10.05    2        4         8        0       -2       -4       -8       5      -1.5
+ 1.009     4        8         16       -1      -4       -k8       -16      0      -1.0
+23.45     6        12        24       -2      -6       -12      -24      5      -0.25
+3500.67   8        16        32       -3      -8       -16      -32      75     1.75
+
+#
Index: trunk/psLib/test/types/tableS64_err.dat
===================================================================
--- trunk/psLib/test/types/tableS64_err.dat	(revision 9714)
+++ trunk/psLib/test/types/tableS64_err.dat	(revision 9714)
@@ -0,0 +1,9 @@
+#  Table with valid types and index-values
+#
+#psF32     psU16    psU32     psU64    psS8    psS16    psS32    psS64    psU8   psF64
+-10.05    2        4         8        0       -2       -4       -8       5      -1.5
+ 1.009     4        8         16       -1      -4       -8       -k6      0      -1.0
+23.45     6        12        24       -2      -6       -12      -24      5      -0.25
+3500.67   8        16        32       -3      -8       -16      -32      75     1.75
+
+#
Index: trunk/psLib/test/types/tap_psLookupTable_all.c
===================================================================
--- trunk/psLib/test/types/tap_psLookupTable_all.c	(revision 9690)
+++ trunk/psLib/test/types/tap_psLookupTable_all.c	(revision 9714)
@@ -24,5 +24,5 @@
 int main(void)
 {
-    plan_tests(13);
+    plan_tests(27);
 
     diag("Tests for psLookupTable Functions");
@@ -46,17 +46,17 @@
         lt = psLookupTableAlloc(NULL, "\%f \%lf \%d \%ld", 10);
         ok( lt == NULL,
-            "psLookupTableAlloc:            return NULL for NULL filename input.");
+            "psLookupTableAlloc:               return NULL for NULL filename input.");
     }
     //Return NULL for NULL format input
     {
-        lt = psLookupTableAlloc("tableF32.dat", NULL, 10);
+        lt = psLookupTableAlloc("table.dat", NULL, 10);
         ok( lt == NULL,
-            "psLookupTableAlloc:            return NULL for NULL format input.");
+            "psLookupTableAlloc:               return NULL for NULL format input.");
     }
     //Return properly allocated lookupTable for valid inputs
     {
-        lt = psLookupTableAlloc("tableF32.dat", "\%f \%lf \%d \%ld", 10);
+        lt = psLookupTableAlloc("table.dat", "\%f \%lf \%d \%ld", 10);
         ok( lt != NULL && psMemCheckLookupTable(lt),
-            "psLookupTableAlloc:            "
+            "psLookupTableAlloc:               "
             "return properly allocated lookupTable for valid inputs.");
     }
@@ -67,5 +67,5 @@
         int j = 2;
         ok( !psMemCheckLookupTable(&j),
-            "psMemCheckLookupTable:         return false for non-LookupTable input.");
+            "psMemCheckLookupTable:            return false for non-LookupTable input.");
     }
 
@@ -82,8 +82,8 @@
     diag("  >>>Test 2:  psVectorsReadFromFile, psLookupTableImport, psLookupTableRead Fxns");
     psArray *outVec = NULL;
+    psArray *vectors = NULL;
     psLookupTable*  table1  = NULL;
+    psLookupTable*  tableOut  = NULL;
     long           numRows = 0;
-    char filename[30];
-    strcpy(filename, "tableF32.dat");
 
     //Tests for psVectorReadFromFile
@@ -93,11 +93,11 @@
                                        "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf");
         ok( outVec == NULL,
-            "psVectorsReadFromFile:         return NULL for NULL filename input.");
+            "psVectorsReadFromFile:            return NULL for NULL filename input.");
     }
     // Attempt to read from NULL format input
     {
-        outVec = psVectorsReadFromFile(filename, NULL);
-        ok( outVec == NULL,
-            "psVectorsReadFromFile:         return NULL for NULL format input.");
+        outVec = psVectorsReadFromFile("table.dat", NULL);
+        ok( outVec == NULL,
+            "psVectorsReadFromFile:            return NULL for NULL format input.");
     }
     // Attempt to read from invalid filename input
@@ -106,171 +106,111 @@
                                        "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf");
         ok( outVec == NULL,
-            "psVectorsReadFromFile:         return NULL for invalid filename input.");
+            "psVectorsReadFromFile:            return NULL for invalid filename input.");
     }
     // Attempt to read from invalid format input
     {
-        outVec = psVectorsReadFromFile(filename, "\%s");
-        ok( outVec == NULL,
-            "psVectorsReadFromFile:         return NULL for invalid format input.");
-    }
-
-    // Attempt to read from table containing missing entry
+        outVec = psVectorsReadFromFile("table.dat", "\%s");
+        ok( outVec == NULL,
+            "psVectorsReadFromFile:            return NULL for invalid format input.");
+    }
+    // Attempt to read from table containing invalid entry - F32
     {
         outVec = psVectorsReadFromFile("tableF32_err.dat",
                                        "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf");
         ok( outVec == NULL,
-            "psVectorsReadFromFile:         return NULL for table containing invalid entry.");
-    }
-    // Attempt to read from table containing missing entry
+            "psVectorsReadFromFile:            return NULL for table containing invalid entry.");
+    }
+    // Attempt to read from table containing invalid entry - F64
+    {
+        outVec = psVectorsReadFromFile("tableF64_err.dat",
+                                       "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf");
+        ok( outVec == NULL,
+            "psVectorsReadFromFile:           return NULL for table containing invalid entry.");
+    }
+    // Attempt to read from table containing invalid entry - S32
+    {
+        outVec = psVectorsReadFromFile("tableS32_err.dat",
+                                       "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf");
+        ok( outVec == NULL,
+            "psVectorsReadFromFile:           return NULL for table containing invalid entry.");
+    }
+    // Attempt to read from table containing invalid entry - S64
+    {
+        outVec = psVectorsReadFromFile("tableS64_err.dat",
+                                       "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf");
+        ok( outVec == NULL,
+            "psVectorsReadFromFile:           return NULL for table containing invalid entry.");
+    }
+    // Attempt to read from empty table
     {
         outVec = psVectorsReadFromFile("tableF32_2.dat",
                                        "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf");
         ok( outVec == NULL,
-            "psVectorsReadFromFile:         return NULL for table containing invalid entry.");
-    }
-
+            "psVectorsReadFromFile:           return NULL for empty table.");
+    }
     //Attempt to read with valid inputs
     {
-        outVec = psVectorsReadFromFile("tableF32.dat",
-                                       "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf");
-        ok( outVec != NULL,
-            "psVectorsReadFromFile:        return non-NULL array for valid format input.");
-    }
-
-    //Tests for psListToArray
-    //    psLookupTable *lt = NULL;
-
-
+        outVec = psVectorsReadFromFile("table.dat",
+                                       "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf");
+        ok( outVec != NULL &&  outVec->n == 9 &&
+            ((psVector*)(outVec->data[6]))->data.S32[1] == -8,
+            "psVectorsReadFromFile:           return correct array for valid format input.");
+    }
+
+    //Tests for psLookupTableRead
     // Attempt to read table with NULL input table specified
     numRows = psLookupTableRead(table1);
     {
         ok( numRows == 0,
-            "psLookupTableRead:            return NULL for NULL filename input.");
-    }
-    /*
-    psS32 testLookupTableRead(void)
-    {
-
-    // Set up valid table to read
-        table1 = psLookupTableAlloc(tableF32_filename,tableF32_format,tableF32_indexCol);
-    // Read table
-        numRows = psLookupTableRead(table1);
-    // Verify return value equals number of lines read
-        if(numRows != tableF32_size) {
-            psError(PS_ERR_UNKNOWN,true,"Return value %d not as expected %d",
-                    numRows,tableF32_size);
-            return 1;
-        }
-    // Verify the members and values in table
-        if(fabs(table1->validFrom - tableF32_validFrom) > errorTol_psF64) {
-            psError(PS_ERR_UNKNOWN,true,"Member validFrom = %f not as expected %f",
-                    table1->validFrom,tableF32_validFrom);
-            return 2;
-        }
-        if(fabs(table1->validTo - tableF32_validTo) > errorTol_psF64) {
-            psError(PS_ERR_UNKNOWN,true,"Member validTo = %f not as expected %f",
-                    table1->validTo,tableF32_validTo);
-            return 3;
-        }
-        if(strcmp(table1->filename,tableF32_filename) != 0) {
-            psError(PS_ERR_UNKNOWN,true,"Member filename %s not as expected %s",
-                    table1->filename,tableF32_filename);
-            return 4;
-        }
-        if(strcmp(table1->format,tableF32_format) != 0) {
-            psError(PS_ERR_UNKNOWN,true,"Member format %s not as expected %s",
-                    table1->format,tableF32_format);
-            return 5;
-        }
-        if(table1->indexCol != tableF32_indexCol) {
-            psError(PS_ERR_UNKNOWN,true,"Member indexCol %d not as expected %d",
-                    table1->indexCol,tableF32_indexCol);
-            return 6;
-        }
-        for(psS32 i = 0; i < table1->index->n; i++) {
-            if(fabs(table1->index->data.F32[i]-tableF32_index[i]) > errorTol_psF64) {
-                psError(PS_ERR_UNKNOWN,true,"Index column[%d] = %f not as expected %f",
-                        i,table1->index->data.F32[i],tableF32_index[i]);
-                return i*7;
-            }
-        }
-        psVector* tempVector = table1->values->data[1];
-        for(psS32 i = 0; i < tempVector->n; i++) {
-            if(tempVector->data.S32[i] != tableF32_col1[i]) {
-                psError(PS_ERR_UNKNOWN,true,"Value column[%d] = %d not as expected %d",
-                        i,tempVector->data.S32[i],tableF32_col1[i]);
-                return i*8;
-            }
-        }
-        tempVector = table1->values->data[2];
-        for(psS32 i = 0; i < tempVector->n; i++) {
-            if(tempVector->data.S32[i] != tableF32_col2[i]) {
-                psError(PS_ERR_UNKNOWN,true,"Value column[%d] = %d not as expected %d",
-                        i,tempVector->data.S32[i],tableF32_col2[i]);
-                return i*9;
-            }
-        }
-        tempVector = table1->values->data[3];
-        for(psS32 i = 0; i < tempVector->n; i++) {
-            if(tempVector->data.S64[i] != tableF32_col3[i]) {
-                psError(PS_ERR_UNKNOWN,true,"Value column[%d] = %ld not as expected %ld",
-                        i,tempVector->data.S64[i],tableF32_col3[i]);
-                return i*10;
-            }
-        }
-        tempVector = table1->values->data[4];
-        for(psS32 i = 0; i < tempVector->n; i++) {
-            if(tempVector->data.S32[i] != tableF32_col4[i]) {
-                psError(PS_ERR_UNKNOWN,true,"Value column[%d] = %d not as expected %d",
-                        i,tempVector->data.S32[i],tableF32_col4[i]);
-                return i*11;
-            }
-        }
-        tempVector = table1->values->data[5];
-        for(psS32 i = 0; i < tempVector->n; i++) {
-            if(tempVector->data.S32[i] != tableF32_col5[i]) {
-                psError(PS_ERR_UNKNOWN,true,"Value column[%d] = %d not as expected %d",
-                        i,tempVector->data.S32[i],tableF32_col5[i]);
-                return i*12;
-            }
-        }
-        tempVector = table1->values->data[6];
-        for(psS32 i = 0; i < tempVector->n; i++) {
-            if(tempVector->data.S32[i] != tableF32_col6[i]) {
-                psError(PS_ERR_UNKNOWN,true,"Value column[%d] = %d not as expected %d",
-                        i,tempVector->data.S32[i],tableF32_col6[i]);
-                return i*13;
-            }
-        }
-        tempVector = table1->values->data[7];
-        for(psS32 i = 0; i < tempVector->n; i++) {
-            if(tempVector->data.S64[i] != tableF32_col7[i]) {
-                psError(PS_ERR_UNKNOWN,true,"Value column[%d] = %ld not as expected %ld",
-                        i,tempVector->data.S64[i],tableF32_col7[i]);
-                return i*14;
-            }
-        }
-        psFree(table1);
-
-    // Set up invalid table to read
-        table1 = psLookupTableAlloc(tableF32_filename,tableF32_format,tableF32_indexCol);
-        table1->indexCol = -1;
-    // Read invalid table
-        psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message invalid table indexCol");
-        numRows = psLookupTableRead(table1);
-    // Verify the num of rows read is zero
-        if(numRows != 0) {
-            psError(PS_ERR_UNKNOWN,true,"Did not return 0 for line read for invalid table");
-            return 15;
-        }
-        psFree(table1);
-
-        return 0;
-    }
-    */
-
+            "psLookupTableRead:               return NULL for NULL filename input.");
+    }
+    // Attempt to read table with bad filename specified
+    table1 = psLookupTableAlloc("psTable.dat", "\%f \%lf \%d \%ld", 10);
+    numRows = psLookupTableRead(table1);
+    {
+        ok( numRows == 0,
+            "psLookupTableRead:               return NULL for table with invalid filename.");
+    }
+
+    // Attempt to read valid table with wrong indexCol
+    psFree(table1);
+    table1 = psLookupTableAlloc("table.dat",
+                                "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf", 10);
+    numRows = psLookupTableRead(table1);
+    {
+        ok( numRows == 0,
+            "psLookupTableRead:               return correct number of rows for valid inputs.");
+    }
+    // Attempt to read valid table
+    psFree(table1);
+    table1 = psLookupTableAlloc("table.dat",
+                                "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf", 0);
+    numRows = psLookupTableRead(table1);
+    {
+        ok( numRows == 4,
+            "psLookupTableRead:               return correct number of rows for valid inputs.");
+    }
+
+    //Tests for psLookupTableImport (remaining cases)
+    // Attempt to import table with negative indexCol
+    vectors = psVectorsReadFromFile(table1->filename, table1->format);
+    tableOut = psLookupTableImport(table1, vectors, -1 );
+    {
+        ok( tableOut == NULL,
+            "psLookupTableImport:             return NULL for negative indexCol input.");
+    }
+    //Attempt to import table with unsorted array column
+    psFree(table1);
+    table1 = psLookupTableAlloc("table.dat",
+                                "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf", 0);
+    tableOut = psLookupTableImport(table1, vectors, 7 );
+    {
+        ok( tableOut != NULL,
+            "psLookupTableImport:             return correct table for array with unsorted column");
+    }
 
     //Check for Memory leaks
     {
+        psFree(vectors);
         psFree(outVec);
         psFree(table1);
@@ -283,34 +223,72 @@
 {
     diag("  >>>Test 3:  psLookupTableInterpolate & psLookupTableInterpolateAll Fxns");
-
-
-
-    //Tests for psListToArray
+    psLookupTable *table1 = NULL;
+    psVector *vec = NULL;
+    table1 = psLookupTableAlloc("table.dat",
+                                "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf", 0);
+    psLookupTable *table2 = NULL;
+    table2 = psLookupTableAlloc("table.dat",
+                                "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf", 0);
+    psLookupTableRead(table2);
+
+    //Tests for psLookupTableInterpolateAll
+    //Return NULL for NULL table input
+    {
+        vec = psLookupTableInterpolateAll(NULL, 0);
+        ok( vec == NULL,
+            "psLookupTableInterpolateAll:     return NULL for NULL table input.");
+    }
+    //Return NULL for NULL table values
+    {
+        vec = psLookupTableInterpolateAll(table1, 0);
+        ok( vec == NULL,
+            "psLookupTableInterpolateAll:     return NULL for NULL table values.");
+    }
+    //Return NULL for table with table->values->n == 0
+    {
+        long n = table2->values->n;
+        table2->values->n = 0;
+        vec = psLookupTableInterpolateAll(table2, 0);
+        ok( vec == NULL,
+            "psLookupTableInterpolateAll:     return NULL for table with no columns.");
+        table2->values->n = n;
+    }
+    //Return NULL for invalid index input
+    {
+        vec = psLookupTableInterpolateAll(table2, -10.5);
+        ok( vec == NULL,
+            "psLookupTableInterpolateAll:     return NULL for invalid index input.");
+    }
+    //Return correct vector output for valid inputs
+    {
+        vec = psLookupTableInterpolateAll(table2, 1);
+        skip_start(  vec == NULL, 1,
+                     "Skipping 1 tests because psLookupTableInterpolateAll failed");
+        ok_double(vec->data.F64[0], 1.0,
+                  "psLookupTableInterpolateAll:     return correct output vector for valid inputs.");
+        skip_end();
+    }
+
+    //Remaining tests for psLookupTableInterpolate
+    //Return NAN for invalid index - divide by zero error
+    psLookupTable *table3 = NULL;
+    table3 = psLookupTableAlloc("table2.dat",
+                                "\%f \%d \%d \%ld \%d \%d \%d \%ld \%*d \%lf", 0);
+    psLookupTableRead(table3);
+    {
+        double retVal;
+        retVal = psLookupTableInterpolate(table3, 1.5e-20, 0);
+        ok( isnan(retVal),
+            "psLookupTableInterpolateAll:     return NAN for invalid index input.");
+    }
 
     //Check for Memory leaks
     {
-
+        psFree(table3);
+        psFree(vec);
+        psFree(table2);
+        psFree(table1);
         checkMem();
     }
 
 }
-
-
-
-/*
-    //Return NULL for NULL list input
-{
-    array = psListToArray(NULL);
-    ok( array == NULL,
-        "psListToArray:          return NULL for NULL list input.");
-    skip_start(  !psArraySet(a, 0, s32) || !psArraySet(a, 1, s32), 1,
-                  "Skipping 1 tests because psArraySet failed");
-    a = psArrayRealloc(a, 1);
-    *s32_2 = *((psS32*)(a->data[0]));
-    ok( a->n == 1 && a->nalloc == 1 && *s32_2 == 1,
-        "psArrayRealloc:         return properly reallocated psArray.");
-    skip_end();
-}
-*/
-
-
