Index: /branches/eam_branches/ohana.20150429/src/libfits/matrix/F_compress_M.c
===================================================================
--- /branches/eam_branches/ohana.20150429/src/libfits/matrix/F_compress_M.c	(revision 38398)
+++ /branches/eam_branches/ohana.20150429/src/libfits/matrix/F_compress_M.c	(revision 38399)
@@ -204,8 +204,8 @@
       int k;
       fprintf (stderr, "cmp mat: "); 
-      for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", matrix->buffer[k]); } 
+      for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", matrix->buffer[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
       fprintf (stderr, "cmp raw: "); 
-      for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", raw[k]); } 
+      for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", raw[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
     }
@@ -221,5 +221,5 @@
       int k;
       fprintf (stderr, "cmp swp: "); 
-      for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", raw[k]); } 
+      for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", raw[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
       fprintf (stderr, "Nzdata: %d -> ", Nzdata);
@@ -233,5 +233,5 @@
       fprintf (stderr, "%d\n", Nzdata);
       fprintf (stderr, "cmp SWP: "); 
-      for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", zdata[k]); } 
+      for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
     }
@@ -240,6 +240,5 @@
     // compression modes require swapping after compression (compresssion & decompression
     // operate on native ENDIAN)
-    if (strcasecmp(zcmptype, "NONE") && 
-	strcasecmp(zcmptype, "NONE_2") && 
+    if (strcasecmp(zcmptype, "NONE_2") && // strcasecmp(zcmptype, "NONE") && 
 	strcasecmp(zcmptype, "GZIP_1") && 
 	strcasecmp(zcmptype, "GZIP_2") && 
@@ -253,5 +252,5 @@
       int k;
       fprintf (stderr, "cmp dat: "); 
-      for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", zdata[k]); } 
+      for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
     }
@@ -266,5 +265,5 @@
     int k;
     fprintf (stderr, "cmp tbl: "); 
-    for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", ftable->buffer[k]); } 
+    for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", ftable->buffer[k]);  if (k % 4 == 3) fprintf (stderr, " "); }
     fprintf (stderr, "\n");
   }
@@ -339,7 +338,9 @@
   offset = 0;
 
+  int directCopy = (zzero == 0.0) && (zscale == 1.0);
+
   // we need to set up switches for all of the possible combinations:
   // this macro is used at the inner switch to run the actual loop
-# define SCALE_AND_DIST_INT(TYPE, SIZE) {				\
+# define SCALE_AND_DIST_INT_PRINT(TYPE, SIZE, INTYPE) {			\
     TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)];	\
     for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
@@ -347,22 +348,54 @@
 	*RAWptr = zblank;						\
       } else {								\
-	*RAWptr = (*TILEptr - zzero) / zscale;				\
+	/* *RAWptr = directCopy ? *TILEptr : (*TILEptr - zzero) / zscale; */ \
+	*RAWptr = *TILEptr;	\
+	fprintf (stderr, "col: %s to %s : %08x : %08x\n", #TYPE, #INTYPE, *TILEptr, *RAWptr); \
       } } }
 
   // we need to set up switches for all of the possible combinations:
   // this macro is used at the inner switch to run the actual loop
-# define SCALE_AND_DIST_FLOAT(TYPE, SIZE) {				\
-    TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)];	\
+# define SCALE_AND_DIST_INT(OTYPE, OSIZE) {				\
+    OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)];	\
+    for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
+      if (*TILEptr == oblank) {						\
+	*RAWptr = zblank;						\
+      } else {								\
+	if (directCopy) {						\
+	  *RAWptr = *TILEptr;						\
+	} else {							\
+	  *RAWptr = (*TILEptr - zzero) / zscale; 			\
+	} } } }
+
+  // we need to set up switches for all of the possible combinations:
+  // this macro is used at the inner switch to run the actual loop
+# define SCALE_AND_DIST_FLOAT(OTYPE, OSIZE) {				\
+    OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)];	\
     for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
       if (!isfinite(*TILEptr)) {					\
 	*RAWptr = zblank;						\
       } else {								\
-	*RAWptr = (*TILEptr - zzero) / zscale;				\
-      } } }
+	if (directCopy) {						\
+	  *RAWptr = *TILEptr;						\
+	} else {							\
+	  *RAWptr = (*TILEptr - zzero) / zscale;			\
+	} } } }
 
   // this macro sets up the outer switch and calls above the macro with all RAW buffer bitpix options
   // 
-# define SETUP_RAWSIZE(TYPE, SIZE) {			\
+# define SETUP_RAWSIZE_PRINT(TYPE, SIZE) {			\
     TYPE *RAWptr = (TYPE *) &raw[i*SIZE*Ztile[0]];	\
