Index: /trunk/psLib/test/astronomy/Makefile
===================================================================
--- /trunk/psLib/test/astronomy/Makefile	(revision 1971)
+++ /trunk/psLib/test/astronomy/Makefile	(revision 1972)
@@ -3,6 +3,6 @@
 ##  Makefile:   test/astronomy
 ##
-##  $Revision: 1.11 $  $Name: not supported by cvs2svn $
-##  $Date: 2004-08-12 02:34:58 $
+##  $Revision: 1.12 $  $Name: not supported by cvs2svn $
+##  $Date: 2004-10-06 01:08:17 $
 ##
 ##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -21,4 +21,5 @@
 TARGET = tst_psTime_01 \
          tst_psTime_02 \
+         tst_psMetadataIO  \
          tst_psMetadata_01 \
          tst_psMetadata_02 \
Index: /trunk/psLib/test/astronomy/test.config
===================================================================
--- /trunk/psLib/test/astronomy/test.config	(revision 1972)
+++ /trunk/psLib/test/astronomy/test.config	(revision 1972)
@@ -0,0 +1,123 @@
+##########################################################################################################
+#  test.config
+#
+#  This is a sample metadata configuration file used to test the metadata configuration file parser. 
+#  It tests both positive and negative cases as described in the comments below.
+#
+#  author  Ross Harman, MHPCC
+#
+#  version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+#  date  $Date: 2004-10-06 01:08:17 $
+#
+#  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+##########################################################################################################
+#
+#
+#
+########## Test 1 ##########
+# Lines beginning with # are comments. The line below, as well as those above are comments. They should be ignored by the parser.
+# I am a comment.
+#
+#
+#
+########## Test 2 ##########
+# The line below is a comment that begins with some whitespace. It should be ignored by the parser.
+      #        		Another comment
+#
+#
+#
+########## Test 3 ##########
+# The line below is completely blank except for a carriage return. It should be ignored by the parser.
+
+#
+#
+#
+########## Test 4 ##########
+# The line below consists of spaces and tabs (whitespace). It should be ignored by the parser.
+     	   			                    
+#
+#
+#
+########## Test 5 ##########
+# The line below consists of a variable name, type, value, and trailing comment. It should be read by the parser
+pi          F64         3.1415926535897932384626433832795029        # Definition of pi
+#
+#
+#
+########## Test 6 ##########
+# The line below consists of a variable name, type, and value, but without a trailing comment. It should be read by the parser.
+altitude          S32         10000
+#
+#
+#
+########## Test 7 ##########
+# The lines below contain variations in name, type, value, trailing comment, and whitespace. They should all be read by the parser.
+   time F32 1234.5678
+ myBool     BOOL            F           # F, f, 0, T, t, 1 are also acceptable
+title1  STR   Hello world #This is a comment for the string value
+    title2  STRING   Good bye world   #    STRING or STR may be used as the string type
+#
+#
+#
+########## Test 8 ##########
+# The line below creates a vector. It should be read by the parser.
+@primes     S32     2, 3, 5, 7, 11, 13, 17   # These are prime numbers
+#
+#
+#
+########## Test 9 ##########
+# The line below creates a vector with commas mixed with spaces in the values. It should be read by the parser.
+@negatives  S32     -1,  -2 -3    -4, -5, -6,      -7
+#
+#
+#
+########## Test 10  ##########
+# The lines below should create a folder node with children that are strings. They should be read by the parser.
+comment *
+comment STR This
+comment STR     is
+comment STR         an
+comment STR             ugly
+comment STR                 comment
+comment STR                         but
+comment STR                             still
+comment STR                                 valid
+#
+#
+#
+########## Test 11  ##########
+# The line below contains an incorrect value. It should produce an error.
+xPosition    F64          9876.54qqq32
+#
+#
+#
+########## Test 12  ##########
+# The line below contains no value. It should produce an error.
+yPosition    F64          
+#
+#
+#
+########## Test 13  ##########
+# The line below contains no type. It should produce an error.
+zPosition       99.999          
+#
+#
+#
+########## Test 14  ##########
+# The line below contains two * characters. It should produce an error.
+aPosition   **          
+#
+#
+#
+########## Test 15 ##########
+# The line below contains two @ characters. It should produce an error.
+@@bPosition     F64     22.33             
+#
+#
+#
+########## Test 16 ##########
+# The variable name below is repeated. It should produce an error if the overwrite function argument is set to false.
+# If overwrite is true, then the last name and value will be stored and there will be no error.
+speed     F32     55.55
+speed     F32     66.66
+             
Index: /trunk/psLib/test/astronomy/tst_psMetadataIO.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psMetadataIO.c	(revision 1972)
+++ /trunk/psLib/test/astronomy/tst_psMetadataIO.c	(revision 1972)
@@ -0,0 +1,186 @@
+/** @file  tst_psMetadataIO.c
+*
+*  @brief Test driver for psMetadataIO functions
+*
+*  This test driver contains the following tests for psMetadata:
+*    Test A - Read config file with overwrite set true
+*    Test B - Read config file with overwrite set false
+*    Test C - Read config file without auto-allocation of metadata
+*    Test D - Attempt to use null fileName argument
+*    Test E - Attempt to open nonexistant file
+*    Test F - Free psMetadata
+*
+*  @author  Ross Harman, MHPCC
+*
+*  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2004-10-06 01:08:17 $
+*
+*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+*
+*/
+
+#include "pslib.h"
+#include "psTest.h"
+#include <string.h>
+
+static void printMetadataItem(psMetadataItem *metadataItem, char *spaces);
+
+static void printMetadataItemList(psList *metadataItemList)
+{
+    psMetadataItem *entryChild = NULL;
+
+    psListSetIterator(metadataItemList, PS_LIST_HEAD);
+    entryChild = psListGetCurrent(metadataItemList);
+    while (entryChild != NULL) {
+        printMetadataItem(entryChild, "    ");
+        entryChild = psListGetNext(metadataItemList);
+    }
+}
+
+static void printMetadataList(psList *metadataItemList)
+{
+    psMetadataItem *entryChild = NULL;
+
+    psListSetIterator(metadataItemList, PS_LIST_HEAD);
+    entryChild = psListGetCurrent(metadataItemList);
+    while (entryChild != NULL) {
+        printMetadataItem(entryChild, " ");
+        entryChild = psListGetNext(metadataItemList);
+    }
+}
+static void printMetadataItem(psMetadataItem *metadataItem, char *spaces)
+{
+
+    psVector *vec = NULL;
+
+
+    printf("%sKey Name: %8s  ", spaces, metadataItem->name);
+    printf("Key Type: %2d  ", metadataItem->type);
+
+    switch (metadataItem->type ) {
+    case PS_META_ITEM_SET:
+        printf("Key Value: %17c", ' ');
+        break;
+    case PS_META_BOOL:
+        printf("Key Value: %15d  ", metadataItem->data.B);
+        break;
+    case PS_META_S32:
+        printf("Key Value: %15d  ", metadataItem->data.S32);
+        break;
+    case PS_META_F32:
+        printf("Key Value: %15.3f  ", metadataItem->data.F32);
+        break;
+    case PS_META_F64:
+        printf("Key Value: %15.3f  ", metadataItem->data.F64);
+        break;
+    case PS_META_STR:
+        printf("Key Value: %15s  ", (char*)metadataItem->data.V);
+        break;
+    case PS_META_VEC:
+        vec = (psVector*)metadataItem->data.V;
+        printf("Key Value: ");
+        for(int i=0; i<vec->nalloc;i++) {
+            printf("%d ", vec->data.S32[i]);
+        }
+        break;
+    case PS_META_IMG:
+    case PS_META_JPEG:
+    case PS_META_PNG:
+    case PS_META_ASTROM:
+    case PS_META_UNKNOWN:
+        printf("Value: unknown ");
+        break;
+    default:
+        printf("Bad type: %d ", metadataItem->type);
+    }
+    printf("Key Comment: %s\n", metadataItem->comment);
+
+    if(metadataItem->items->size) {
+        printMetadataItemList(metadataItem->items);
+    }
+}
+
+static void printMetadataTable(psHash *mdTable)
+{
+    int i;
+    psHashBucket* ptr = NULL;
+    for(i=0; i<mdTable->nbucket; i++) {
+        ptr = mdTable->buckets[i];
+        while (ptr != NULL) {
+            printMetadataItem(ptr->data, " ");
+            ptr = ptr->next;
+        }
+    }
+}
+
+static void printMetadata(psMetadata *metadata)
+{
+    printf("\nContents of metadata list:\n");
+    printMetadataList(metadata->list);
+    printf("\nContents of metadata table:\n");
+    printMetadataTable(metadata->table);
+}
+
+
+int main(int argc, char* argv[])
+{
+    // Test A - Read config file with overwrite set true
+    printPositiveTestHeader(stdout, "psMetadata", "Test A - Read config file with overwrite set true");
+    psMetadata *metadata1 = NULL;
+    int failedLines1 = 0;
+    failedLines1 = psMetadataParseConfig(&metadata1, "test.config", true);
+    printf("Failed lines: %d Expected: 5\n", failedLines1);
+    printMetadata(metadata1);
+    printFooter(stdout, "psMetadata", "Test A - Read config file with overwrite set true", true);
+
+
+    // Test B - Read config file with overwrite set false
+    printPositiveTestHeader(stdout, "psMetadata", "Test B - Read config file with overwrite set false");
+    psMetadata *metadata2 = NULL;
+    int failedLines2 = 0;
+    failedLines2 = psMetadataParseConfig(&metadata2, "test.config", false);
+    printf("Failed lines: %d Expected: 6\n", failedLines2);
+    printMetadata(metadata2);
+    printFooter(stdout, "psMetadata", "Test B - Read config file with overwrite set false", true);
+
+
+    // Test C - Read config file without auto-allocation of metadata
+    printPositiveTestHeader(stdout, "psMetadata", "Test C - Read config file without auto-allocation of metadata");
+    psMetadata *metadata3 = psMetadataAlloc();
+    int failedLines3 = 0;
+    failedLines3 = psMetadataParseConfig(&metadata3, "test.config", false);
+    printf("Failed lines: %d\n Expected: 6", failedLines3);
+    printMetadata(metadata3);
+    printFooter(stdout, "psMetadata", "Test C - Read config file without auto-allocation of metadata", true);
+
+
+    // Test D - Attempt to use null fileName argument
+    printNegativeTestHeader(stdout,"psMetadataIO", "Test D - Attempt to use null fileName argument",
+                            "Null failedLines not allowed", 0);
+    psMetadataParseConfig(&metadata1, NULL, true);
+    printFooter(stdout, "psMetadata", "Test D - Attempt to use null fileName argument", true);
+
+
+    // Test E - Attempt to open nonexistant file
+    printNegativeTestHeader(stdout,"psMetadataIO", "Test E - Attempt to open nonexistant file",
+                            "Error opening file", 0);
+    psMetadataParseConfig(&metadata1, "abcedfg", true);
+    printFooter(stdout, "psMetadata", "Test E - Attempt to open nonexistant file", true);
+
+
+    // Test F - Free psMetadata
+    printPositiveTestHeader(stdout, "psMetadata", "Test F - Free psMetadata");
+    psFree(metadata1);
+    psFree(metadata2);
+    psFree(metadata3);
+    psMemCheckLeaks(0, NULL, stdout);
+    psMemCheckCorruption(0);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psMetadata", "Test F - Free psMetadata", true);
+
+
+    return 0;
+}
Index: /trunk/psLib/test/astronomy/tst_psMetadata_01.c
===================================================================
--- /trunk/psLib/test/astronomy/tst_psMetadata_01.c	(revision 1971)
+++ /trunk/psLib/test/astronomy/tst_psMetadata_01.c	(revision 1972)
@@ -17,6 +17,6 @@
 *  @author  Ross Harman, MHPCC
 *
