IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 12, 2005, 11:52:24 AM (21 years ago)
Author:
desonia
Message:

merged post-release fixes from CVS main.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/rel9/psModules/test/astrom/tst_pmAstrometry01.c

    r5681 r5768  
    11/** @file  tst_psAstrometry01.c
    2 *
    3 *  @brief This code will test the pmFPA hierarchy transform code in psAstrometry.[ch]
    4 *
    5 *  @author GLG, MHPCC
    6 *
    7 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    8 *  @date $Date: 2005-12-05 21:28:55 $
    9 *
    10 * XXX: Add tests were the coordinate does not transform to any legitimate cell
    11 * or chip, or FPA, or whatever.
    12 *
    13 * XXX: For each function, add tests for bad input parameters, as well as failed transforms.
    14 *
    15 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    16 */
     2 *
     3 *  @brief This code will test the pmFPA hierarchy transform code in psAstrometry.[ch]
     4 *
     5 *  @author GLG, MHPCC
     6 *
     7 *  @version $Revision: 1.2.2.1 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-12-12 21:52:24 $
     9 *
     10 * XXX: Add tests were the coordinate does not transform to any legitimate cell
     11 * or chip, or FPA, or whatever.
     12 *
     13 * XXX: For each function, add tests for bad input parameters, as well as failed transforms.
     14 *
     15 * XXX: Must test pmFPASelectChip() and pmFPAExcludeChip().
     16 *
     17 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     18 */
     19
    1720#include "config.h"
    1821#include <math.h>
     
    2326static psS32 test3( void );
    2427static psS32 test4( void );
     28static psS32 test5( void );
    2529
    2630testDescription tests[] = {
    2731                              {test3, -3, "pmAstrometry focal plane transformations", 0, false},
    2832                              {test4, -3, "pmCheckParents()", 0, false},
     33                              {test5, -3, "pmFPASelectChip() and pmFPAExcludeChip()", 0, false},
    2934                              {NULL}
    3035                          };
     
    584589    return(testStatus);
    585590}
     591
     592/******************************************************************************
     593test5(): This routine wil test the pmFPASelectChip() and pmFPAExcludeChip()
     594functions.  We generate an pmFPA hierarchy, then set the ->valid members with
     595those routines, then verify.
     596 *****************************************************************************/
     597psS32 test5( void )
     598{
     599    psS32 testStatus = 0;
     600    pmChip *tmpChip = NULL;
     601
     602    //
     603    // Generate a pmFPA hierarchy.
     604    //
     605    pmFPA *tmpFPA = genSystem();
     606
     607    //
     608    // We test the ->valid member for each chip.
     609    //
     610    for (psS32 i = 0 ; i < tmpFPA->chips->n ; i++) {
     611        tmpChip = (pmChip *) tmpFPA->chips->data[i];
     612        if ((tmpChip == NULL) || (tmpChip->valid != false)) {
     613            printf("TEST ERROR: Could not properly generate an FPA hierarchy.\n");
     614            testStatus = 1;
     615        }
     616    }
     617
     618    //
     619    // Exclude chip number 0, include all others, then test return value
     620    //
     621    psS32 numChips = pmFPAExcludeChip(tmpFPA, 0);
     622    if (numChips != (NUM_CHIPS-1)) {
     623        printf("TEST ERROR: pmFPAExcludeChip() did not return the correct number of chips.\n");
     624        testStatus = 2;
     625    }
     626
     627    //
     628    // We test the ->valid member for each chip.
     629    //
     630    tmpChip = (pmChip *) tmpFPA->chips->data[0];
     631    if (tmpChip->valid != false) {
     632        printf("TEST ERROR: pmFPAExcludeChip() did not set the proper chip->valid to FALSE.\n");
     633        testStatus = 3;
     634    }
     635    for (psS32 i = 1 ; i < tmpFPA->chips->n ; i++) {
     636        pmChip *tmpChip = (pmChip *) tmpFPA->chips->data[i];
     637        if (tmpChip->valid != true) {
     638            printf("TEST ERROR: pmFPAExcludeChip() did not set the proper chip->valids to FALSE.\n");
     639            testStatus = 4;
     640        }
     641    }
     642
     643
     644    //
     645    // Include chip number 0, exclude all others, then test return value
     646    //
     647    psBool tmpBool = pmFPASelectChip(tmpFPA, 0);
     648    if (tmpBool != true) {
     649        printf("TEST ERROR: pmFPASelectChip() returned FALSE.\n");
     650        testStatus = 5;
     651    }
     652
     653    //
     654    // We test the ->valid member for each chip.
     655    //
     656    tmpChip = (pmChip *) tmpFPA->chips->data[0];
     657    if (tmpChip->valid != true) {
     658        printf("TEST ERROR: pmFPASelectChip() did not set the proper chip->valid to FALSE.\n");
     659        testStatus = 6;
     660    }
     661    for (psS32 i = 1 ; i < tmpFPA->chips->n ; i++) {
     662        pmChip *tmpChip = (pmChip *) tmpFPA->chips->data[i];
     663        if (tmpChip->valid != false) {
     664            printf("TEST ERROR: pmFPASelectChip() did not set the proper chip->valids to FALSE.\n");
     665            testStatus = 7;
     666        }
     667    }
     668
     669    psFree(tmpFPA);
     670    return(testStatus);
     671}
Note: See TracChangeset for help on using the changeset viewer.