IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2015, 7:58:50 PM (11 years ago)
Author:
eugene
Message:

handle zzero,zscale = 0,1 specially to avoid bitlevel errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/libfits/test/ricetest.c

    r38356 r38399  
    88int main (int argc, char **argv) {
    99 
    10   plan_tests (64);
     10  plan_tests (45);
     11
     12  diag ("libfits ricetest.c tests");
    1113
    1214  // buffers to store max array
     
    1416  char cmpdata[NBYTE];
    1517  char outdata[NBYTE];
     18
     19  if (1) {
     20    char *rawvalue = (char *) rawdata;
     21    char *outvalue = (char *) outdata;
     22
     23    int j;
     24    for (j = 0; j < 5; j++) {
     25      int i;
     26      for (i = 0; i < NPIX; i++) {
     27        rawvalue[i] = i;
     28      }
     29
     30      int Ncmp = fits_rcomp_byte (rawvalue, NPIX, cmpdata, NBYTE, 32);
     31      ok (Ncmp > 0, "compressed byte data");
     32
     33      int status = fits_rdecomp_byte (cmpdata, Ncmp, outdata, NPIX, 32);
     34      ok (!status, "decompressed byte data");
     35
     36      int Nbad = 0;
     37      for (i = 0; i < NPIX; i++) {
     38        if (rawvalue[i] != outvalue[i]) Nbad ++;
     39      }
     40
     41      ok (!Nbad, "values match");
     42    }
     43  }
    1644
    1745  if (1) {
     
    2755
    2856      int Ncmp = fits_rcomp_short (rawvalue, NPIX, cmpdata, NBYTE, 32);
    29       fprintf (stderr, "Ncmp: %d\n", Ncmp);
     57      ok (Ncmp > 0, "compressed short data");
    3058
    3159      int status = fits_rdecomp_short (cmpdata, Ncmp, outdata, NPIX, 32);
    32       fprintf (stderr, "status: %d\n", status);
     60      ok (!status, "decompressed short data");
    3361
    3462      int Nbad = 0;
     
    4169  }
    4270
    43   if (0) {
     71  if (1) {
    4472    int *rawvalue = (int *) rawdata;
    4573    int *outvalue = (int *) outdata;
     
    5381
    5482      int Ncmp = fits_rcomp (rawvalue, NPIX, cmpdata, NBYTE, 32);
    55       fprintf (stderr, "Ncmp: %d\n", Ncmp);
     83      ok (Ncmp > 0, "compressed int data");
    5684
    5785      int status = fits_rdecomp (cmpdata, Ncmp, outdata, NPIX, 32);
    58       fprintf (stderr, "status: %d\n", status);
     86      ok (!status, "decompressed int data");
    5987
    6088      int Nbad = 0;
     
    6290        if (rawvalue[i] != outvalue[i]) Nbad ++;
    6391      }
    64 
    6592      ok (!Nbad, "values match");
    6693    }
    6794  }
    68   exit (0);
     95  return exit_status();
    6996}
Note: See TracChangeset for help on using the changeset viewer.