+    switch (matrix->bitpix) {				\
+      case   8: SCALE_AND_DIST_INT   (char,   1); break;	\
+      case  16: SCALE_AND_DIST_INT   (short,  2); break;	\
+      case  32: SCALE_AND_DIST_INT_PRINT   (int,    4, TYPE); break;	\
+      case -32: SCALE_AND_DIST_FLOAT (float,  4); break;	\
+      case -64: SCALE_AND_DIST_FLOAT (double, 8); break;						\
+      default: abort();					\
+    } }
+
+  // this macro sets up the outer switch and calls above the macro with all RAW buffer bitpix options
+  // 
+# define SETUP_RAWSIZE(ITYPE, ISIZE) {			\
+    ITYPE *RAWptr = (ITYPE *) &raw[i*ISIZE*Ztile[0]];	\
     switch (matrix->bitpix) {				\
       case   8: SCALE_AND_DIST_INT   (char,   1); break;	\
@@ -475,5 +508,5 @@
       char *srcptr = &matrix->buffer[size*(offset + start) + k];
 # endif
-      char *rawptr = &raw[i*size*Ztile[0] + k*Nraw];	
+      char *rawptr = &raw[i*Ztile[0] + k*Nraw];	
       for (j = 0; j < Ztile[0]; j++, srcptr += size, rawptr ++) {		
 	if (FALSE && (i == 0) && (j < 4) && (pass == 0)) {
Index: /branches/eam_branches/ohana.20150429/src/libfits/matrix/F_compress_utils.c
===================================================================
--- /branches/eam_branches/ohana.20150429/src/libfits/matrix/F_compress_utils.c	(revision 38398)
+++ /branches/eam_branches/ohana.20150429/src/libfits/matrix/F_compress_utils.c	(revision 38399)
@@ -234,9 +234,18 @@
   int i, Nbyte;
 
+  // NONE should be swapped to mimic swapping types
+  if (!strcasecmp(cmptype, "NONE")) {
+    if (out_bitpix ==   8) return (1);
+    if (out_bitpix ==  16) return (2);
+    if (out_bitpix ==  32) return (4);
+    if (out_bitpix == -32) return (4);
+    if (out_bitpix == -64) return (8);
+    return (1);
+  }
+
   // GZIP_1, GZIP_2 should not be swapped after compression
   if (!strcasecmp(cmptype, "GZIP_1") || 
       !strcasecmp(cmptype, "GZIP_2") || 
-      !strcasecmp(cmptype, "NONE_2") || 
-      !strcasecmp(cmptype, "NONE")) {
+      !strcasecmp(cmptype, "NONE_2")) {
     if (out_bitpix ==   8) return (1);
     if (out_bitpix ==  16) return (1);
Index: /branches/eam_branches/ohana.20150429/src/libfits/matrix/F_uncompress_M.c
===================================================================
--- /branches/eam_branches/ohana.20150429/src/libfits/matrix/F_uncompress_M.c	(revision 38398)
+++ /branches/eam_branches/ohana.20150429/src/libfits/matrix/F_uncompress_M.c	(revision 38399)
@@ -262,5 +262,5 @@
     int k;
     fprintf (stderr, "unc tbl: "); 
-    for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", ftable->buffer[k]); } 
+    for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", ftable->buffer[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
     fprintf (stderr, "\n");
   }
@@ -279,10 +279,9 @@
       int k;
       fprintf (stderr, "unc dat: "); 
-      for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", zdata[k]); } 
+      for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
     }
 
-    if (strcasecmp(cmptype, "NONE") && 
-	strcasecmp(cmptype, "NONE_2") && 
+    if (strcasecmp(cmptype, "NONE_2") && // strcasecmp(cmptype, "NONE") && 
 	strcasecmp(cmptype, "GZIP_1") && 
 	strcasecmp(cmptype, "GZIP_2") && 
@@ -296,5 +295,5 @@
       int k;
       fprintf (stderr, "unc SWP: "); 
-      for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", zdata[k]); } 
+      for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
       fprintf (stderr, "Nout  : %d -> ", Nout);
@@ -310,5 +309,5 @@
       fprintf (stderr, "%d\n", Nout);
       fprintf (stderr, "unc swp: "); 
-      for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", out[k]); } 
+      for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", out[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
     }
@@ -322,5 +321,5 @@
       int k;
       fprintf (stderr, "unc raw: "); 
-      for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", out[k]); } 
+      for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", out[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
     }
@@ -336,5 +335,5 @@
       int k;
       fprintf (stderr, "unc mat: "); 
-      for (k = 0; k < 32; k++) { fprintf (stderr, "0x%02hhx ", matrix->buffer[k]); } 
+      for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", matrix->buffer[k]); if (k % 4 == 3) fprintf (stderr, " "); } 
       fprintf (stderr, "\n");
     }
@@ -404,7 +403,7 @@
   int offset = 0;
 
-  // we need to set up switches for all of the possible combinations:
-  // this macro is used at the inner switch to run the actual loop
-# define SCALE_AND_DIST_INT(TYPE, SIZE) {				\
+  int directCopy = (zzero == 0.0) && (zscale == 1.0);
+
+# define SCALE_AND_DIST_INT_PRINT(TYPE, SIZE) {				\
     TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)];	\
     for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
@@ -412,25 +411,55 @@
 	*TILEptr = oblank;						\
       } else {								\
-	*TILEptr = *RAWptr * zscale + zzero;				\
+	*TILEptr = directCopy ? *RAWptr : *RAWptr * zscale + zzero;	\
+	fprintf (stderr, "dis: %08x : %08x\n", *TILEptr, *RAWptr); \
       } } }
 
   // we need to set up switches for all of the possible combinations:
   // this macro is used at the inner switch to run the actual loop
-# define SCALE_AND_DIST_FLOAT(TYPE, SIZE) {				\
-    TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)];	\
+# define SCALE_AND_DIST_INT(OTYPE, OSIZE) {				\
+    OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)];	\
+    for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
+      if (*TILEptr == zblank) {						\
+	*TILEptr = oblank;						\
+      } else {								\
+	if (directCopy) {						\
+	  *TILEptr = *RAWptr;						\
+	} else {							\
+	  *TILEptr = *RAWptr * zscale + zzero;				\
+	} } } }
+
+  // we need to set up switches for all of the possible combinations:
+  // this macro is used at the inner switch to run the actual loop
+# define SCALE_AND_DIST_FLOAT(OTYPE, OSIZE) {				\
+    OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)];	\
     for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) {		\
       if (!isfinite(*TILEptr)) {					\
 	*TILEptr = oblank;						\
       } else {								\
-	*TILEptr = *RAWptr * zscale + zzero;				\
-      } } }
+	if (directCopy) {						\
+	  *TILEptr = *RAWptr;						\
+	} else {							\
+	  *TILEptr = *RAWptr * zscale + zzero;				\
+	} } } }
   
   // this macro sets up the outer switch and calls above macro with all output bitpix options
