IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 3, 2004, 2:39:58 PM (22 years ago)
Author:
gusciora
Message:

Added memory corruption checks to these files.

File:
1 edited

Legend:

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

    r1811 r1946  
    33    allocates the spline data structure.
    44 
    5     XXX: figure out the memory deallocator
    65    XXX: test bounds?
    76 *****************************************************************************/
     
    1312
    1413#define N 10
     14#define LINEAR 1
     15#define CUBIC 3
    1516
    1617int main()
     
    1920    int memLeaks=0;
    2021    int i;
    21     //    int  currentId = psMemGetId();
     22    int  currentId = psMemGetId();
    2223    psSpline1D *tmpSpline;
    2324    psVector *bounds;
     
    2829    printPositiveTestHeader(stdout,
    2930                            "psFunction functions",
    30                             "psSpline1DAlloc()");
     31                            "psSpline1DAllocGeneric(): linear");
    3132    bounds = psVectorAlloc(N+1, PS_TYPE_F32);
    3233    for (i=0;i<N+1;i++) {
     
    3435    }
    3536
    36     tmpSpline = psSpline1DAllocGeneric(bounds, 1);
     37    tmpSpline = psSpline1DAllocGeneric(bounds, LINEAR);
    3738    if (tmpSpline == NULL) {
    3839        printf("ERROR: Could not allocate psSpline1D data structure\n");
     
    5455            testStatus = false;
    5556        }
    56         if ((tmpSpline->spline[i])->n != 2) {
     57        if ((tmpSpline->spline[i])->n != LINEAR+1) {
    5758            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
    5859            testStatus = false;
     
    7172    }
    7273
    73     psFree(tmpSpline);
     74    p_psSpline1DFree(tmpSpline);
     75    psFree(bounds);
    7476    psMemCheckCorruption(1);
    75     //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
     77    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
    7678    if (0 != memLeaks) {
    7779        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
     
    8082    printFooter(stdout,
    8183                "psFunctions functions",
    82                 "psSpline1DAlloc()",
     84                "psSpline1DAllocGeneric(): linear",
    8385                testStatus);
    8486    /****************************************************************************/
     
    8789    printPositiveTestHeader(stdout,
    8890                            "psFunction functions",
    89                             "psSpline1DAlloc()");
     91                            "psSpline1DAllocGeneric(): cubic");
    9092    bounds = psVectorAlloc(N+1, PS_TYPE_F32);
    9193    for (i=0;i<N+1;i++) {
     
    9395    }
    9496
    95     tmpSpline = psSpline1DAllocGeneric(bounds, 3);
     97    tmpSpline = psSpline1DAllocGeneric(bounds, CUBIC);
    9698    if (tmpSpline == NULL) {
    9799        printf("ERROR: Could not allocate psSpline1D data structure\n");
     
    113115            testStatus = false;
    114116        }
    115         if ((tmpSpline->spline[i])->n != 4) {
     117        if ((tmpSpline->spline[i])->n != CUBIC+1) {
    116118            printf("ERROR: Spline created with order %d\n", (tmpSpline->spline[i])->n);
    117119            testStatus = false;
     
    130132    }
    131133
    132     psFree(tmpSpline);
     134    p_psSpline1DFree(tmpSpline);
     135    psFree(bounds);
    133136    psMemCheckCorruption(1);
    134     //    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
     137    memLeaks = psMemCheckLeaks(currentId,NULL,stderr);
    135138    if (0 != memLeaks) {
    136139        psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
     
    139142    printFooter(stdout,
    140143                "psFunctions functions",
    141                 "psSpline1DAlloc()",
     144                "psSpline1DAllocGeneric(): cubic",
    142145                testStatus);
    143146
Note: See TracChangeset for help on using the changeset viewer.