Changeset 1782 for trunk/psLib/test/dataManip/tst_psFunc04.c
- Timestamp:
- Sep 10, 2004, 12:52:22 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/dataManip/tst_psFunc04.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataManip/tst_psFunc04.c
r1781 r1782 1 1 /***************************************************************************** 2 This routine must ensure that the psSpline1DAlloc() function properly 3 allocates the spline data structure. 2 This routine must ensure that the psSpline1DEval() function works 3 properly. It creates a spline with psSpline1DAlloc(), creates a set of 4 data values, sets the spline polynomials with psSpline1DGen(), then 5 calls psSpline1DEval() on new data values and ensures that the results 6 are correct. 4 7 5 8 XXX: figure out the memory deallocator 6 9 *****************************************************************************/ 7 10 #include <stdio.h> 11 #include <math.h> 8 12 #include "pslib.h" 9 13 #include "psTest.h" … … 18 22 int memLeaks=0; 19 23 int i; 20 float tmp; 24 float x; 25 float y; 21 26 // int currentId = psMemGetId(); 22 27 psSpline1D *tmpSpline; … … 33 38 tmpSpline = psSpline1DAlloc(N, 1, 1.0, 10.0); 34 39 35 36 for (i=0;i<N+1;i++) {37 printf("tmpSpline->domains[%d] is %f\n", i, tmpSpline->domains[i]);38 }39 40 40 for (i=0;i<N+1;i++) { 41 41 data->data.F32[i] = tmpSpline->domains[i]; … … 44 44 psSpline1DGen(tmpSpline, data); 45 45 for (i=0;i<N+1;i++) { 46 tmp = psSpline1DEval(tmpSpline, (float) i+1); 47 printf("%f -> %f\n", (float) i+1, tmp); 46 x = 0.5 + (float) i+1; 47 y = psSpline1DEval(tmpSpline, x); 48 if (fabs(x-y) > FLT_EPSILON) { 49 printf("ERROR: f(%f) is %f\n", x, y); 50 testStatus = true; 51 } 48 52 } 49 53
Note:
See TracChangeset
for help on using the changeset viewer.