-# define SETUP_RAWSIZE(TYPE, SIZE) {		   \
+# define SETUP_RAWSIZE(ITYPE, ISIZE) {		   \
+    ITYPE *RAWptr = (ITYPE *) &raw[i*ISIZE*Ztile[0]]; \
+    switch (matrix->bitpix) {			   \
+      case   8: SCALE_AND_DIST_INT   (char,   1); break; \
+      case  16: SCALE_AND_DIST_INT   (short,  2); break; \
+      case  32: SCALE_AND_DIST_INT   (int,    4); break; \
+      case -32: SCALE_AND_DIST_FLOAT (float,  4); break; \
+      case -64: SCALE_AND_DIST_FLOAT (double, 8); break; \
+      default: 	abort(); \
+    } }
+
+  // this macro sets up the outer switch and calls above macro with all output bitpix options
+# define SETUP_RAWSIZE_PRINT(TYPE, SIZE) {		   \
     TYPE *RAWptr = (TYPE *) &raw[i*SIZE*Ztile[0]]; \
     switch (matrix->bitpix) {			   \
       case   8: SCALE_AND_DIST_INT   (char,   1); break; \
       case  16: SCALE_AND_DIST_INT   (short,  2); break; \
-      case  32: SCALE_AND_DIST_INT   (int,    4); break; \
+      case  32: SCALE_AND_DIST_INT (int,    4); break; \
       case -32: SCALE_AND_DIST_FLOAT (float,  4); break; \
       case -64: SCALE_AND_DIST_FLOAT (double, 8); break; \
@@ -534,5 +563,5 @@
       char *srcptr = &matrix->buffer[size*(offset + start) + k];
 # endif
-      char *rawptr = &raw[i*size*Ztile[0] + k*Nraw];	
+      char *rawptr = &raw[i*Ztile[0] + k*Nraw];	
       for (j = 0; j < Ztile[0]; j++, srcptr += size, rawptr ++) {		
 	if (FALSE && (i == 0) && (j < 4) && (pass == 0)) {
Index: /branches/eam_branches/ohana.20150429/src/libfits/table/F_compress_T.c
===================================================================
--- /branches/eam_branches/ohana.20150429/src/libfits/table/F_compress_T.c	(revision 38398)
+++ /branches/eam_branches/ohana.20150429/src/libfits/table/F_compress_T.c	(revision 38399)
@@ -78,5 +78,5 @@
     if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[i].tformat_cmt)) ESCAPE;
 
-    // for now we set all fields to the requested type
+    // for now we set all fields to the requested type.  since I do not yet know the column data types I cannot yet assign automatic cmptypes
     strcpy (fields[i].zctype, zcmptype);
 
@@ -127,4 +127,25 @@
     fields[i].rowsize = fields[i].Nvalues*fields[i].pixsize;
     max_width = MAX(max_width, fields[i].rowsize);
+
+    if (!strcasecmp (fields[i].zctype, "AUTO")) {
+      if (!strcmp (fields[i].datatype, "float") || 
+	  !strcmp (fields[i].datatype, "double")|| 
+	  !strcmp (fields[i].datatype, "int64_t")) {
+	strcpy (fields[i].zctype, "GZIP_2");
+	goto got_cmptype;
+      }
+      if (!strcmp (fields[i].datatype, "byte") ||
+	  !strcmp (fields[i].datatype, "short") ||
+	  !strcmp (fields[i].datatype, "int")) {
+	strcpy (fields[i].zctype, "RICE_1");
+	goto got_cmptype;
+      }
+      if (!strcmp (fields[i].datatype, "char")) {
+	strcpy (fields[i].zctype, "GZIP_1");
+	goto got_cmptype;
+      }
+    }
+  got_cmptype:
+
 
     // RICE can only be used on integer fields
Index: /branches/eam_branches/ohana.20150429/src/libfits/test/imagecomp.c
===================================================================
--- /branches/eam_branches/ohana.20150429/src/libfits/test/imagecomp.c	(revision 38398)
+++ /branches/eam_branches/ohana.20150429/src/libfits/test/imagecomp.c	(revision 38399)
@@ -4,4 +4,6 @@
 
 int test_compress (int bitpix, char *zcmptype);
+int test_compress_fullrange (int bitpix, char *zcmptype);
+int test_compress_fulltile (int bitpix, char *zcmptype);
 
 // char *cmptype[] = {"NONE", "NONE_2", "GZIP_1", "GZIP_2", "PLIO_1", "RICE_1", "RICE_ONE", "HCOMPRESS_1", NULL};
@@ -9,7 +11,13 @@
 int bitpix[] = {8, 16, 32, -32, -64, 0};
 
+// char *cmptype[] = {"NONE_2", NULL};
+// int bitpix[] = {16, 0};
+
+static int NX = 10;
+static int NY = 10;
+
 int main (int argc, char **argv) {
   
-  plan_tests (64);
+  plan_tests (3*3*234);
 
   diag ("libfits imagecomp.c tests");
@@ -21,11 +29,32 @@
       if (!strcasecmp (cmptype[i], "RICE_ONE") && (bitpix[j] < 0)) continue;
       test_compress (bitpix[j], cmptype[i]);
+      test_compress_fulltile (bitpix[j], cmptype[i]);
+      test_compress_fullrange (bitpix[j], cmptype[i]);
     }
   }
-  exit (0);
+
+  NX = 100; NY = 33;
+  for (i = 0; cmptype[i]; i++) {
+    for (j = 0; bitpix[j]; j++) {
+      if (!strcasecmp (cmptype[i], "RICE_1") && (bitpix[j] < 0)) continue;
+      if (!strcasecmp (cmptype[i], "RICE_ONE") && (bitpix[j] < 0)) continue;
+      test_compress (bitpix[j], cmptype[i]);
+      test_compress_fulltile (bitpix[j], cmptype[i]);
+      test_compress_fullrange (bitpix[j], cmptype[i]);
+    }
+  }
+
+  NX = 357; NY = 245;
+  for (i = 0; cmptype[i]; i++) {
+    for (j = 0; bitpix[j]; j++) {
+      if (!strcasecmp (cmptype[i], "RICE_1") && (bitpix[j] < 0)) continue;
+      if (!strcasecmp (cmptype[i], "RICE_ONE") && (bitpix[j] < 0)) continue;
+      test_compress (bitpix[j], cmptype[i]);
+      test_compress_fulltile (bitpix[j], cmptype[i]);
+      test_compress_fullrange (bitpix[j], cmptype[i]);
+    }
+  }
+  return exit_status();
 }
-
-# define NX 10
-# define NY 10
 
 int test_compress (int bitpix, char *zcmptype) { // make a table, compress, uncompress, compare : use compression zcmptype
@@ -77,6 +106,7 @@
   }     
 
+  // int Ztile[2] = {NX, NY};
+  // ok (gfits_compress_image (&rawheader, &rawmatrix, &ftable, (int *) &Ztile, zcmptype), "compressed image");
   ok (gfits_compress_image (&rawheader, &rawmatrix, &ftable, NULL, zcmptype), "compressed image");
-
   ok (gfits_uncompress_image (&outheader, &outmatrix, &ftable), "uncompressed image");
   
@@ -115,2 +145,181 @@
 }
 
