Changeset 1946 for trunk/psLib/test/dataManip/tst_psFunc03.c
- Timestamp:
- Oct 3, 2004, 2:39:58 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/dataManip/tst_psFunc03.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataManip/tst_psFunc03.c
r1811 r1946 3 3 allocates the spline data structure. 4 4 5 XXX: figure out the memory deallocator6 5 XXX: test bounds? 7 6 *****************************************************************************/ … … 13 12 14 13 #define N 10 14 #define LINEAR 1 15 #define CUBIC 3 15 16 16 17 int main() … … 19 20 int memLeaks=0; 20 21 int i; 21 //int currentId = psMemGetId();22 int currentId = psMemGetId(); 22 23 psSpline1D *tmpSpline; 23 24 psVector *bounds; … … 28 29 printPositiveTestHeader(stdout, 29 30 "psFunction functions", 30 "psSpline1DAlloc ()");31 "psSpline1DAllocGeneric(): linear"); 31 32 bounds = psVectorAlloc(N+1, PS_TYPE_F32); 32 33 for (i=0;i<N+1;i++) { … … 34 35 } 35 36 36 tmpSpline = psSpline1DAllocGeneric(bounds, 1);37 tmpSpline = psSpline1DAllocGeneric(bounds, LINEAR); 37 38 if (tmpSpline == NULL) { 38 39 printf("ERROR: Could not allocate psSpline1D data structure\n"); … … 54 55 testStatus = false; 55 56 } 56 if ((tmpSpline->spline[i])->n != 2) {57 if ((tmpSpline->spline[i])->n != LINEAR+1) { 57 58 printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n); 58 59 testStatus = false; … … 71 72 } 72 73 73 psFree(tmpSpline); 74 p_psSpline1DFree(tmpSpline); 75 psFree(bounds); 74 76 psMemCheckCorruption(1); 75 //memLeaks = psMemCheckLeaks(currentId,NULL,stderr);77 memLeaks = psMemCheckLeaks(currentId,NULL,stderr); 76 78 if (0 != memLeaks) { 77 79 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); … … 80 82 printFooter(stdout, 81 83 "psFunctions functions", 82 "psSpline1DAlloc ()",84 "psSpline1DAllocGeneric(): linear", 83 85 testStatus); 84 86 /****************************************************************************/ … … 87 89 printPositiveTestHeader(stdout, 88 90 "psFunction functions", 89 "psSpline1DAlloc ()");91 "psSpline1DAllocGeneric(): cubic"); 90 92 bounds = psVectorAlloc(N+1, PS_TYPE_F32); 91 93 for (i=0;i<N+1;i++) { … … 93 95 } 94 96 95 tmpSpline = psSpline1DAllocGeneric(bounds, 3);97 tmpSpline = psSpline1DAllocGeneric(bounds, CUBIC); 96 98 if (tmpSpline == NULL) { 97 99 printf("ERROR: Could not allocate psSpline1D data structure\n"); … … 113 115 testStatus = false; 114 116 } 115 if ((tmpSpline->spline[i])->n != 4) {117 if ((tmpSpline->spline[i])->n != CUBIC+1) { 116 118 printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n); 117 119 testStatus = false; … … 130 132 } 131 133 132 psFree(tmpSpline); 134 p_psSpline1DFree(tmpSpline); 135 psFree(bounds); 133 136 psMemCheckCorruption(1); 134 //memLeaks = psMemCheckLeaks(currentId,NULL,stderr);137 memLeaks = psMemCheckLeaks(currentId,NULL,stderr); 135 138 if (0 != memLeaks) { 136 139 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); … … 139 142 printFooter(stdout, 140 143 "psFunctions functions", 141 "psSpline1DAlloc ()",144 "psSpline1DAllocGeneric(): cubic", 142 145 testStatus); 143 146
Note:
See TracChangeset
for help on using the changeset viewer.
