IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 6, 2004, 11:30:53 AM (22 years ago)
Author:
gusciora
Message:

Vector allocation code.

File:
1 edited

Legend:

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

    r1946 r1982  
    1717#define N 8
    1818
    19 int main()
     19int t00()
    2020{
    2121    int testStatus = true;
     
    6868    return (!testStatus);
    6969}
     70
     71int 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
     123int main()
     124{
     125    t00();
     126    //    t01();
     127}
Note: See TracChangeset for help on using the changeset viewer.