+int test_compress_fulltile (int bitpix, char *zcmptype) { // make a table, compress, uncompress, compare : use compression zcmptype
+
+  Header rawheader;
+  Matrix rawmatrix;
+  Header outheader;
+  Matrix outmatrix;
+
+  Header theader;
+  FTable ftable;
+  ftable.header = &theader;
+
+  diag ("--- starting test_compress with bitpix %d, zcmptype %s ---", bitpix, zcmptype);
+  ok (gfits_init_header (&rawheader), "init'ed the raw header");
+  ok (gfits_init_matrix (&rawmatrix), "init'ed the raw matrix");
+  ok (gfits_init_header (&outheader), "init'ed the out header");
+  ok (gfits_init_matrix (&outmatrix), "init'ed the out matrix");
+
+  /* assign the necessary internal values */
+  rawheader.bitpix   = bitpix;
+  rawheader.Naxes = 2;
+  rawheader.Naxis[0] = NX;
+  rawheader.Naxis[1] = NY;
+
+  /* create the appropriate header and matrix */
+  ok (gfits_create_header (&rawheader),          "created header");
+  ok (gfits_create_matrix (&rawheader, &rawmatrix), "created matrix");
+  
+  char   *rawdata_char   = (char   *) rawmatrix.buffer;
+  short  *rawdata_short  = (short  *) rawmatrix.buffer;
+  int    *rawdata_int    = (int    *) rawmatrix.buffer;
+  float  *rawdata_float  = (float  *) rawmatrix.buffer;
+  double *rawdata_double = (double *) rawmatrix.buffer;
+  
+  int ix, iy;
+  for (ix = 0; ix < NX; ix++) {
+    for (iy = 0; iy < NY; iy++) {
+      int IY = iy + 1;
+      switch (bitpix) {
+	case   8: rawdata_char  [ix + NX*iy] = ix + IY*IY; break;
+	case  16: rawdata_short [ix + NX*iy] = ix + IY*IY; break;
+	case  32: rawdata_int   [ix + NX*iy] = ix + IY*IY; break;
+	case -32: rawdata_float [ix + NX*iy] = ix + IY*IY; break;
+	case -64: rawdata_double[ix + NX*iy] = ix + IY*IY; break;
+	default: myAbort ("bad bitpix value");
+      }
+    }
+  }     
+
+  int Ztile[2] = {NX, NY};
+  ok (gfits_compress_image (&rawheader, &rawmatrix, &ftable, (int *) &Ztile, zcmptype), "compressed image");
+  // ok (gfits_compress_image (&rawheader, &rawmatrix, &ftable, NULL, zcmptype), "compressed image");
+  ok (gfits_uncompress_image (&outheader, &outmatrix, &ftable), "uncompressed image");
+  
+  gfits_free_header (&theader);
+  gfits_free_table (&ftable);
+  
+  int Nbad = 0;
+
+  char   *outdata_char   = (char   *) outmatrix.buffer;
+  short  *outdata_short  = (short  *) outmatrix.buffer;
+  int    *outdata_int    = (int    *) outmatrix.buffer;
+  float  *outdata_float  = (float  *) outmatrix.buffer;
+  double *outdata_double = (double *) outmatrix.buffer;
+
+  for (ix = 0; ix < NX; ix++) {
+    for (iy = 0; iy < NY; iy++) {
+      switch (bitpix) {
+	case   8: if (rawdata_char  [ix + NX*iy] != outdata_char  [ix + NX*iy]) Nbad ++; break;
+	case  16: if (rawdata_short [ix + NX*iy] != outdata_short [ix + NX*iy]) Nbad ++; break;
+	case  32: if (rawdata_int   [ix + NX*iy] != outdata_int   [ix + NX*iy]) Nbad ++; break;
+	case -32: if (rawdata_float [ix + NX*iy] != outdata_float [ix + NX*iy]) Nbad ++; break;
+	case -64: if (rawdata_double[ix + NX*iy] != outdata_double[ix + NX*iy]) Nbad ++; break;
+	default: myAbort ("bad bitpix value");
+      }
+    }
+  }     
+  
+  ok (!Nbad, "all image pixels match");
+
+  gfits_free_header (&rawheader);
+  gfits_free_matrix (&rawmatrix);
+
+  gfits_free_header (&outheader);
+  gfits_free_matrix (&outmatrix);
+  return TRUE;
+}
+
+int test_compress_fullrange (int bitpix, char *zcmptype) { // make a table, compress, uncompress, compare : use compression zcmptype
+
+  Header rawheader;
+  Matrix rawmatrix;
+  Header outheader;
+  Matrix outmatrix;
+
+  Header theader;
+  FTable ftable;
+  ftable.header = &theader;
+
+  diag ("--- starting test_compress with bitpix %d, zcmptype %s ---", bitpix, zcmptype);
+  ok (gfits_init_header (&rawheader), "init'ed the raw header");
+  ok (gfits_init_matrix (&rawmatrix), "init'ed the raw matrix");
+  ok (gfits_init_header (&outheader), "init'ed the out header");
+  ok (gfits_init_matrix (&outmatrix), "init'ed the out matrix");
+
+  /* assign the necessary internal values */
+  rawheader.bitpix   = bitpix;
+  rawheader.Naxes = 2;
+  rawheader.Naxis[0] = NX;
+  rawheader.Naxis[1] = NY;
+
+  /* create the appropriate header and matrix */
+  ok (gfits_create_header (&rawheader),          "created header");
+  ok (gfits_create_matrix (&rawheader, &rawmatrix), "created matrix");
+  
+  char   *rawdata_char   = (char   *) rawmatrix.buffer;
+  short  *rawdata_short  = (short  *) rawmatrix.buffer;
+  int    *rawdata_int    = (int    *) rawmatrix.buffer;
+  float  *rawdata_float  = (float  *) rawmatrix.buffer;
+  double *rawdata_double = (double *) rawmatrix.buffer;
+  
+  long A = time(NULL);
+  srand48(A);
+  // srand48(1);
+
+  int ix, iy;
+  for (ix = 0; ix < NX; ix++) {
+    for (iy = 0; iy < NY; iy++) {
+      switch (bitpix) {
+	case   8: rawdata_char  [ix + NX*iy] =       0xff & lrand48(); break;
+	case  16: rawdata_short [ix + NX*iy] =     0xffff & lrand48(); break;
+	case  32: rawdata_int   [ix + NX*iy] = 0xffffffff & lrand48(); break;
+	case -32: rawdata_float [ix + NX*iy] = FLT_MAX * (2.0*drand48() - 1.0); break;
+	case -64: rawdata_double[ix + NX*iy] = DBL_MAX * (2.0*drand48() - 1.0); break;
+	default: myAbort ("bad bitpix value");
+      }
+    }
+  }     
+
+  // int Ztile[2] = {NX, NY};
+  ok (gfits_compress_image (&rawheader, &rawmatrix, &ftable, NULL, zcmptype), "compressed image");
+
+  ok (gfits_uncompress_image (&outheader, &outmatrix, &ftable), "uncompressed image");
+  
+  gfits_free_header (&theader);
+  gfits_free_table (&ftable);
+  
+  int Nbad = 0;
+
+  char   *outdata_char   = (char   *) outmatrix.buffer;
+  short  *outdata_short  = (short  *) outmatrix.buffer;
+  int    *outdata_int    = (int    *) outmatrix.buffer;
+  float  *outdata_float  = (float  *) outmatrix.buffer;
+  double *outdata_double = (double *) outmatrix.buffer;
+
+  for (ix = 0; ix < NX; ix++) {
+    for (iy = 0; iy < NY; iy++) {
+      switch (bitpix) {
+	case   8: if (rawdata_char  [ix + NX*iy] != outdata_char  [ix + NX*iy]) Nbad ++; break;
+	case  16: if (rawdata_short [ix + NX*iy] != outdata_short [ix + NX*iy]) Nbad ++; break;
+	case  32: if (rawdata_int   [ix + NX*iy] != outdata_int   [ix + NX*iy]) Nbad ++; break;
+	case -32: if (rawdata_float [ix + NX*iy] != outdata_float [ix + NX*iy]) Nbad ++; break;
+	case -64: if (rawdata_double[ix + NX*iy] != outdata_double[ix + NX*iy]) Nbad ++; break;
+	default: myAbort ("bad bitpix value");
+      }
+    }
+  }     
+  
+  ok (!Nbad, "all image pixels match");
+
+  gfits_free_header (&rawheader);
+  gfits_free_matrix (&rawmatrix);
+
+  gfits_free_header (&outheader);
+  gfits_free_matrix (&outmatrix);
+  return TRUE;
+}
+
+
+// fprintf (stderr, "%2d %2d : 0x%08x vs 0x%08x vs 0x%08x : %d\n", ix, iy, rawdata_int   [ix + NX*iy], outdata_int   [ix + NX*iy], tmpbuff[ix + NX*iy], outdata_int   [ix + NX*iy] - rawdata_int   [ix + NX*iy]);
Index: /branches/eam_branches/ohana.20150429/src/libfits/test/ricetest.c
===================================================================
--- /branches/eam_branches/ohana.20150429/src/libfits/test/ricetest.c	(revision 38398)
+++ /branches/eam_branches/ohana.20150429/src/libfits/test/ricetest.c	(revision 38399)
@@ -8,5 +8,7 @@
 int main (int argc, char **argv) {
   
-  plan_tests (64);
+  plan_tests (45);
+
+  diag ("libfits ricetest.c tests");
 
   // buffers to store max array
@@ -14,4 +16,30 @@
   char cmpdata[NBYTE];
   char outdata[NBYTE];
+
+  if (1) { 
+    char *rawvalue = (char *) rawdata;
+    char *outvalue = (char *) outdata;
+
+    int j;
+    for (j = 0; j < 5; j++) { 
+      int i;
+      for (i = 0; i < NPIX; i++) {
+	rawvalue[i] = i;
+      }
+
+      int Ncmp = fits_rcomp_byte (rawvalue, NPIX, cmpdata, NBYTE, 32);
+      ok (Ncmp > 0, "compressed byte data");
+
+      int status = fits_rdecomp_byte (cmpdata, Ncmp, outdata, NPIX, 32);
+      ok (!status, "decompressed byte data");
+
+      int Nbad = 0;
+      for (i = 0; i < NPIX; i++) {
+	if (rawvalue[i] != outvalue[i]) Nbad ++;
+      }
+
+      ok (!Nbad, "values match");
+    }
+  }
 
   if (1) { 
@@ -27,8 +55,8 @@
 
       int Ncmp = fits_rcomp_short (rawvalue, NPIX, cmpdata, NBYTE, 32);
-      fprintf (stderr, "Ncmp: %d\n", Ncmp);
+      ok (Ncmp > 0, "compressed short data");
 
       int status = fits_rdecomp_short (cmpdata, Ncmp, outdata, NPIX, 32);
-      fprintf (stderr, "status: %d\n", status);
+      ok (!status, "decompressed short data");
 
       int Nbad = 0;
@@ -41,5 +69,5 @@
   }
 
-  if (0) { 
+  if (1) { 
     int *rawvalue = (int *) rawdata;
     int *outvalue = (int *) outdata;
@@ -53,8 +81,8 @@
 
       int Ncmp = fits_rcomp (rawvalue, NPIX, cmpdata, NBYTE, 32);
-      fprintf (stderr, "Ncmp: %d\n", Ncmp);
+      ok (Ncmp > 0, "compressed int data");
 
       int status = fits_rdecomp (cmpdata, Ncmp, outdata, NPIX, 32);
-      fprintf (stderr, "status: %d\n", status);
+      ok (!status, "decompressed int data");
 
       int Nbad = 0;
@@ -62,8 +90,7 @@
 	if (rawvalue[i] != outvalue[i]) Nbad ++;
       }
-
       ok (!Nbad, "values match");
     }
   }
-  exit (0);
+  return exit_status();
 }
Index: /branches/eam_branches/ohana.20150429/src/libfits/test/tablecomp.c
===================================================================
--- /branches/eam_branches/ohana.20150429/src/libfits/test/tablecomp.c	(revision 38398)
+++ /branches/eam_branches/ohana.20150429/src/libfits/test/tablecomp.c	(revision 38399)
@@ -4,24 +4,40 @@
 
 int test_compress (char *zcmptype);
+int test_compress_fullrange (char *zcmptype);
 int test_compress_single_full (char *zcmptype);
 
+char *cmptype[] = {"NONE", "NONE_2", "GZIP_1", "GZIP_2", "RICE_1", "RICE_ONE", "AUTO", NULL};
+
 int main (int argc, char **argv) {
   
-  plan_tests (64);
+  plan_tests (286);
 
   diag ("libfits tablecomp.c tests");
 
-  test_compress_single_full ("GZIP_1");
-  test_compress_single_full ("RICE_1");
-
   test_compress (NULL);
-  test_compress ("NONE");
-  test_compress ("NONE_2");
-  test_compress ("GZIP_1");
-  test_compress ("GZIP_2");
-  test_compress ("RICE_1");
-  test_compress ("RICE_ONE");
-
-  exit (0);
+  test_compress_fullrange (NULL);
+
+  int i;
+  for (i = 0; cmptype[i]; i++) {
+    test_compress (cmptype[i]);
+    test_compress_fullrange (cmptype[i]);
+  }
+
+  // test_compress_single_full ("GZIP_1");
+  // test_compress_single_full ("RICE_1");
+
+  // test_compress (NULL);
+  // test_compress ("NONE");
+  // test_compress ("NONE_2");
+  // test_compress ("GZIP_1");
+  // test_compress ("GZIP_2");
+  // test_compress ("RICE_1");
+  // test_compress ("RICE_ONE");
+  // test_compress ("AUTO");
+
+  // test_compress_fullrange (NULL);
+  // test_compress_fullrange ("NONE");
+
+  return exit_status();
 }
 
@@ -37,9 +53,10 @@
   ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header");
 
-  ok (gfits_define_bintable_column (&header, "B", "VAL", "val", "none", 1.0, 0.0), "defined byte column");
-  ok (gfits_define_bintable_column (&header, "I", "SEQ", "seq", "none", 1.0, 0.0), "defined short column");
-  ok (gfits_define_bintable_column (&header, "J", "ID",  "ID", "none", 1.0, 0.0),  "defined int column");
-  ok (gfits_define_bintable_column (&header, "E", "X", "x", "degree", 1.0, 0.0),   "defined float column");
-  ok (gfits_define_bintable_column (&header, "D", "Y", "y", "degree", 1.0, 0.0),   "defined double column");
+  ok (gfits_define_bintable_column (&header, "B", "VAL_B", "byte",   "none", 1.0, 0.0), "defined byte column");
+  ok (gfits_define_bintable_column (&header, "I", "VAL_I", "short",  "none", 1.0, 0.0), "defined short column");
+  ok (gfits_define_bintable_column (&header, "J", "VAL_J", "int",    "none", 1.0, 0.0),  "defined int column");
+  ok (gfits_define_bintable_column (&header, "K", "VAL_K", "long",   "none", 1.0, 0.0),  "defined long column");
+  ok (gfits_define_bintable_column (&header, "E", "VAL_E", "float",  "degree", 1.0, 0.0),   "defined float column");
+  ok (gfits_define_bintable_column (&header, "D", "VAL_D", "double", "degree", 1.0, 0.0),   "defined double column");
   
   // generate the output array that carries the data
@@ -47,25 +64,28 @@
 
   int Nval = 1000;
-  char  *VAL;  ALLOCATE (VAL, char,   Nval);
-  short *SEQ;  ALLOCATE (SEQ, short,  Nval);
-  int    *ID;  ALLOCATE (ID,  int,    Nval);
-  float   *X;  ALLOCATE (X,   float,  Nval);
-  double  *Y;  ALLOCATE (Y,   double, Nval);
+  char    *VAL_B;  ALLOCATE (VAL_B, char,    Nval);
+  short   *VAL_I;  ALLOCATE (VAL_I, short,   Nval);
+  int     *VAL_J;  ALLOCATE (VAL_J, int,     Nval);
+  int64_t *VAL_K;  ALLOCATE (VAL_K, int64_t, Nval);
+  float   *VAL_E;  ALLOCATE (VAL_E, float,   Nval);
+  double  *VAL_D;  ALLOCATE (VAL_D, double,  Nval);
   
   int i;
   for (i = 0; i < Nval; i++) {
-    VAL[i] = i + 32;
-    SEQ[i] = i;
-    ID[i] = 10000*i + 100*i;
-    X[i] = 0.1*i;
-    Y[i] = 1.001*i;
+    VAL_B[i] = (i % 255) - 128;
+    VAL_I[i] = i;
+    VAL_J[i] = 10000*i + 100*i;
+    VAL_K[i] = 10000*i + 330*i;
+    VAL_E[i] = 0.1*i;
+    VAL_D[i] = 1.001*i;
   }     
 
   // add the columns to the output array
-  ok (gfits_set_bintable_column (&header, &ftable, "VAL", VAL, Nval), "set byte   table column");
-  ok (gfits_set_bintable_column (&header, &ftable, "SEQ", SEQ, Nval), "set short  table column");
-  ok (gfits_set_bintable_column (&header, &ftable,  "ID",  ID, Nval), "set int    table column");
-  ok (gfits_set_bintable_column (&header, &ftable,   "X",   X, Nval), "set float  table column");
-  ok (gfits_set_bintable_column (&header, &ftable,   "Y",   Y, Nval), "set double table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_B", VAL_B, Nval), "set byte   table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_I", VAL_I, Nval), "set short  table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_J", VAL_J, Nval), "set int    table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_K", VAL_K, Nval), "set long   table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_E", VAL_E, Nval), "set float  table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_D", VAL_D, Nval), "set double table column");
 
   Header *outheader = &header;
@@ -94,29 +114,38 @@
   off_t Nrow;
 
