Changeset 2056
- Timestamp:
- Oct 12, 2004, 9:51:53 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astronomy/tst_psAstrometry.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psAstrometry.c
r2054 r2056 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10-12 19: 28:40$7 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-12 19:51:53 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 22 22 static int testChipAlloc(void); 23 23 static int testCellAlloc(void); 24 static int testReadoutAlloc(void); 24 25 25 26 testDescription tests[] = { … … 29 30 {testChipAlloc,740,"psChipAlloc",0,false}, 30 31 {testCellAlloc,741,"psCellAlloc",0,false}, 32 {testReadoutAlloc,742,"psReadoutAlloc",0,false}, 31 33 {NULL} 32 34 }; … … 376 378 return 3; 377 379 } 380 chip->cells->data[lcv] = psAlloc(4); // to check if these are freed. 378 381 } 379 382 … … 395 398 return 6; 396 399 } 400 chip->metadata = psAlloc(4); // to check if these are freed. 397 401 398 402 if (chip->toFPA != NULL) { … … 401 405 return 7; 402 406 } 407 chip->toFPA = psAlloc(4); // to check if these are freed. 403 408 404 409 if (chip->fromFPA != NULL) { … … 407 412 return 8; 408 413 } 414 chip->fromFPA = psAlloc(4); // to check if these are freed. 409 415 410 416 /* … … 522 528 return 3; 523 529 } 530 cell1->readouts->data[lcv] = psAlloc(4); // to check if these are freed. 524 531 } 525 532 … … 541 548 return 6; 542 549 } 550 cell1->metadata = psAlloc(4); // to check if these are freed. 543 551 544 552 if (cell1->toChip != NULL) { … … 547 555 return 7; 548 556 } 557 cell1->toChip = psAlloc(4); // to check if these are freed. 549 558 550 559 if (cell1->fromChip != NULL) { … … 553 562 return 8; 554 563 } 564 cell1->fromChip = psAlloc(4); // to check if these are freed. 555 565 556 566 if (cell1->toFPA != NULL) { … … 559 569 return 9; 560 570 } 571 cell1->toFPA = psAlloc(4); // to check if these are freed. 561 572 562 573 if (cell1->toTP != NULL) { … … 565 576 return 10; 566 577 } 578 cell1->toTP = psAlloc(4); // to check if these are freed. 567 579 568 580 /* … … 628 640 return 0; 629 641 } 642 643 static int testReadoutAlloc(void) 644 { 645 psImage* image = psImageAlloc(64,64,PS_TYPE_S8); 646 647 648 /* 649 1. invoke psReadoutAlloc with unique/non-zero x0,y0 and non-NULL image. Verify that: 650 a. col0 & row0 are set to the parameters x0 and y0, respectively. 651 b. image attribute is set to image parameter and referenece is incremented 652 c. mask, objects, and metadata attributes are all NULL 653 */ 654 psReadout* readout = psReadoutAlloc(1,2,image); 655 656 if (readout == NULL) { 657 psLogMsg(__func__,PS_LOG_ERROR,"psReadoutAlloc returned NULL."); 658 return 1; 659 } 660 661 if (readout->col0 != 1) { 662 psLogMsg(__func__,PS_LOG_ERROR, 663 "psReadoutAlloc did not set col0 properly."); 664 return 2; 665 } 666 667 if (readout->row0 != 2) { 668 psLogMsg(__func__,PS_LOG_ERROR, 669 "psReadoutAlloc did not set row0 properly."); 670 return 3; 671 } 672 673 if (readout->image != image) { 674 psLogMsg(__func__,PS_LOG_ERROR, 675 "psReadoutAlloc did not set the image properly."); 676 return 4; 677 } 678 679 if (psMemGetRefCounter(image) != 2) { 680 psLogMsg(__func__,PS_LOG_ERROR, 681 "psReadoutAlloc did not increment reference counter for image."); 682 return 5; 683 } 684 685 if (readout->metadata != NULL) { 686 psLogMsg(__func__,PS_LOG_ERROR, 687 "psReadoutAlloc did not set metadata to NULL."); 688 return 6; 689 } 690 readout->metadata = psAlloc(4); // to check if these are freed. 691 692 if (readout->mask != NULL) { 693 psLogMsg(__func__,PS_LOG_ERROR, 694 "psReadoutAlloc did not set mask to NULL."); 695 return 7; 696 } 697 readout->mask = psAlloc(4); // to check if these are freed. 698 699 if (readout->objects != NULL) { 700 psLogMsg(__func__,PS_LOG_ERROR, 701 "psReadoutAlloc did not set objects to NULL."); 702 return 8; 703 } 704 readout->objects = psAlloc(4); // to check if these are freed. 705 706 /* 707 2. invoke psReadoutAlloc with NULL image. Verify that: 708 a. execution does not halt 709 b. the image attribute is NULL. 710 */ 711 712 psReadout* readout2 = psReadoutAlloc(3,4,NULL); 713 714 if (readout2 == NULL) { 715 psLogMsg(__func__,PS_LOG_ERROR,"psReadoutAlloc returned NULL."); 716 return 11; 717 } 718 719 if (readout2->image != NULL) { 720 psLogMsg(__func__,PS_LOG_ERROR,"psReadoutAlloc didn't set image to NULL, as given."); 721 return 12; 722 } 723 724 psFree(readout); 725 psFree(readout2); 726 psFree(image); 727 728 return 0; 729 }
Note:
See TracChangeset
for help on using the changeset viewer.
