Index: trunk/psLib/test/dataIO/tst_psFits.c
===================================================================
--- trunk/psLib/test/dataIO/tst_psFits.c	(revision 4139)
+++ trunk/psLib/test/dataIO/tst_psFits.c	(revision 4142)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-06-07 23:15:13 $
+*  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-06-07 23:47:06 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -50,4 +50,5 @@
 static psS32 tst_psFitsReadTableColumn(void);
 static psS32 tst_psFitsUpdateTable(void);
+static psS32 tst_psFitsWriteHeader(void);
 
 testDescription tests[] = {
@@ -66,4 +67,5 @@
                               {testImageRead,567, "psFitsReadImage", 0, false},
                               {testImageWrite,569, "psFitsWriteImage", 0, false},
+                              {tst_psFitsWriteHeader,000,"psFitsWriteHeader",0,false},
                               {NULL}
                           };
@@ -1486,2 +1488,31 @@
 }
 
+psS32 tst_psFitsWriteHeader(void)
+{
+    if (! makeMulti() ) {
+        return 1;
+    }
+
+    psMetadata* header   = psMetadataAlloc();
+    psFits*     fitsFile = psFitsAlloc(multiFilename);
+
+    // Test psFitsReadWrite generates files from psFitsWriteImage which calls psFitsWriteHeader
+    // so these additional tests check for error conditions
+    // Attempt call function with NULL metadata
+    if(psFitsWriteHeader(NULL,fitsFile)) {
+        psError(PS_ERR_UNKNOWN,true,"Did not expect return of true for NULL metadata pointer");
+        return 2;
+    }
+
+    psFree(fitsFile);
+
+    // Attempt to call function with NULL fits
+    if(psFitsWriteHeader(header,NULL)) {
+        psError(PS_ERR_UNKNOWN,true,"Did not expect return of true for NULL fits file pointer");
+        return 3;
+    }
+    psFree(header);
+
+    return 0;
+}
+