-  char   *VAL_t = gfits_get_bintable_column_data (outheader, outtable, "VAL", type, &Nrow, &Ncol); ok (!strcmp (type, "byte"),   "read byte   table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
-  short  *SEQ_t = gfits_get_bintable_column_data (outheader, outtable, "SEQ", type, &Nrow, &Ncol); ok (!strcmp (type, "short"),  "read short  table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
-  int     *ID_t = gfits_get_bintable_column_data (outheader, outtable,  "ID", type, &Nrow, &Ncol); ok (!strcmp (type, "int"),    "read int    table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
-  float    *X_t = gfits_get_bintable_column_data (outheader, outtable,   "X", type, &Nrow, &Ncol); ok (!strcmp (type, "float"),  "read float  table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
-  double   *Y_t = gfits_get_bintable_column_data (outheader, outtable,   "Y", type, &Nrow, &Ncol); ok (!strcmp (type, "double"), "read double table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+  char    *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "byte"),    "read byte    table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+  short   *VAL_I_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_I", type, &Nrow, &Ncol); ok (!strcmp (type, "short"),   "read short   table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+  int     *VAL_J_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_J", type, &Nrow, &Ncol); ok (!strcmp (type, "int"),     "read int     table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+  int64_t *VAL_K_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_K", type, &Nrow, &Ncol); ok (!strcmp (type, "int64_t"), "read int64_t table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+  float   *VAL_E_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_E", type, &Nrow, &Ncol); ok (!strcmp (type, "float"),   "read float   table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+  double  *VAL_D_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_D", type, &Nrow, &Ncol); ok (!strcmp (type, "double"),  "read double  table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
 
   // count mismatched values
-  int Nvalue = 0;
-  int Nseq = 0;
-  int  Nid = 0;
-  int   Nx = 0;
-  int   Ny = 0;
-  for (i = 0; i < Nval; i++) {
-    if (VAL[i] != VAL_t[i]) Nvalue++;
-    if (SEQ[i] != SEQ_t[i]) Nseq++;
-    if ( ID[i] !=  ID_t[i]) Nid++;
-    if (  X[i] !=   X_t[i]) Nx++;
-    if (  Y[i] !=   Y_t[i]) Ny++;
-  }
-
-  ok (!Nvalue, "byte   values match (input vs output)");
-  ok (!Nseq,   "short  values match (input vs output)");
-  ok (!Nid,    "int    values match (input vs output)");
-  ok (!Nx,     "float  values match (input vs output)");
-  ok (!Ny,     "double values match (input vs output)");
+  int NVAL_B_bad = 0;
+  int NVAL_I_bad = 0;
+  int NVAL_J_bad = 0;
+  int NVAL_K_bad = 0;
+  int NVAL_E_bad = 0;
+  int NVAL_D_bad = 0;
+
+  // for (i = 0; i < Nval; i++) {
+  //   fprintf (stderr, "%0llx : %0llx\n", (long long) VAL_K[i], (long long) VAL_K_t[i]);
+  // }
+
+  for (i = 0; i < Nval; i++) {
+    if (VAL_B[i] != VAL_B_t[i]) NVAL_B_bad++;
+    if (VAL_I[i] != VAL_I_t[i]) NVAL_I_bad++;
+    if (VAL_J[i] != VAL_J_t[i]) NVAL_J_bad++;
+    if (VAL_K[i] != VAL_K_t[i]) NVAL_K_bad++;
+    if (VAL_E[i] != VAL_E_t[i]) NVAL_E_bad++;
+    if (VAL_D[i] != VAL_D_t[i]) NVAL_D_bad++;
+  }
+
+  ok (!NVAL_B_bad, "byte    values match (input vs output)");
+  ok (!NVAL_I_bad, "short   values match (input vs output)");
+  ok (!NVAL_J_bad, "int     values match (input vs output)");
+  ok (!NVAL_K_bad, "int64_t values match (input vs output)");
+  ok (!NVAL_E_bad, "float   values match (input vs output)");
+  ok (!NVAL_D_bad, "double  values match (input vs output)");
 
   gfits_free_header (&header);
@@ -129,5 +158,5 @@
 }
 
-int test_compress_single_full (char *zcmptype) { // test 2: make a table, compress, uncompress, compare : use compression "NONE"
+int test_compress_fullrange (char *zcmptype) { // test 2: make a table, compress, uncompress, compare : use compression "NONE"
 
   Header header;
@@ -140,5 +169,10 @@
   ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header");
 
-  ok (gfits_define_bintable_column (&header, "I", "SEQ", "seq", "none", 1.0, 0.0), "defined short column");
+  ok (gfits_define_bintable_column (&header, "B", "VAL_B", "byte",   "none", 1.0, 0.0), "defined byte column");
+  ok (gfits_define_bintable_column (&header, "I", "VAL_I", "short",  "none", 1.0, 0.0), "defined short column");
+  ok (gfits_define_bintable_column (&header, "J", "VAL_J", "int",    "none", 1.0, 0.0),  "defined int column");
+  ok (gfits_define_bintable_column (&header, "K", "VAL_K", "long",   "none", 1.0, 0.0),  "defined long column");
+  ok (gfits_define_bintable_column (&header, "E", "VAL_E", "float",  "degree", 1.0, 0.0),   "defined float column");
+  ok (gfits_define_bintable_column (&header, "D", "VAL_D", "double", "degree", 1.0, 0.0),   "defined double column");
   
   // generate the output array that carries the data
@@ -146,13 +180,31 @@
 
   int Nval = 1000;
-  short *SEQ;  ALLOCATE (SEQ, short,  Nval);
-  
+  char    *VAL_B;  ALLOCATE (VAL_B, char,    Nval);
+  short   *VAL_I;  ALLOCATE (VAL_I, short,   Nval);
+  int     *VAL_J;  ALLOCATE (VAL_J, int,     Nval);
+  int64_t *VAL_K;  ALLOCATE (VAL_K, int64_t, Nval);
+  float   *VAL_E;  ALLOCATE (VAL_E, float,   Nval);
+  double  *VAL_D;  ALLOCATE (VAL_D, double,  Nval);
+  
+  long A = time(NULL);
+  srand48(A);
+
   int i;
   for (i = 0; i < Nval; i++) {
-    SEQ[i] = i;
+    VAL_B[i] =       0xff & lrand48();
+    VAL_I[i] =     0xffff & lrand48();
+    VAL_J[i] = 0xffffffff & lrand48();
+    VAL_K[i] = (((int64_t)lrand48()) << 32) + (int64_t)lrand48();
+    VAL_E[i] = FLT_MAX * (2.0*drand48() - 1.0);
+    VAL_D[i] = DBL_MAX * (2.0*drand48() - 1.0);
   }     
 
   // add the columns to the output array
-  ok (gfits_set_bintable_column (&header, &ftable, "SEQ", SEQ, Nval), "set short  table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_B", VAL_B, Nval), "set byte   table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_I", VAL_I, Nval), "set short  table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_J", VAL_J, Nval), "set int    table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_K", VAL_K, Nval), "set long   table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_E", VAL_E, Nval), "set float  table column");
+  ok (gfits_set_bintable_column (&header, &ftable, "VAL_D", VAL_D, Nval), "set double table column");
 
   Header *outheader = &header;
@@ -163,5 +215,5 @@
     FTable cmptable;
     cmptable.header = &cmpheader;
-    ok (gfits_compress_table (&ftable, &cmptable, 0, zcmptype), "compressed table");
+    ok (gfits_compress_table (&ftable, &cmptable, 10, zcmptype), "compressed table");
 
     Header rawheader;
@@ -181,4 +233,96 @@
   off_t Nrow;
 
+  char    *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "byte"),    "read byte    table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+  short   *VAL_I_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_I", type, &Nrow, &Ncol); ok (!strcmp (type, "short"),   "read short   table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+  int     *VAL_J_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_J", type, &Nrow, &Ncol); ok (!strcmp (type, "int"),     "read int     table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+  int64_t *VAL_K_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_K", type, &Nrow, &Ncol); ok (!strcmp (type, "int64_t"), "read int64_t table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+  float   *VAL_E_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_E", type, &Nrow, &Ncol); ok (!strcmp (type, "float"),   "read float   table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+  double  *VAL_D_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_D", type, &Nrow, &Ncol); ok (!strcmp (type, "double"),  "read double  table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
+
+  // count mismatched values
+  int NVAL_B_bad = 0;
+  int NVAL_I_bad = 0;
+  int NVAL_J_bad = 0;
+  int NVAL_K_bad = 0;
+  int NVAL_E_bad = 0;
+  int NVAL_D_bad = 0;
+
+  for (i = 0; i < Nval; i++) {
+    if (VAL_B[i] != VAL_B_t[i]) NVAL_B_bad++;
+    if (VAL_I[i] != VAL_I_t[i]) NVAL_I_bad++;
+    if (VAL_J[i] != VAL_J_t[i]) NVAL_J_bad++;
+    if (VAL_K[i] != VAL_K_t[i]) NVAL_K_bad++;
+    if (VAL_E[i] != VAL_E_t[i]) NVAL_E_bad++;
+    if (VAL_D[i] != VAL_D_t[i]) NVAL_D_bad++;
+  }
+
+  ok (!NVAL_B_bad, "byte    values match (input vs output)");
+  ok (!NVAL_I_bad, "short   values match (input vs output)");
+  ok (!NVAL_J_bad, "int     values match (input vs output)");
+  ok (!NVAL_K_bad, "int64_t values match (input vs output)");
+  ok (!NVAL_E_bad, "float   values match (input vs output)");
+  ok (!NVAL_D_bad, "double  values match (input vs output)");
+
+  gfits_free_header (&header);
+  gfits_free_table (&ftable);
+  if (zcmptype) {
+    gfits_free_header (outheader);
+    gfits_free_table (outtable);
+  }
+  return TRUE;
+}
+
+int test_compress_single_full (char *zcmptype) { // test 2: make a table, compress, uncompress, compare : use compression "NONE"
+
+  Header header;
+  FTable ftable;
+
+  diag ("--- starting test_compress with zcmptype %s ---", zcmptype);
+  ok (gfits_init_header (&header), "inited the header");
+  ok (gfits_init_table (&ftable), "inited the table");
+
+  ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header");
+
+  ok (gfits_define_bintable_column (&header, "I", "SEQ", "seq", "none", 1.0, 0.0), "defined short column");
+  
+  // generate the output array that carries the data
+  ok (gfits_create_table (&header, &ftable), "created the basic table");
+
+  int Nval = 1000;
+  short *SEQ;  ALLOCATE (SEQ, short,  Nval);
+  
+  int i;
+  for (i = 0; i < Nval; i++) {
+    SEQ[i] = i;
+  }     
+
+  // add the columns to the output array
+  ok (gfits_set_bintable_column (&header, &ftable, "SEQ", SEQ, Nval), "set short  table column");
+
+  Header *outheader = &header;
+  FTable *outtable = &ftable;
+
+  if (zcmptype) {
+    Header cmpheader;
+    FTable cmptable;
+    cmptable.header = &cmpheader;
+    ok (gfits_compress_table (&ftable, &cmptable, 0, zcmptype), "compressed table");
+
+    Header rawheader;
+    FTable rawtable;
+    rawtable.header = &rawheader;
+    ok (gfits_uncompress_table (&cmptable, &rawtable), "uncompressed table");
+    
+    gfits_free_header (&cmpheader);
+    gfits_free_table (&cmptable);
+
+    outheader = &rawheader;
+    outtable  = &rawtable;
+  }
+
+  char type[16];
+  int Ncol;
+  off_t Nrow;
+
   short  *SEQ_t = gfits_get_bintable_column_data (outheader, outtable, "SEQ", type, &Nrow, &Ncol); ok (!strcmp (type, "short"),  "read short  table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols");
 
Index: /branches/eam_branches/ohana.20150429/src/libfits/test/zlib.c
===================================================================
--- /branches/eam_branches/ohana.20150429/src/libfits/test/zlib.c	(revision 38398)
+++ /branches/eam_branches/ohana.20150429/src/libfits/test/zlib.c	(revision 38399)
@@ -41,4 +41,5 @@
     }
 