-*  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2004-08-25 20:22:15 $
+*  @version $Revision: 1.9 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2004-10-06 01:08:17 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -139,5 +139,5 @@
 
 
-    // Test B - Test B - Read 2nd hdr from complex FITS file
+    // Test B - Read 2nd hdr from complex FITS file
 
     /* Header contents for header_2.fits:
Index: /trunk/psLib/test/astronomy/verified/tst_psMetadataIO.stderr
===================================================================
--- /trunk/psLib/test/astronomy/verified/tst_psMetadataIO.stderr	(revision 1972)
+++ /trunk/psLib/test/astronomy/verified/tst_psMetadataIO.stderr	(revision 1972)
@@ -0,0 +1,38 @@
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Failed to parse value. Value: 9876.54qqq32 Line 90: xPosition    F64          9876.54qqq32
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Null value not allowed. Line 96: yPosition    F64          
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Invalid psMetadataType. Type: 99.999 Line 102: zPosition       99.999          
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    More than one @ charecter not allowed. Line 108: aPosition   **          
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    More than one @ charecter not allowed. Line 114: @@bPosition     F64     22.33             
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Failed to parse value. Value: 9876.54qqq32 Line 90: xPosition    F64          9876.54qqq32
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Null value not allowed. Line 96: yPosition    F64          
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Invalid psMetadataType. Type: 99.999 Line 102: zPosition       99.999          
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    More than one @ charecter not allowed. Line 108: aPosition   **          
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    More than one @ charecter not allowed. Line 114: @@bPosition     F64     22.33             
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Overwrite for name not allowed. Name: speed. Line 122: speed     F32     66.66
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Failed to parse value. Value: 9876.54qqq32 Line 90: xPosition    F64          9876.54qqq32
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Null value not allowed. Line 96: yPosition    F64          
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Invalid psMetadataType. Type: 99.999 Line 102: zPosition       99.999          
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    More than one @ charecter not allowed. Line 108: aPosition   **          
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    More than one @ charecter not allowed. Line 114: @@bPosition     F64     22.33             
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Overwrite for name not allowed. Name: speed. Line 122: speed     F32     66.66
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Null fileName not allowed
+<DATE><TIME>|<HOST>|E|psMetadataParseConfig
+    Couldn't open file. Name: abcedfg
Index: /trunk/psLib/test/astronomy/verified/tst_psMetadataIO.stdout
===================================================================
--- /trunk/psLib/test/astronomy/verified/tst_psMetadataIO.stdout	(revision 1972)
+++ /trunk/psLib/test/astronomy/verified/tst_psMetadataIO.stdout	(revision 1972)
@@ -0,0 +1,205 @@
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psMetadataIO.c                                         *
+*            TestPoint: psMetadata{Test A - Read config file with overwrite set true} *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+Failed lines: 5 Expected: 5
+
+Contents of metadata list:
+ Key Name:       pi  Key Type:  4  Key Value:           3.142  Key Comment: Definition of pi
+ Key Name: altitude  Key Type:  2  Key Value:               0  Key Comment: 
+ Key Name:     time  Key Type:  3  Key Value:        1234.568  Key Comment: 
+ Key Name:   myBool  Key Type:  1  Key Value:               0  Key Comment: F, f, 0, T, t, 1 are also acceptable
+ Key Name:   title1  Key Type:  5  Key Value:     Hello world  Key Comment: This is a comment for the string value
+ Key Name:   title2  Key Type:  5  Key Value:  Good bye world  Key Comment: STRING or STR may be used as the string type
+ Key Name:   primes  Key Type:  6  Key Value: 2 3 5 7 11 13 17 Key Comment: These are prime numbers
+ Key Name: negatives  Key Type:  6  Key Value: -1 -2 -3 -4 -5 -6 -7 Key Comment: 
+ Key Name:  comment  Key Type:  0  Key Value:                  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            This  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              is  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              an  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            ugly  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:         comment  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:             but  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           still  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           valid  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:            This  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:              is  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:              an  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:            ugly  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:         comment  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:             but  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:           still  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:           valid  Key Comment: 
+ Key Name:    speed  Key Type:  3  Key Value:          66.660  Key Comment: 
+
+Contents of metadata table:
+ Key Name:  comment  Key Type:  0  Key Value:                  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            This  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              is  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              an  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            ugly  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:         comment  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:             but  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           still  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           valid  Key Comment: 
+ Key Name:   title2  Key Type:  5  Key Value:  Good bye world  Key Comment: STRING or STR may be used as the string type
+ Key Name:     time  Key Type:  3  Key Value:        1234.568  Key Comment: 
+ Key Name: negatives  Key Type:  6  Key Value: -1 -2 -3 -4 -5 -6 -7 Key Comment: 
+ Key Name:       pi  Key Type:  4  Key Value:           3.142  Key Comment: Definition of pi
+ Key Name:   myBool  Key Type:  1  Key Value:               0  Key Comment: F, f, 0, T, t, 1 are also acceptable
+ Key Name:   primes  Key Type:  6  Key Value: 2 3 5 7 11 13 17 Key Comment: These are prime numbers
+ Key Name: altitude  Key Type:  2  Key Value:               0  Key Comment: 
+ Key Name:    speed  Key Type:  3  Key Value:          66.660  Key Comment: 
+ Key Name:   title1  Key Type:  5  Key Value:     Hello world  Key Comment: This is a comment for the string value
+
+---> TESTPOINT PASSED (psMetadata{Test A - Read config file with overwrite set true} | tst_psMetadataIO.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psMetadataIO.c                                         *
+*            TestPoint: psMetadata{Test B - Read config file with overwrite set false} *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+Failed lines: 6 Expected: 6
+
+Contents of metadata list:
+ Key Name:       pi  Key Type:  4  Key Value:           3.142  Key Comment: Definition of pi
+ Key Name: altitude  Key Type:  2  Key Value:               0  Key Comment: 
+ Key Name:     time  Key Type:  3  Key Value:        1234.568  Key Comment: 
+ Key Name:   myBool  Key Type:  1  Key Value:               0  Key Comment: F, f, 0, T, t, 1 are also acceptable
+ Key Name:   title1  Key Type:  5  Key Value:     Hello world  Key Comment: This is a comment for the string value
+ Key Name:   title2  Key Type:  5  Key Value:  Good bye world  Key Comment: STRING or STR may be used as the string type
+ Key Name:   primes  Key Type:  6  Key Value: 2 3 5 7 11 13 17 Key Comment: These are prime numbers
+ Key Name: negatives  Key Type:  6  Key Value: -1 -2 -3 -4 -5 -6 -7 Key Comment: 
+ Key Name:  comment  Key Type:  0  Key Value:                  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            This  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              is  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              an  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            ugly  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:         comment  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:             but  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           still  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           valid  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:            This  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:              is  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:              an  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:            ugly  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:         comment  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:             but  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:           still  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:           valid  Key Comment: 
+ Key Name:    speed  Key Type:  3  Key Value:          55.550  Key Comment: 
+
+Contents of metadata table:
+ Key Name:  comment  Key Type:  0  Key Value:                  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            This  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              is  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              an  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            ugly  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:         comment  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:             but  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           still  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           valid  Key Comment: 
+ Key Name:   title2  Key Type:  5  Key Value:  Good bye world  Key Comment: STRING or STR may be used as the string type
+ Key Name:     time  Key Type:  3  Key Value:        1234.568  Key Comment: 
+ Key Name: negatives  Key Type:  6  Key Value: -1 -2 -3 -4 -5 -6 -7 Key Comment: 
+ Key Name:       pi  Key Type:  4  Key Value:           3.142  Key Comment: Definition of pi
+ Key Name:   myBool  Key Type:  1  Key Value:               0  Key Comment: F, f, 0, T, t, 1 are also acceptable
+ Key Name:   primes  Key Type:  6  Key Value: 2 3 5 7 11 13 17 Key Comment: These are prime numbers
+ Key Name: altitude  Key Type:  2  Key Value:               0  Key Comment: 
+ Key Name:    speed  Key Type:  3  Key Value:          55.550  Key Comment: 
+ Key Name:   title1  Key Type:  5  Key Value:     Hello world  Key Comment: This is a comment for the string value
+
+---> TESTPOINT PASSED (psMetadata{Test B - Read config file with overwrite set false} | tst_psMetadataIO.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psMetadataIO.c                                         *
+*            TestPoint: psMetadata{Test C - Read config file without auto-allocation of metadata} *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+Failed lines: 6
+ Expected: 6
+Contents of metadata list:
+ Key Name:       pi  Key Type:  4  Key Value:           3.142  Key Comment: Definition of pi
+ Key Name: altitude  Key Type:  2  Key Value:               0  Key Comment: 
+ Key Name:     time  Key Type:  3  Key Value:        1234.568  Key Comment: 
+ Key Name:   myBool  Key Type:  1  Key Value:               0  Key Comment: F, f, 0, T, t, 1 are also acceptable
+ Key Name:   title1  Key Type:  5  Key Value:     Hello world  Key Comment: This is a comment for the string value
+ Key Name:   title2  Key Type:  5  Key Value:  Good bye world  Key Comment: STRING or STR may be used as the string type
+ Key Name:   primes  Key Type:  6  Key Value: 2 3 5 7 11 13 17 Key Comment: These are prime numbers
+ Key Name: negatives  Key Type:  6  Key Value: -1 -2 -3 -4 -5 -6 -7 Key Comment: 
+ Key Name:  comment  Key Type:  0  Key Value:                  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            This  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              is  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              an  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            ugly  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:         comment  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:             but  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           still  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           valid  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:            This  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:              is  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:              an  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:            ugly  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:         comment  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:             but  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:           still  Key Comment: 
+ Key Name:  comment  Key Type:  5  Key Value:           valid  Key Comment: 
+ Key Name:    speed  Key Type:  3  Key Value:          55.550  Key Comment: 
+
+Contents of metadata table:
+ Key Name:  comment  Key Type:  0  Key Value:                  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            This  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              is  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:              an  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:            ugly  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:         comment  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:             but  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           still  Key Comment: 
+    Key Name:  comment  Key Type:  5  Key Value:           valid  Key Comment: 
+ Key Name:   title2  Key Type:  5  Key Value:  Good bye world  Key Comment: STRING or STR may be used as the string type
+ Key Name:     time  Key Type:  3  Key Value:        1234.568  Key Comment: 
+ Key Name: negatives  Key Type:  6  Key Value: -1 -2 -3 -4 -5 -6 -7 Key Comment: 
+ Key Name:       pi  Key Type:  4  Key Value:           3.142  Key Comment: Definition of pi
+ Key Name:   myBool  Key Type:  1  Key Value:               0  Key Comment: F, f, 0, T, t, 1 are also acceptable
+ Key Name:   primes  Key Type:  6  Key Value: 2 3 5 7 11 13 17 Key Comment: These are prime numbers
+ Key Name: altitude  Key Type:  2  Key Value:               0  Key Comment: 
+ Key Name:    speed  Key Type:  3  Key Value:          55.550  Key Comment: 
+ Key Name:   title1  Key Type:  5  Key Value:     Hello world  Key Comment: This is a comment for the string value
+
+---> TESTPOINT PASSED (psMetadata{Test C - Read config file without auto-allocation of metadata} | tst_psMetadataIO.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psMetadataIO.c                                         *
+*            TestPoint: psMetadataIO{Test D - Attempt to use null fileName argument} *
+*             TestType: Negative                                                   *
+*    ExpectedErrorText: Null failedLines not allowed                               *
+*  ExpectedStatusValue: 0                                                          *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psMetadata{Test D - Attempt to use null fileName argument} | tst_psMetadataIO.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psMetadataIO.c                                         *
+*            TestPoint: psMetadataIO{Test E - Attempt to open nonexistant file}    *
+*             TestType: Negative                                                   *
+*    ExpectedErrorText: Error opening file                                         *
+*  ExpectedStatusValue: 0                                                          *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psMetadata{Test E - Attempt to open nonexistant file} | tst_psMetadataIO.c)
+
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psMetadataIO.c                                         *
+*            TestPoint: psMetadata{Test F - Free psMetadata}                       *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+
+---> TESTPOINT PASSED (psMetadata{Test F - Free psMetadata} | tst_psMetadataIO.c)
+
Index: /trunk/psLib/test/collections/tst_psMetadataIO.c
===================================================================
--- /trunk/psLib/test/collections/tst_psMetadataIO.c	(revision 1972)
+++ /trunk/psLib/test/collections/tst_psMetadataIO.c	(revision 1972)
@@ -0,0 +1,186 @@
+/** @file  tst_psMetadataIO.c
+*
+*  @brief Test driver for psMetadataIO functions
+*
+*  This test driver contains the following tests for psMetadata:
+*    Test A - Read config file with overwrite set true
+*    Test B - Read config file with overwrite set false
+*    Test C - Read config file without auto-allocation of metadata
+*    Test D - Attempt to use null fileName argument
+*    Test E - Attempt to open nonexistant file
+*    Test F - Free psMetadata
+*
+*  @author  Ross Harman, MHPCC
+*
+*  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2004-10-06 01:08:17 $
+*
+*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
+*
+*/
+
+#include "pslib.h"
+#include "psTest.h"
+#include <string.h>
+
+static void printMetadataItem(psMetadataItem *metadataItem, char *spaces);
+
+static void printMetadataItemList(psList *metadataItemList)
+{
+    psMetadataItem *entryChild = NULL;
+
+    psListSetIterator(metadataItemList, PS_LIST_HEAD);
+    entryChild = psListGetCurrent(metadataItemList);
+    while (entryChild != NULL) {
+        printMetadataItem(entryChild, "    ");
+        entryChild = psListGetNext(metadataItemList);
+    }
+}
+
+static void printMetadataList(psList *metadataItemList)
+{
+    psMetadataItem *entryChild = NULL;
+
+    psListSetIterator(metadataItemList, PS_LIST_HEAD);
+    entryChild = psListGetCurrent(metadataItemList);
+    while (entryChild != NULL) {
+        printMetadataItem(entryChild, " ");
+        entryChild = psListGetNext(metadataItemList);
+    }
+}
+static void printMetadataItem(psMetadataItem *metadataItem, char *spaces)
+{
+
+    psVector *vec = NULL;
+
+
+    printf("%sKey Name: %8s  ", spaces, metadataItem->name);
+    printf("Key Type: %2d  ", metadataItem->type);
+
+    switch (metadataItem->type ) {
+    case PS_META_ITEM_SET:
+        printf("Key Value: %17c", ' ');
+        break;
+    case PS_META_BOOL:
+        printf("Key Value: %15d  ", metadataItem->data.B);
+        break;
+    case PS_META_S32:
+        printf("Key Value: %15d  ", metadataItem->data.S32);
+        break;
+    case PS_META_F32:
+        printf("Key Value: %15.3f  ", metadataItem->data.F32);
+        break;
+    case PS_META_F64:
+        printf("Key Value: %15.3f  ", metadataItem->data.F64);
+        break;
+    case PS_META_STR:
+        printf("Key Value: %15s  ", (char*)metadataItem->data.V);
+        break;
+    case PS_META_VEC:
+        vec = (psVector*)metadataItem->data.V;
+        printf("Key Value: ");
+        for(int i=0; i<vec->nalloc;i++) {
+            printf("%d ", vec->data.S32[i]);
+        }
+        break;
+    case PS_META_IMG:
+    case PS_META_JPEG:
+    case PS_META_PNG:
+    case PS_META_ASTROM:
+    case PS_META_UNKNOWN:
+        printf("Value: unknown ");
+        break;
+    default:
+        printf("Bad type: %d ", metadataItem->type);
+    }
+    printf("Key Comment: %s\n", metadataItem->comment);
+
+    if(metadataItem->items->size) {
+        printMetadataItemList(metadataItem->items);
+    }
+}
+
+static void printMetadataTable(psHash *mdTable)
+{
+    int i;
+    psHashBucket* ptr = NULL;
+    for(i=0; i<mdTable->nbucket; i++) {
+        ptr = mdTable->buckets[i];
+        while (ptr != NULL) {
+            printMetadataItem(ptr->data, " ");
+            ptr = ptr->next;
+        }
+    }
+}
+
+static void printMetadata(psMetadata *metadata)
+{
+    printf("\nContents of metadata list:\n");
+    printMetadataList(metadata->list);
+    printf("\nContents of metadata table:\n");
+    printMetadataTable(metadata->table);
+}
+
+
+int main(int argc, char* argv[])
+{
+    // Test A - Read config file with overwrite set true
+    printPositiveTestHeader(stdout, "psMetadata", "Test A - Read config file with overwrite set true");
+    psMetadata *metadata1 = NULL;
+    int failedLines1 = 0;
+    failedLines1 = psMetadataParseConfig(&metadata1, "test.config", true);
+    printf("Failed lines: %d Expected: 5\n", failedLines1);
+    printMetadata(metadata1);
+    printFooter(stdout, "psMetadata", "Test A - Read config file with overwrite set true", true);
+
+
+    // Test B - Read config file with overwrite set false
+    printPositiveTestHeader(stdout, "psMetadata", "Test B - Read config file with overwrite set false");
+    psMetadata *metadata2 = NULL;
+    int failedLines2 = 0;
+    failedLines2 = psMetadataParseConfig(&metadata2, "test.config", false);
+    printf("Failed lines: %d Expected: 6\n", failedLines2);
+    printMetadata(metadata2);
+    printFooter(stdout, "psMetadata", "Test B - Read config file with overwrite set false", true);
+
+
+    // Test C - Read config file without auto-allocation of metadata
+    printPositiveTestHeader(stdout, "psMetadata", "Test C - Read config file without auto-allocation of metadata");
+    psMetadata *metadata3 = psMetadataAlloc();
+    int failedLines3 = 0;
+    failedLines3 = psMetadataParseConfig(&metadata3, "test.config", false);
+    printf("Failed lines: %d\n Expected: 6", failedLines3);
+    printMetadata(metadata3);
+    printFooter(stdout, "psMetadata", "Test C - Read config file without auto-allocation of metadata", true);
+
+
+    // Test D - Attempt to use null fileName argument
+    printNegativeTestHeader(stdout,"psMetadataIO", "Test D - Attempt to use null fileName argument",
+                            "Null failedLines not allowed", 0);
+    psMetadataParseConfig(&metadata1, NULL, true);
+    printFooter(stdout, "psMetadata", "Test D - Attempt to use null fileName argument", true);
+
+
+    // Test E - Attempt to open nonexistant file
+    printNegativeTestHeader(stdout,"psMetadataIO", "Test E - Attempt to open nonexistant file",
+                            "Error opening file", 0);
+    psMetadataParseConfig(&metadata1, "abcedfg", true);
+    printFooter(stdout, "psMetadata", "Test E - Attempt to open nonexistant file", true);
+
+
+    // Test F - Free psMetadata
+    printPositiveTestHeader(stdout, "psMetadata", "Test F - Free psMetadata");
+    psFree(metadata1);
+    psFree(metadata2);
+    psFree(metadata3);
+    psMemCheckLeaks(0, NULL, stdout);
+    psMemCheckCorruption(0);
+    int nBad = psMemCheckCorruption(0);
+    if(nBad) {
+        printf("ERROR: Found %d bad memory blocks\n", nBad);
+    }
+    printFooter(stdout, "psMetadata", "Test F - Free psMetadata", true);
+
+
+    return 0;
+}
Index: /trunk/psLib/test/collections/tst_psMetadata_01.c
===================================================================
--- /trunk/psLib/test/collections/tst_psMetadata_01.c	(revision 1971)
+++ /trunk/psLib/test/collections/tst_psMetadata_01.c	(revision 1972)
@@ -17,6 +17,6 @@
 *  @author  Ross Harman, MHPCC
 *
-*  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
-*  @date  $Date: 2004-08-25 20:22:15 $
+*  @version $Revision: 1.9 $  $Name: not supported by cvs2svn $
+*  @date  $Date: 2004-10-06 01:08:17 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -139,5 +139,5 @@
 
 
-    // Test B - Test B - Read 2nd hdr from complex FITS file
+    // Test B - Read 2nd hdr from complex FITS file
 
     /* Header contents for header_2.fits:
