next up previous contents FITSIO Home
Next: 2.3 Linking Programs with Up: 2. Creating the CFITSIO Previous: 2.1.4 Macintosh PCs

2.2 Testing the Library

The CFITSIO library should be tested by building and running the testprog.c program that is included with the release. On Unix systems, type:

    % make testprog
    % testprog > testprog.lis
    % diff testprog.lis testprog.out
    % cmp testprog.std
On VMS systems, (assuming cc is the name of the C compiler command), type:

    $ cc testprog.c
    $ link testprog, cfitsio/lib, alpha$library:vaxcrtl/lib
    $ run testprog
The test program should produce a FITS file called `' that is identical to the `testprog.std' FITS file included with this release. The diagnostic messages (which were piped to the file testprog.lis in the Unix example) should be identical to the listing contained in the file testprog.out. The 'diff' and 'cmp' commands shown above should not report any differences in the files. (There may be some minor format differences, such as the presence or absence of leading zeros, or 3 digit exponents in numbers, which can be ignored).

The Fortran wrappers in CFITSIO may be tested with the testf77 program on Unix systems with:

    % f77 -o testf77 testf77.f -L. -lcfitsio -lnsl -lsocket
    % f77 -f -o testf77 testf77.f -L. -lcfitsio    (under SUN O/S)
    % f77 -o testf77 testf77.f -Wl,-L. -lcfitsio -lm -lnsl -lsocket (HP/UX)

    % testf77 > testf77.lis
    % diff testf77.lis testf77.out
    % cmp testf77.std
On machines running SUN O/S, Fortran programs must be compiled with the '-f' option to force double precision variables to be aligned on 8-byte boundarys to make the fortran-declared variables compatible with C. A similar compiler option may be required on other platforms. Failing to use this option may cause the program to crash on FITSIO routines that read or write double precision variables.

Also note that on some systems, the output listing of the testf77 program may differ slightly from the testf77.std template, if leading zeros are not printed by default before the decimal point when using F format.

A few other utility programs are included with CFITSIO; the first four of this programs can be compiled an linked by typing `make program_name' where `program_name' is the actual name of the program:

    speed - measures the maximum throughput (in MB per second)
              for writing and reading FITS files with CFITSIO.

    listhead - lists all the header keywords in any FITS file

    fitscopy - copies any FITS file (especially useful in conjunction
                 with the CFITSIO's extended input filename syntax).

    cookbook - a sample program that performs common read and
                 write operations on a FITS file.

    iter_a, iter_b, iter_c - examples of the CFITSIO iterator routine

next up previous contents FITSIO Home
Next: 2.3 Linking Programs with Up: 2. Creating the CFITSIO Previous: 2.1.4 Macintosh PCs