Changeset 1982 for trunk/psLib/test/dataManip/tst_psFunc04.c
- Timestamp:
- Oct 6, 2004, 11:30:53 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/dataManip/tst_psFunc04.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataManip/tst_psFunc04.c
r1946 r1982 17 17 #define N 8 18 18 19 int main()19 int t00() 20 20 { 21 21 int testStatus = true; … … 68 68 return (!testStatus); 69 69 } 70 71 int t01() 72 { 73 int testStatus = true; 74 int memLeaks=0; 75 int i; 76 float x; 77 float y; 78 int currentId = psMemGetId(); 79 psSpline1D *tmpSpline; 80 psVector *data; 81 82 psTraceSetLevel(".", 0); 83 84 /****************************************************************************/ 85 /****************************************************************************/ 86 testStatus = true; 87 printPositiveTestHeader(stdout, 88 "psFunction functions", 89 "psSpline1DAlloc()"); 90 data = psVectorAlloc(N+1, PS_TYPE_F32); 91 tmpSpline = psSpline1DAlloc(N, 1, 1.0, 10.0); 92 93 for (i=0;i<N+1;i++) { 94 data->data.F32[i] = tmpSpline->domains[i]; 95 } 96 psVectorFitSpline1D(tmpSpline, data, data, NULL); 97 98 for (i=0;i<N+1;i++) { 99 x = 0.5 + (float) i+1; 100 y = psSpline1DEval(tmpSpline, x); 101 if (fabs(x-y) > FLT_EPSILON) { 102 printf("ERROR: f(%f) is %f\n", x, y); 103 testStatus = true; 104 } 105 } 106 107 p_psSpline1DFree(tmpSpline); 108 psMemCheckCorruption(1); 109 psFree(data); 110 memLeaks = psMemCheckLeaks(currentId,NULL,stderr); 111 if (0 != memLeaks) { 112 psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks); 113 } 114 115 printFooter(stdout, 116 "psFunctions functions", 117 "psSpline1DAlloc()", 118 testStatus); 119 120 return (!testStatus); 121 } 122 123 int main() 124 { 125 t00(); 126 // t01(); 127 }
Note:
See TracChangeset
for help on using the changeset viewer.
