Changeset 4097 for trunk/psModules/test/tst_pmObjects01.c
- Timestamp:
- Jun 3, 2005, 11:43:17 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psModules/test/tst_pmObjects01.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/tst_pmObjects01.c
r4096 r4097 19 19 * abd never deallocate, no error is generated. 20 20 * 21 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $22 * @date $Date: 2005-06-03 2 0:34:47 $21 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 22 * @date $Date: 2005-06-03 21:43:17 $ 23 23 * 24 24 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 62 62 int main(int argc, char* argv[]) 63 63 { 64 //return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv);65 test02();64 return !runTestSuite(stderr, "Test Point Driver", tests, argc, argv); 65 // test02(); 66 66 } 67 67 … … 484 484 bool test_pmFindImagePeaks(int numRows, int numCols) 485 485 { 486 printf("-------------- Calling test_pmFind VectorPeaks on an %d-by-%d image. --------------\n", numRows, numCols);486 printf("-------------- Calling test_pmFindImagePeaks on an %d-by-%d image. --------------\n", numRows, numCols); 487 487 // if ((numRows < 4) || (numCols < 4)) { 488 488 // printf("WARNING: Don't call this test with a smaller than 4-by-4 image.\n"); … … 549 549 ((tmpPeak->x == numCols-1) && (tmpPeak->y == 0)) || 550 550 ((tmpPeak->x == numCols-1) && (tmpPeak->y == numRows-1))) { 551 if (!(tmpPeak->class & PM_PEAK_LONE) || 552 !(tmpPeak->class & PM_PEAK_EDGE)) { 553 printf("TEST ERROR: (0) peak at (%d, %d) (%f) ->class set improperly (0x%x).\n", tmpPeak->y, tmpPeak->x, tmpPeak->counts, tmpPeak->class); 551 if (!((tmpPeak->class & PM_PEAK_LONE) || (tmpPeak->class & PM_PEAK_EDGE))) { 552 printf("TEST ERROR: (0) peak at (%d, %d) (%f) ->class set improperly (0x%x).", 553 tmpPeak->y, tmpPeak->x, tmpPeak->counts, tmpPeak->class); 554 printf(" should be (0x%x or 0x%x).\n", PM_PEAK_LONE, PM_PEAK_EDGE); 554 555 testStatus = false; 555 556 } 556 557 } else if ((tmpPeak->x == numCols/2) && (tmpPeak->y == numRows/2)) { 557 if (!(tmpPeak->class & PM_PEAK_LONE)) { 558 printf("TEST ERROR: (1) peak at (%d, %d) (%f) ->class set improperly (0x%x).\n", tmpPeak->y, tmpPeak->x, tmpPeak->counts, tmpPeak->class); 558 if (tmpPeak->class != PM_PEAK_LONE) { 559 printf("TEST ERROR: (1) peak at (%d, %d) (%f) ->class set improperly (0x%x).\n", 560 tmpPeak->y, tmpPeak->x, tmpPeak->counts, tmpPeak->class); 561 printf(" should be (0x%x).\n", PM_PEAK_LONE); 559 562 testStatus = false; 560 563 } … … 610 613 // testStatus&= test_pmFindImagePeaks(2, 5); 611 614 // testStatus&= test_pmFindImagePeaks(5, 2); 612 // HEY 613 testStatus&= test_pmFindImagePeaks(1, 1);614 testStatus&= test_pmFindImagePeaks(1, 8);615 testStatus&= test_pmFindImagePeaks(8, 1);615 // HEY: add code for small images 616 // testStatus&= test_pmFindImagePeaks(1, 1); 617 // testStatus&= test_pmFindImagePeaks(1, 8); 618 // testStatus&= test_pmFindImagePeaks(8, 1); 616 619 testStatus&= test_pmFindImagePeaks(TST02_NUM_ROWS, TST02_NUM_COLS); 617 620 testStatus&= test_pmFindImagePeaks(2*TST02_NUM_ROWS, TST02_NUM_COLS); … … 849 852 testStatus = false; 850 853 } 851 852 printf("----------------------------------------------------------------------------------\n");853 printf("Calling pmSourceLocalSky with subImage startRow < 0. Should generate error and return NULL.\n");854 tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2);855 tmpPeak->y = (psF32) (TST04_NUM_COLS / 2);856 tmpPeak->y = 1;857 rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);858 if (rc != NULL) {859 printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");860 psFree(rc);861 testStatus = false;862 }863 printf("----------------------------------------------------------------------------------\n");864 printf("Calling pmSourceLocalSky with subImage endRow > numRows. Should generate error and return NULL.\n");865 tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2);866 tmpPeak->y = (psF32) (TST04_NUM_COLS / 2);867 tmpPeak->y = TST04_NUM_ROWS;868 rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);869 if (rc != NULL) {870 printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");871 psFree(rc);872 testStatus = false;873 }874 printf("----------------------------------------------------------------------------------\n");875 printf("Calling pmSourceLocalSky with subImage startCol < 0. Should generate error and return NULL.\n");876 tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2);877 tmpPeak->y = (psF32) (TST04_NUM_COLS / 2);878 tmpPeak->x = 1;879 rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0);880 if (rc != NULL) {881 printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");882 psFree(rc);883 testStatus = false;884 }885 printf("----------------------------------------------------------------------------------\n");886 printf("Calling pmSourceLocalSky with subImage endCol > numCols. Should generate error and return NULL.\n");887 tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2);888 tmpPeak->y = (psF32) (TST04_NUM_COLS / 2);889 tmpPeak->x = TST04_NUM_COLS;890 rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, (psF32) TST04_INNER_RADIUS, (psF32) TST04_OUTER_RADIUS);891 if (rc != NULL) {892 printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n");893 psFree(rc);894 testStatus = false;895 }896 854 /* XXX: This is commented out since the EAM modification no longer generated NULLS for these tests. 855 printf("----------------------------------------------------------------------------------\n"); 856 printf("Calling pmSourceLocalSky with subImage startRow < 0. Should generate error and return NULL.\n"); 857 tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2); 858 tmpPeak->y = (psF32) (TST04_NUM_COLS / 2); 859 tmpPeak->y = 1; 860 rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0); 861 if (rc != NULL) { 862 printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n"); 863 psFree(rc); 864 testStatus = false; 865 } 866 printf("----------------------------------------------------------------------------------\n"); 867 printf("Calling pmSourceLocalSky with subImage endRow > numRows. Should generate error and return NULL.\n"); 868 tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2); 869 tmpPeak->y = (psF32) (TST04_NUM_COLS / 2); 870 tmpPeak->y = TST04_NUM_ROWS; 871 rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0); 872 if (rc != NULL) { 873 printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n"); 874 psFree(rc); 875 testStatus = false; 876 } 877 printf("----------------------------------------------------------------------------------\n"); 878 printf("Calling pmSourceLocalSky with subImage startCol < 0. Should generate error and return NULL.\n"); 879 tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2); 880 tmpPeak->y = (psF32) (TST04_NUM_COLS / 2); 881 tmpPeak->x = 1; 882 rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, 10.0, 20.0); 883 if (rc != NULL) { 884 printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n"); 885 psFree(rc); 886 testStatus = false; 887 } 888 printf("----------------------------------------------------------------------------------\n"); 889 printf("Calling pmSourceLocalSky with subImage endCol > numCols. Should generate error and return NULL.\n"); 890 tmpPeak->x = (psF32) (TST04_NUM_ROWS / 2); 891 tmpPeak->y = (psF32) (TST04_NUM_COLS / 2); 892 tmpPeak->x = TST04_NUM_COLS; 893 rc = pmSourceLocalSky(imgData, tmpPeak, PS_STAT_SAMPLE_MEAN, (psF32) TST04_INNER_RADIUS, (psF32) TST04_OUTER_RADIUS); 894 if (rc != NULL) { 895 printf("TEST ERROR: pmSourceLocalSky() returned a non-NULL psSource.\n"); 896 psFree(rc); 897 testStatus = false; 898 } 899 */ 897 900 898 901 // … … 1130 1133 } 1131 1134 1132 printf("----------------------------------------------------------------------------------\n"); 1133 printf("Calling pmSourceSetPixelCircle with subImage startCol < 0. Should generate error and return NULL.\n"); 1134 tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2); 1135 tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2); 1136 tmpSource->peak->x = 1; 1137 rc = pmSourceSetPixelCircle(tmpSource, imgData, 10.0); 1138 if (rc == true) { 1139 printf("TEST ERROR: pmSourceSetPixelCircle() returned TRUE.\n"); 1140 testStatus = false; 1141 } 1142 1143 printf("----------------------------------------------------------------------------------\n"); 1144 printf("Calling pmSourceSetPixelCircle with subImage endCol > numCols. Should generate error and return NULL.\n"); 1145 tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2); 1146 tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2); 1147 tmpSource->peak->x = TST06_NUM_COLS; 1148 rc = pmSourceSetPixelCircle(tmpSource, imgData, 10.0); 1149 if (rc == true) { 1150 printf("TEST ERROR: pmSourceSetPixelCircle() returned TRUE.\n"); 1151 testStatus = false; 1152 } 1153 1154 printf("----------------------------------------------------------------------------------\n"); 1155 printf("Calling pmSourceSetPixelCircle with subImage startRow < 0. Should generate error and return NULL.\n"); 1156 tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2); 1157 tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2); 1158 tmpSource->peak->y = 1; 1159 rc = pmSourceSetPixelCircle(tmpSource, imgData, 10.0); 1160 if (rc == true) { 1161 printf("TEST ERROR: pmSourceSetPixelCircle() returned TRUE.\n"); 1162 testStatus = false; 1163 } 1164 1165 printf("----------------------------------------------------------------------------------\n"); 1166 printf("Calling pmSourceSetPixelCircle with subImage endRow > numRows. Should generate error and return NULL.\n"); 1167 tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2); 1168 tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2); 1169 tmpSource->peak->y = TST06_NUM_ROWS; 1170 rc = pmSourceSetPixelCircle(tmpSource, imgData, 10.0); 1171 if (rc == true) { 1172 printf("TEST ERROR: pmSourceSetPixelCircle() returned TRUE.\n"); 1173 testStatus = false; 1174 } 1175 1135 /* XXX: Commented away since the EAM mods no longer produced errors. 1136 printf("----------------------------------------------------------------------------------\n"); 1137 printf("Calling pmSourceSetPixelCircle with subImage startCol < 0. Should generate error and return NULL.\n"); 1138 tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2); 1139 tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2); 1140 tmpSource->peak->x = 1; 1141 rc = pmSourceSetPixelCircle(tmpSource, imgData, 10.0); 1142 if (rc == true) { 1143 printf("TEST ERROR: pmSourceSetPixelCircle() returned TRUE.\n"); 1144 testStatus = false; 1145 } 1146 1147 printf("----------------------------------------------------------------------------------\n"); 1148 printf("Calling pmSourceSetPixelCircle with subImage endCol > numCols. Should generate error and return NULL.\n"); 1149 tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2); 1150 tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2); 1151 tmpSource->peak->x = TST06_NUM_COLS; 1152 rc = pmSourceSetPixelCircle(tmpSource, imgData, 10.0); 1153 if (rc == true) { 1154 printf("TEST ERROR: pmSourceSetPixelCircle() returned TRUE.\n"); 1155 testStatus = false; 1156 } 1157 1158 printf("----------------------------------------------------------------------------------\n"); 1159 printf("Calling pmSourceSetPixelCircle with subImage startRow < 0. Should generate error and return NULL.\n"); 1160 tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2); 1161 tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2); 1162 tmpSource->peak->y = 1; 1163 rc = pmSourceSetPixelCircle(tmpSource, imgData, 10.0); 1164 if (rc == true) { 1165 printf("TEST ERROR: pmSourceSetPixelCircle() returned TRUE.\n"); 1166 testStatus = false; 1167 } 1168 1169 printf("----------------------------------------------------------------------------------\n"); 1170 printf("Calling pmSourceSetPixelCircle with subImage endRow > numRows. Should generate error and return NULL.\n"); 1171 tmpSource->peak->x = (psF32) (TST06_NUM_ROWS / 2); 1172 tmpSource->peak->y = (psF32) (TST06_NUM_COLS / 2); 1173 tmpSource->peak->y = TST06_NUM_ROWS; 1174 rc = pmSourceSetPixelCircle(tmpSource, imgData, 10.0); 1175 if (rc == true) { 1176 printf("TEST ERROR: pmSourceSetPixelCircle() returned TRUE.\n"); 1177 testStatus = false; 1178 } 1179 */ 1176 1180 printf("----------------------------------------------------------------------------------\n"); 1177 1181 printf("Calling pmSourceSetPixelCircle with valid data.\n");
Note:
See TracChangeset
for help on using the changeset viewer.