+# ifdef VERBOSE
     char *rawdata = (char *) srcbuf;
     fprintf (stderr, "inp: ");
@@ -47,16 +48,18 @@
     }
     fprintf (stderr, "\n");
+# endif
 
     // the '5' is the compression level: make this a user argument
     err = deflateInit(&zdn, 5);
-    fprintf (stderr, "inp buffers cmp 0: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
+    // fprintf (stderr, "inp buffers cmp 0: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
     if (err != Z_OK) { fprintf (stderr, "error 1: %d vs %d\n", err, Z_OK); exit (1); }
   
     err = deflate(&zdn, Z_FINISH);
-    fprintf (stderr, "out buffers cmp 1: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
+    // fprintf (stderr, "out buffers cmp 1: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
     if (err != Z_STREAM_END) { fprintf (stderr, "error 2: %d vs %d\n", err, Z_STREAM_END); exit (2); }
-    fprintf (stderr, "out buffers cmp 2: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
+    // fprintf (stderr, "out buffers cmp 2: %d => %d => %d\n", zdn.avail_in, zdn.avail_out, (int) zdn.total_out);
 
     // dump out the data which failed to uncompress (and the input data)
+# ifdef VERBOSE
     char *cmpdata = (char *) tgtbuf;
     fprintf (stderr, "out: ");
@@ -65,8 +68,9 @@
     }
     fprintf (stderr, "\n");
+# endif
 
     assert (zdn.total_out <= NTGT*sizeof(double));
 
-    fprintf (stderr, "result: %d bytes\n", (int) zdn.total_out);
+    // fprintf (stderr, "result: %d bytes\n", (int) zdn.total_out);
     // for (i = 0; i < zdn.total_out / sizeof(double); i++) {
     //   fprintf (stderr, "%d : 0x%02hhx\n", i, tgtbuf[i]);
@@ -87,12 +91,13 @@
     // the '5' is the compression level: make this a user argument
     err = inflateInit(&zup);
-    fprintf (stderr, "out buffers unc 0: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
+    // fprintf (stderr, "out buffers unc 0: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
     if (err != Z_OK) { fprintf (stderr, "error 1: %d vs %d\n", err, Z_OK); exit (1); }
   
     err = inflate(&zup, Z_FINISH);
-    fprintf (stderr, "out buffers unc 1: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
+    // fprintf (stderr, "out buffers unc 1: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
     if (err != Z_STREAM_END) { fprintf (stderr, "error 2: %d vs %d\n", err, Z_STREAM_END); exit (2); }
-    fprintf (stderr, "out buffers unc 2: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
+    // fprintf (stderr, "out buffers unc 2: %d => %d => %d\n", zup.avail_in, zup.avail_out, (int) zup.total_out);
 
+# ifdef VERBOSE
     char *outdata = (char *) outbuf;
     fprintf (stderr, "unc: ");
@@ -101,15 +106,15 @@
     }
     fprintf (stderr, "\n");
+# endif
 
     assert (zup.total_out <= NTGT*sizeof(double));
 
-    fprintf (stderr, "result: %d bytes\n", (int) zup.total_out);
+    // fprintf (stderr, "result: %d bytes\n", (int) zup.total_out);
     for (i = 0; 0 && i < zup.total_out / sizeof(double); i++) {
-      fprintf (stderr, "%d : %f : %f\n", i, outbuf[i], srcbuf[i]);
+      // fprintf (stderr, "%d : %f : %f\n", i, outbuf[i], srcbuf[i]);
       assert (outbuf[i] == srcbuf[i]);
     }
   }
-
-  exit (0);
+  return exit_status();
 }
 
@@ -175,5 +180,4 @@
     }
   }
-
-  exit (0);
+  return exit_status();
 }
