IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 30, 2004, 10:18:37 AM (22 years ago)
Author:
desonia
Message:

Updated psChip/psCell to current SDRS spec.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astronomy/tst_psAstrometry.c

    r2536 r2855  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-11-30 21:47:19 $
     7 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-12-30 20:18:36 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    278278
    279279    /*
    280         2. Call psFPAAlloc with nChips = 0. Verify that the chips array is 
     280        2. Call psFPAAlloc with nChips = 0. Verify that the chips array is
    281281           zero in size and the program execution does not stop.
    282282    */
     
    291291
    292292    /*
    293         3. Call psFPAAlloc with a NULL psExposure. Verify that the program 
     293        3. Call psFPAAlloc with a NULL psExposure. Verify that the program
    294294           execution doe not stop and the exposure attribute is NULL.
    295295    */
     
    303303
    304304    /*
    305         4. Call psFPAAlloc and set all references in the struct to a memory 
    306            buffer. Verify that psFree cleans up all the buffers referenced in 
     305        4. Call psFPAAlloc and set all references in the struct to a memory
     306           buffer. Verify that psFree cleans up all the buffers referenced in
    307307           the struct, i.e., there is no memory leaks generated.
    308308    */
     
    353353
    354354    /*
    355         1. invoke psChipAlloc with nCells > 0 and parentFPA non-NULL. Verify 
     355        1. invoke psChipAlloc with nCells > 0 and parentFPA non-NULL. Verify
    356356           that:
    357357        a. the cells array is of the size nCells and all elements are NULL.
    358         b. parent attribute is set to parentFPA parameter and the ref. count 
     358        b. parent attribute is set to parentFPA parameter and the ref. count
    359359           was incremented.
    360360        c. all other attributes are initialized to NULL or 0.
     
    368368    }
    369369
    370     if (chip->cells->n != 8) {
     370    if (chip->cells->n != 0) {
    371371        psLogMsg(__func__,PS_LOG_ERROR,
    372372                 "psChipAlloc did not set the number of cells properly.");
     373        return 2;
     374    }
     375
     376    if (chip->cells->nalloc != 8) {
     377        psLogMsg(__func__,PS_LOG_ERROR,
     378                 "psChipAlloc did not allocate cell array size properly.");
    373379        return 2;
    374380    }
     
    382388        chip->cells->data[lcv] = psAlloc(4); // to check if these are freed.
    383389    }
     390    chip->cells->n = 8;
    384391
    385392    if (chip->parent != fpa) {
     
    419426        2. invoke psChipAlloc with nCells = 0. Verify that:
    420427        a. execution does not halt
    421         b. the cells array is of the size of zero.   
     428        b. the cells array is of the size of one.
    422429    */
    423430
     
    435442    }
    436443
     444    if (chip2->cells->nalloc != 1) {
     445        psLogMsg(__func__,PS_LOG_ERROR,
     446                 "psChipAlloc did not allocate cell array size properly.");
     447        return 12;
     448    }
     449
    437450    if (chip2->parent != fpa) {
    438451        psLogMsg(__func__,PS_LOG_ERROR,
     
    448461
    449462    /*
    450         3. invoke psChipAlloc with parentFPA = NULL. Verify that parent 
     463        3. invoke psChipAlloc with parentFPA = NULL. Verify that parent
    451464           attribute is NULL and no error is generated.
    452465    */
     
    459472    }
    460473
    461     if (chip3->cells->n != 8) {
     474    if (chip3->cells->n != 0) {
    462475        psLogMsg(__func__,PS_LOG_ERROR,
    463476                 "psChipAlloc did not set the number of cells properly.");
    464477        return 22;
     478    }
     479
     480    if (chip3->cells->nalloc != 8) {
     481        psLogMsg(__func__,PS_LOG_ERROR,
     482                 "psChipAlloc did not allocate cell array properly.");
     483        return 23;
    465484    }
    466485
     
    487506
    488507    psObservatory* obs = psObservatoryAlloc(name,
    489                                             20.7*M_PI/180.0, 156.3*M_PI/180.0, 3055.0, 0.0065f);
    490 
    491     psExposure* exp = psExposureAlloc(1.0, 2.0, 3.0, 4.0, 5.0,
    492                                       now, 6.0f, 260.0f, 1013.0f, 0.7f, 10.0f, 0.650f, obs);
     508                                            20.7*M_PI/180.0,
     509                                            156.3*M_PI/180.0,
     510                                            3055.0,
     511                                            0.0065f);
     512
     513    psExposure* exp = psExposureAlloc(1.0,
     514                                      2.0,
     515                                      3.0,
     516                                      4.0,
     517                                      5.0,
     518                                      now,
     519                                      6.0f,
     520                                      260.0f,
     521                                      1013.0f,
     522                                      0.7f,
     523                                      10.0f,
     524                                      0.650f,
     525                                      obs);
    493526
    494527    psFPA* fpa = psFPAAlloc(8, exp);
     
    507540        1. invoke psCellAlloc with nReadouts > 0 and parentChip non-NULL. Verify that:
    508541        a. the readouts array is of the size nReadouts and all elements are NULL.
    509         b. parent attribute is set to parentChip parameter and the ref. count 
     542        b. parent attribute is set to parentChip parameter and the ref. count
    510543           was incremented.
    511544        c. all other attributes are initialized to NULL or 0.
     
    519552    }
    520553
    521     if (cell1->readouts->n != 8) {
     554    if (cell1->readouts->n != 0) {
    522555        psLogMsg(__func__,PS_LOG_ERROR,
    523556                 "psCellAlloc did not set the number of readouts properly.");
     557        return 2;
     558    }
     559
     560    if (cell1->readouts->nalloc != 8) {
     561        psLogMsg(__func__,PS_LOG_ERROR,
     562                 "psCellAlloc did not allocat the readout array properly.");
    524563        return 2;
    525564    }
     
    533572        cell1->readouts->data[lcv] = psAlloc(4); // to check if these are freed.
    534573    }
     574    cell1->readouts->n = 8;
    535575
    536576    if (cell1->parent != chip) {
     
    584624        2. invoke psChipAlloc with nCells = 0. Verify that:
    585625        a. execution does not halt
    586         b. the cells array is of the size of zero.   
     626        b. the cells array is of the size of one.
    587627    */
    588628
     
    600640    }
    601641
     642    if (cell2->readouts->nalloc != 1) {
     643        psLogMsg(__func__,PS_LOG_ERROR,
     644                 "psCellAlloc did not allocate the readout array properly.");
     645        return 13;
     646    }
     647
    602648    if (cell2->parent != chip) {
    603649        psLogMsg(__func__,PS_LOG_ERROR,
     
    613659
    614660    /*
    615         3. invoke psChipAlloc with parentFPA = NULL. Verify that parent 
     661        3. invoke psChipAlloc with parentFPA = NULL. Verify that parent
    616662           attribute is NULL and no error is generated.
    617663    */
     
    624670    }
    625671
    626     if (cell3->readouts->n != 8) {
     672    if (cell3->readouts->n != 0) {
    627673        psLogMsg(__func__,PS_LOG_ERROR,
    628674                 "psCellAlloc did not set the number of cells properly.");
    629675        return 22;
     676    }
     677
     678    if (cell3->readouts->nalloc != 8) {
     679        psLogMsg(__func__,PS_LOG_ERROR,
     680                 "psCellAlloc did not set the number of cells properly.");
     681        return 23;
    630682    }
    631683
     
    647699static psS32 testReadoutAlloc(void)
    648700{
    649     psImage* image = psImageAlloc(64,64,PS_TYPE_S8);
    650 
    651 
    652     /*
    653         1. invoke psReadoutAlloc with unique/non-zero x0,y0 and non-NULL image. Verify that:
    654         a. col0 & row0 are set to the parameters x0 and y0, respectively.
    655         b. image attribute is set to image parameter and referenece is incremented
    656         c. mask, objects, and metadata attributes are all NULL
    657     */
    658     psReadout* readout = psReadoutAlloc(1,2,image);
     701    psReadout* readout = psReadoutAlloc();
    659702
    660703    if (readout == NULL) {
     
    663706    }
    664707
    665     if (readout->col0 != 1) {
     708    if (readout->col0 != 0) {
    666709        psLogMsg(__func__,PS_LOG_ERROR,
    667710                 "psReadoutAlloc did not set col0 properly.");
     
    669712    }
    670713
    671     if (readout->row0 != 2) {
     714    if (readout->row0 != 0) {
    672715        psLogMsg(__func__,PS_LOG_ERROR,
    673716                 "psReadoutAlloc did not set row0 properly.");
     
    675718    }
    676719
    677     if (readout->image != image) {
     720    if (readout->image != NULL) {
    678721        psLogMsg(__func__,PS_LOG_ERROR,
    679722                 "psReadoutAlloc did not set the image properly.");
     
    681724    }
    682725
    683     if (psMemGetRefCounter(image) != 1) {
    684         psLogMsg(__func__,PS_LOG_ERROR,
    685                  "psReadoutAlloc incremented reference counter for image.");
    686         return 5;
    687     }
     726    readout->image = psAlloc(4); // to check if these are freed.
    688727
    689728    if (readout->metadata != NULL) {
Note: See TracChangeset for help on using the changeset viewer.