Changeset 15985 for trunk/psModules/test/objects/tap_pmSourceContour.c
- Timestamp:
- Jan 2, 2008, 10:45:23 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/objects/tap_pmSourceContour.c
r15726 r15985 5 5 #include "tap.h" 6 6 #include "pstap.h" 7 // XXX: We only test with unallowable input parameters. 8 7 /* STATUS: 8 XXX: All functions only tested with unallowable input parameters. 9 I tried to use acceptable data, but could not get the source code to work the 10 way I thought it should have. 11 */ 9 12 #define MISC_NUM 32 10 13 #define MISC_NAME "META00" 11 14 #define NUM_BIAS_DATA 10 12 #define TEST_NUM_ROWS (1 6)13 #define TEST_NUM_COLS ( 30)15 #define TEST_NUM_ROWS (10) 16 #define TEST_NUM_COLS (16) 14 17 #define VERBOSE 0 15 #define ERR_TRACE_LEVEL 018 #define ERR_TRACE_LEVEL 10 16 19 #define TEST_FLOATS_EQUAL(X, Y) (abs(X - Y) < 0.0001) 17 20 #define NUM_SOURCES 100 … … 21 24 psLogSetLevel(PS_LOG_INFO); 22 25 psTraceSetLevel("err", ERR_TRACE_LEVEL); 23 plan_tests(1 4);26 plan_tests(11); 24 27 25 28 … … 28 31 // psArray *pmSourceContour (psImage *image, int xc, int yc, float threshold) 29 32 // Call pmSourceContour() with NULL psImage input parameter 30 if (1){33 { 31 34 psMemId id = psMemGetId(); 32 35 psImage *img = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); … … 39 42 40 43 // Call pmSourceContour() with unallowed row/column numbers 41 if (1){44 { 42 45 psMemId id = psMemGetId(); 43 46 psImage *img = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); … … 57 60 58 61 // Call pmSourceContour() with acceptable input parameters 59 if (1) { 62 // XXX: These tests currently fail 63 if (0) { 60 64 psMemId id = psMemGetId(); 61 65 psImage *img = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 62 66 for (int i = 0 ; i < img->numRows ; i++) { 63 67 for (int j = 0 ; j < img->numCols ; j++) { 64 if ((i >= TEST_NUM_ROWS/4) && (i < 3*TEST_NUM_ROWS/4) && 65 (j >= TEST_NUM_COLS/4) && (j < 3*TEST_NUM_COLS/4)) { 66 img->data.F32[i][j] = 5.0; 67 } else { 68 img->data.F32[i][j] = 0.0; 69 } 68 img->data.F32[i][j] = (float) ((TEST_NUM_ROWS + TEST_NUM_COLS) - (abs(i - (TEST_NUM_ROWS/2)) + abs(j - (TEST_NUM_COLS/2)))); 70 69 } 71 70 } 72 if ( 0) {71 if (1) { 73 72 for (int i = 0 ; i < img->numRows ; i++) { 74 73 for (int j = 0 ; j < img->numCols ; j++) { … … 79 78 } 80 79 81 img->data.F32[TEST_NUM_ROWS/2][TEST_NUM_COLS/2] = 5.0; 82 83 psArray *array = pmSourceContour(img, TEST_NUM_COLS/2, TEST_NUM_ROWS/2, 3.0); 80 psArray *array = pmSourceContour(img, TEST_NUM_COLS/2, TEST_NUM_ROWS/2, 22.0); 84 81 ok(array != NULL, "pmSourceContour() returned non-NULL with acceptable input parameters"); 82 for (int i = 0 ; i < array->n ; i++) { 83 psVector *vec = (psVector *) array->data[i]; 84 printf("Point %d: (%.2f %.2f)\n", i, vec->data.F32[0], vec->data.F32[1]); 85 } 85 86 86 87 psFree(array); … … 94 95 // psArray *pmSourceContour_Crude_Crude(pmSource *source, psImage *image, psF32 level) 95 96 // Call pmSourceContour_Crude() with NULL psSource input parameter 96 if (1){97 { 97 98 psMemId id = psMemGetId(); 98 99 pmSource *src = pmSourceAlloc(); … … 122 123 123 124 // Call pmSourceContour_Crude() with NULL psImage input parameter 124 if (1){125 { 125 126 psMemId id = psMemGetId(); 126 127 pmSource *src = pmSourceAlloc(); … … 150 151 151 152 // Call pmSourceContour_Crude() with acceptable input parameters 152 if (1) { 153 // XXX: Must correct this 154 if (0) { 153 155 psMemId id = psMemGetId(); 154 156 pmSource *src = pmSourceAlloc(); … … 159 161 psImage *img = psImageAlloc(TEST_NUM_COLS, TEST_NUM_ROWS, PS_TYPE_F32); 160 162 161 if (0) for (int i = 0 ; i < img->numRows ; i++) { 162 for (int j = 0 ; j < img->numCols ; j++) { 163 if ((i >= TEST_NUM_ROWS/4) && (i < 3*TEST_NUM_ROWS/4) && 164 (j >= TEST_NUM_COLS/4) && (j < 3*TEST_NUM_COLS/4)) { 165 img->data.F32[i][j] = 5.0; 166 } else { 167 img->data.F32[i][j] = 0.0; 163 if (0) { 164 for (int i = 0 ; i < img->numRows ; i++) { 165 for (int j = 0 ; j < img->numCols ; j++) { 166 img->data.F32[i][j] = (float) ((TEST_NUM_ROWS + TEST_NUM_COLS) - (abs(i - (TEST_NUM_ROWS/2)) + abs(j - (TEST_NUM_COLS/2)))); 168 167 } 169 168 } 170 169 } 171 // psArray *array = pmSourceContour_Crude(src, img, 3.0); 172 // ok(array != NULL, "pmSourceContour_Crude() returned non-NULL with NULL pmImage input parameter"); 170 printf("Calling pmSourceContour_Crude()\n"); 171 psArray *array = pmSourceContour_Crude(src, img, 22.0); 172 printf("Called pmSourceContour_Crude()\n"); 173 ok(array != NULL, "pmSourceContour_Crude() returned non-NULL with NULL pmImage input parameter"); 173 174 psFree(img); 174 175 psFree(src); … … 176 177 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 177 178 } 178 179 180 181 179 }
Note:
See TracChangeset
for help on using the changeset viewer.
