Changeset 2054
- Timestamp:
- Oct 12, 2004, 9:28:40 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astronomy/tst_psAstrometry.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psAstrometry.c
r2052 r2054 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10-12 19: 10:00 $7 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-12 19:28:40 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 21 21 static int testFPAAlloc(void); 22 22 static int testChipAlloc(void); 23 static int testCellAlloc(void); 23 24 24 25 testDescription tests[] = { … … 27 28 {testFPAAlloc,739,"psFPAAlloc",0,false}, 28 29 {testChipAlloc,740,"psChipAlloc",0,false}, 30 {testCellAlloc,741,"psCellAlloc",0,false}, 29 31 {NULL} 30 32 }; … … 468 470 return 0; 469 471 } 472 473 static int testCellAlloc(void) 474 { 475 char* name = "The Kaiser Royal Observatory"; 476 477 psTime* now = psTimeGetTime(PS_TIME_UTC); 478 479 psObservatory* obs = psObservatoryAlloc(name, 480 20.7*M_PI/180.0, 156.3*M_PI/180.0, 3055.0, 0.0065f); 481 482 psExposure* exp = psExposureAlloc(1.0, 2.0, 3.0, 4.0, 5.0, 483 now, 6.0f, 260.0f, 1013.0f, 0.7f, 10.0f, 0.650f, obs); 484 485 psFPA* fpa = psFPAAlloc(8, exp); 486 487 psChip* chip = psChipAlloc(8, fpa); 488 489 // N.B. psChipAlloc made a reference to any of these that it is 490 // referencing, so these are not actually freed here. Just 491 // these references to the buffers are freed. 492 psFree(fpa); 493 psFree(exp); 494 psFree(obs); 495 psFree(now); 496 497 /* 498 1. invoke psCellAlloc with nReadouts > 0 and parentChip non-NULL. Verify that: 499 a. the readouts array is of the size nReadouts and all elements are NULL. 500 b. parent attribute is set to parentChip parameter and the ref. count 501 was incremented. 502 c. all other attributes are initialized to NULL or 0. 503 */ 504 505 psCell* cell1 = psCellAlloc(8,chip); 506 507 if (cell1 == NULL) { 508 psLogMsg(__func__,PS_LOG_ERROR,"psCellAlloc returned NULL."); 509 return 1; 510 } 511 512 if (cell1->readouts->n != 8) { 513 psLogMsg(__func__,PS_LOG_ERROR, 514 "psCellAlloc did not set the number of readouts properly."); 515 return 2; 516 } 517 518 for (int lcv=0; lcv < 8; lcv++) { 519 if (cell1->readouts->data[lcv] != NULL) { 520 psLogMsg(__func__,PS_LOG_ERROR, 521 "psCellAlloc did not set readout %d to NULL.", lcv); 522 return 3; 523 } 524 } 525 526 if (cell1->parent != chip) { 527 psLogMsg(__func__,PS_LOG_ERROR, 528 "psCellAlloc did not set the parent properly."); 529 return 4; 530 } 531 532 if (psMemGetRefCounter(chip) != 2) { 533 psLogMsg(__func__,PS_LOG_ERROR, 534 "psCellAlloc did not increment reference counter for parent."); 535 return 5; 536 } 537 538 if (cell1->metadata != NULL) { 539 psLogMsg(__func__,PS_LOG_ERROR, 540 "psCellAlloc did not set metadata to NULL."); 541 return 6; 542 } 543 544 if (cell1->toChip != NULL) { 545 psLogMsg(__func__,PS_LOG_ERROR, 546 "psCellAlloc did not set toChip to NULL."); 547 return 7; 548 } 549 550 if (cell1->fromChip != NULL) { 551 psLogMsg(__func__,PS_LOG_ERROR, 552 "psCellAlloc did not set fromChip to NULL."); 553 return 8; 554 } 555 556 if (cell1->toFPA != NULL) { 557 psLogMsg(__func__,PS_LOG_ERROR, 558 "psCellAlloc did not set toFPA to NULL."); 559 return 9; 560 } 561 562 if (cell1->toTP != NULL) { 563 psLogMsg(__func__,PS_LOG_ERROR, 564 "psCellAlloc did not set toTP to NULL."); 565 return 10; 566 } 567 568 /* 569 2. invoke psChipAlloc with nCells = 0. Verify that: 570 a. execution does not halt 571 b. the cells array is of the size of zero. 572 */ 573 574 psCell* cell2 = psCellAlloc(0,chip); 575 576 if (cell2 == NULL) { 577 psLogMsg(__func__,PS_LOG_ERROR,"psCellAlloc returned NULL."); 578 return 11; 579 } 580 581 if (cell2->readouts->n != 0) { 582 psLogMsg(__func__,PS_LOG_ERROR, 583 "psCellAlloc did not set the number of readouts properly."); 584 return 12; 585 } 586 587 if (cell2->parent != chip) { 588 psLogMsg(__func__,PS_LOG_ERROR, 589 "psCellAlloc did not set the parent properly."); 590 return 14; 591 } 592 593 if (psMemGetRefCounter(chip) != 3) { 594 psLogMsg(__func__,PS_LOG_ERROR, 595 "psCellAlloc did not increment reference counter for parent FPA."); 596 return 15; 597 } 598 599 /* 600 3. invoke psChipAlloc with parentFPA = NULL. Verify that parent 601 attribute is NULL and no error is generated. 602 */ 603 604 psCell* cell3 = psCellAlloc(8,NULL); 605 606 if (cell3 == NULL) { 607 psLogMsg(__func__,PS_LOG_ERROR,"psCellAlloc returned NULL."); 608 return 21; 609 } 610 611 if (cell3->readouts->n != 8) { 612 psLogMsg(__func__,PS_LOG_ERROR, 613 "psCellAlloc did not set the number of cells properly."); 614 return 22; 615 } 616 617 if (cell3->parent != NULL) { 618 psLogMsg(__func__,PS_LOG_ERROR, 619 "psCellAlloc did not set the parent to NULL."); 620 return 24; 621 } 622 623 psFree(chip); 624 psFree(cell1); 625 psFree(cell2); 626 psFree(cell3); 627 628 return 0; 629 }
Note:
See TracChangeset
for help on using the changeset viewer.
