IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 10, 2004, 12:52:22 PM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/dataManip/tst_psFunc04.c

    r1781 r1782  
    11/*****************************************************************************
    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.
    47 
    58    XXX: figure out the memory deallocator
    69 *****************************************************************************/
    710#include <stdio.h>
     11#include <math.h>
    812#include "pslib.h"
    913#include "psTest.h"
     
    1822    int memLeaks=0;
    1923    int i;
    20     float tmp;
     24    float x;
     25    float y;
    2126    //    int  currentId = psMemGetId();
    2227    psSpline1D *tmpSpline;
     
    3338    tmpSpline = psSpline1DAlloc(N, 1, 1.0, 10.0);
    3439
    35 
    36     for (i=0;i<N+1;i++) {
    37         printf("tmpSpline->domains[%d] is %f\n", i, tmpSpline->domains[i]);
    38     }
    39 
    4040    for (i=0;i<N+1;i++) {
    4141        data->data.F32[i] = tmpSpline->domains[i];
     
    4444    psSpline1DGen(tmpSpline, data);
    4545    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        }
    4852    }
    4953
Note: See TracChangeset for help on using the changeset viewer.