IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 7, 2005, 11:15:14 AM (21 years ago)
Author:
evanalst
Message:

Update allocation test cases.

File:
1 edited

Legend:

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

    r3382 r3383  
    1111*    are good.
    1212*
    13 *    @version $Revision: 1.18 $  $Name: not supported by cvs2svn $
    14 *    @date $Date: 2005-03-07 21:00:03 $
     13*    @version $Revision: 1.19 $  $Name: not supported by cvs2svn $
     14*    @date $Date: 2005-03-07 21:15:13 $
    1515*
    1616*  Copyright 2004-2005 Maui High Performance Computing Center, Univ. of Hawaii
     
    2020#include "pslib.h"
    2121#include "psTest.h"
    22 #include "psMemory.h"
    23 #include "psFunctions.h"
    2422
    2523// Defines
    2624#define ORDER    3
    27 
    28 
    29 #define MISC_FLOAT_NUMBER 345.0
    30 #define MISC_X_VALUE 5.0
    31 #define MISC_X_CHEB_VALUE 0.5
    32 #define MISC_INT_NUMBER 35
    33 #define AN 2
    34 #define BN 4
    35 #define CN 6
    36 #define DN 8
    37 
    38 static psS32 t01(void);
    3925
    4026static psS32 testPolynomial1DAlloc(void);
     
    5642                              {testDPolynomial3DAlloc,579,"psDPolynomial3DAlloc",0,false},
    5743                              {testDPolynomial4DAlloc,579,"psDPolynomial4DAlloc",0,false},
    58                               {t01,0000,"psPolynomial1DAlloc",0,false},
    5944                              {NULL}
    6045                          };
     
    653638}
    654639
    655 
    656 // XXX: This test comes from Paul Price.  We should add into the code.
    657 #define ORDER 3
    658 #define BAD 1
    659 psS32 t01(void)
    660 {
    661     psPolynomial1D *poly = psPolynomial1DAlloc(ORDER, PS_POLYNOMIAL_ORD);
    662 
    663     for (int i = 0; i < poly->n; i++) {
    664         poly->coeff[i] = (float)i;
    665         if (i == BAD) {
    666             poly->mask[i] = 1;  // Don't use this coefficient!
    667         } else {
    668             poly->mask[i] = 0;
    669         }
    670     }
    671 
    672     fprintf(stderr,"Value using mask: %f\n", psPolynomial1DEval(poly, 0.5));
    673 
    674     // A different method of doing the same thing
    675     poly->coeff[BAD] = 0.0;
    676     poly->mask[BAD] = 0;
    677 
    678     fprintf(stderr,"Value using coefficient zeroing: %f\n", psPolynomial1DEval(poly, 0.5));
    679 
    680     psFree(poly);
    681 
    682     return(0);
    683 }
    684 
    685 
    686 psS32 myTest()
    687 {
    688     t01();
    689 
    690     psPolynomial1D *my1DPoly = NULL;
    691     psPolynomial2D *my2DPoly = NULL;
    692     psPolynomial3D *my3DPoly = NULL;
    693     psPolynomial4D *my4DPoly = NULL;
    694     psDPolynomial1D *my1DPolyD = NULL;
    695     psDPolynomial2D *my2DPolyD = NULL;
    696     psDPolynomial3D *my3DPolyD = NULL;
    697     psDPolynomial4D *my4DPolyD = NULL;
    698     psS32 testStatus      = true;
    699     psS32 memLeaks        = 0;
    700     psS32 a               = 0;
    701     psS32 b               = 0;
    702     psS32 c               = 0;
    703     psS32 d               = 0;
    704     psS32 currentId       = 0;
    705 
    706     currentId       = psMemGetId();
    707     /*************************************************************************/
    708     /*  Allocate and initialize data structures                      */
    709     /*************************************************************************/
    710     printPositiveTestHeader(stdout,
    711                             "psFunctions functions",
    712                             "Allocate/Deallocate the psPolynomial1D structure.");
    713 
    714     my1DPoly = psPolynomial1DAlloc(AN, PS_POLYNOMIAL_ORD);
    715     for (a = 0; a < AN ; a++) {
    716         my1DPoly->coeff[a] = MISC_FLOAT_NUMBER;
    717         my1DPoly->coeffErr[a] = MISC_FLOAT_NUMBER;
    718         my1DPoly->mask[a] = MISC_INT_NUMBER;
    719     }
    720     psMemCheckCorruption(1);
    721 
    722     printf("At (x) = (%f): %f\n", MISC_X_VALUE,
    723            psPolynomial1DEval(
    724                my1DPoly,
    725                MISC_X_VALUE
    726            ));
    727 
    728     psFree(my1DPoly);
    729     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    730     if (0 != memLeaks) {
    731         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    732     }
    733     printFooter(stdout,
    734                 "psFunctions functions",
    735                 "Allocate/Deallocate the psPolynomial1D structure.",
    736                 testStatus);
    737 
    738 
    739 
    740 
    741 
    742     printPositiveTestHeader(stdout,
    743                             "psFunctions functions",
    744                             "Allocate/Deallocate the psPolynomial2D structure.");
    745     my2DPoly = psPolynomial2DAlloc(AN, BN, PS_POLYNOMIAL_ORD);
    746     for (a = 0; a < AN ; a++) {
    747         for (b = 0; b < BN ; b++) {
    748             my2DPoly->coeff[a][b] = MISC_FLOAT_NUMBER;
    749             my2DPoly->coeffErr[a][b] = MISC_FLOAT_NUMBER;
    750             my2DPoly->mask[a][b] = MISC_INT_NUMBER;
    751         }
    752     }
    753     psMemCheckCorruption(1);
    754 
    755     printf("At (x, y) = (%f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE,
    756            psPolynomial2DEval(
    757                my2DPoly,
    758                MISC_X_VALUE,
    759                MISC_X_VALUE
    760            ));
    761 
    762     psFree(my2DPoly);
    763     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    764     if (0 != memLeaks) {
    765         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    766     }
    767     printFooter(stdout,
    768                 "psFunctions functions",
    769                 "Allocate/Deallocate the psPolynomial2D structure.",
    770                 testStatus);
    771 
    772 
    773 
    774     printPositiveTestHeader(stdout,
    775                             "psFunctions functions",
    776                             "Allocate/Deallocate the psPolynomial3D structure.");
    777     my3DPoly = psPolynomial3DAlloc(AN, BN, CN, PS_POLYNOMIAL_ORD);
    778     for (a = 0; a < AN ; a++) {
    779         for (b = 0; b < BN ; b++) {
    780             for (c = 0; c < CN ; c++) {
    781                 my3DPoly->coeff[a][b][c] = MISC_FLOAT_NUMBER;
    782                 my3DPoly->coeffErr[a][b][c] = MISC_FLOAT_NUMBER;
    783                 my3DPoly->mask[a][b][c] = MISC_INT_NUMBER;
    784             }
    785         }
    786     }
    787     psMemCheckCorruption(1);
    788 
    789     printf("At (x, y, z) = (%f, %f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE,
    790            MISC_X_VALUE,
    791            psPolynomial3DEval(
    792                my3DPoly,
    793                MISC_X_VALUE,
    794                MISC_X_VALUE,
    795                MISC_X_VALUE
    796            ));
    797 
    798     psFree(my3DPoly);
    799     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    800     if (0 != memLeaks) {
    801         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    802     }
    803     printFooter(stdout,
    804                 "psFunctions functions",
    805                 "Allocate/Deallocate the psPolynomial3D structure.",
    806                 testStatus);
    807 
    808 
    809 
    810 
    811     printPositiveTestHeader(stdout,
    812                             "psFunctions functions",
    813                             "Allocate/Deallocate the psPolynomial4D structure.");
    814     my4DPoly = psPolynomial4DAlloc(AN, BN, CN, DN, PS_POLYNOMIAL_ORD);
    815     for (a = 0; a < AN ; a++) {
    816         for (b = 0; b < BN ; b++) {
    817             for (c = 0; c < CN ; c++) {
    818                 for (d = 0; d < DN ; d++) {
    819                     my4DPoly->coeff[a][b][c][d] = MISC_FLOAT_NUMBER;
    820                     my4DPoly->coeffErr[a][b][c][d] = MISC_FLOAT_NUMBER;
    821                     my4DPoly->mask[a][b][c][d] = MISC_INT_NUMBER;
    822                 }
    823             }
    824         }
    825     }
    826     psMemCheckCorruption(1);
    827 
    828     printf("At (w, x, y, z) = (%f, %f, %f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE,
    829            MISC_X_VALUE, MISC_X_VALUE,
    830            psPolynomial4DEval(
    831                my4DPoly,
    832                MISC_X_VALUE,
    833                MISC_X_VALUE,
    834                MISC_X_VALUE,
    835                MISC_X_VALUE
    836            ));
    837 
    838     psFree(my4DPoly);
    839     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    840     if (0 != memLeaks) {
    841         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    842     }
    843     printFooter(stdout,
    844                 "psFunctions functions",
    845                 "Allocate/Deallocate the psPolynomial4D structure.",
    846                 testStatus);
    847 
    848 
    849 
    850     /*************************************************************************/
    851     /*  Allocate and initialize data structures                      */
    852     /*************************************************************************/
    853     printPositiveTestHeader(stdout,
    854                             "psFunctions functions",
    855                             "Allocate/Deallocate the psDPolynomial1D structure.");
    856 
    857     my1DPolyD = psDPolynomial1DAlloc(AN, PS_POLYNOMIAL_ORD);
    858     for (a = 0; a < AN ; a++) {
    859         my1DPolyD->coeff[a] = MISC_FLOAT_NUMBER;
    860         my1DPolyD->coeffErr[a] = MISC_FLOAT_NUMBER;
    861         my1DPolyD->mask[a] = MISC_INT_NUMBER;
    862     }
    863     psMemCheckCorruption(1);
    864 
    865     printf("At (x) = (%f): %f\n", MISC_X_VALUE,
    866            psDPolynomial1DEval(
    867                my1DPolyD,
    868                MISC_X_VALUE
    869            ));
    870 
    871     psFree(my1DPolyD);
    872     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    873     if (0 != memLeaks) {
    874         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    875     }
    876     printFooter(stdout,
    877                 "psFunctions functions",
    878                 "Allocate/Deallocate the psDPolynomial1D structure.",
    879                 testStatus);
    880 
    881     printPositiveTestHeader(stdout,
    882                             "psFunctions functions",
    883                             "Allocate/Deallocate the psDPolynomial2D structure.");
    884     my2DPolyD = psDPolynomial2DAlloc(AN, BN, PS_POLYNOMIAL_ORD);
    885     for (a = 0; a < AN ; a++) {
    886         for (b = 0; b < BN ; b++) {
    887             my2DPolyD->coeff[a][b] = MISC_FLOAT_NUMBER;
    888             my2DPolyD->coeffErr[a][b] = MISC_FLOAT_NUMBER;
    889             my2DPolyD->mask[a][b] = MISC_INT_NUMBER;
    890         }
    891     }
    892     psMemCheckCorruption(1);
    893 
    894     printf("At (x, y) = (%f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE,
    895            psDPolynomial2DEval(
    896                my2DPolyD,
    897                MISC_X_VALUE,
    898                MISC_X_VALUE
    899            ));
    900 
    901     psFree(my2DPolyD);
    902     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    903     if (0 != memLeaks) {
    904         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    905     }
    906     printFooter(stdout,
    907                 "psFunctions functions",
    908                 "Allocate/Deallocate the psDPolynomial2D structure.",
    909                 testStatus);
    910 
    911 
    912 
    913     printPositiveTestHeader(stdout,
    914                             "psFunctions functions",
    915                             "Allocate/Deallocate the psDPolynomial3D structure.");
    916     my3DPolyD = psDPolynomial3DAlloc(AN, BN, CN, PS_POLYNOMIAL_ORD);
    917     for (a = 0; a < AN ; a++) {
    918         for (b = 0; b < BN ; b++) {
    919             for (c = 0; c < CN ; c++) {
    920                 my3DPolyD->coeff[a][b][c] = MISC_FLOAT_NUMBER;
    921                 my3DPolyD->coeffErr[a][b][c] = MISC_FLOAT_NUMBER;
    922                 my3DPolyD->mask[a][b][c] = MISC_INT_NUMBER;
    923             }
    924         }
    925     }
    926     psMemCheckCorruption(1);
    927 
    928     printf("At (x, y, z) = (%f, %f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE,
    929            MISC_X_VALUE,
    930            psDPolynomial3DEval(
    931                my3DPolyD,
    932                MISC_X_VALUE,
    933                MISC_X_VALUE,
    934                MISC_X_VALUE
    935            ));
    936 
    937     psFree(my3DPolyD);
    938     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    939     if (0 != memLeaks) {
    940         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    941     }
    942     printFooter(stdout,
    943                 "psFunctions functions",
    944                 "Allocate/Deallocate the psDPolynomial3D structure.",
    945                 testStatus);
    946 
    947 
    948 
    949 
    950     printPositiveTestHeader(stdout,
    951                             "psFunctions functions",
    952                             "Allocate/Deallocate the psDPolynomial4D structure.");
    953     my4DPolyD = psDPolynomial4DAlloc(AN, BN, CN, DN, PS_POLYNOMIAL_ORD);
    954     for (a = 0; a < AN ; a++) {
    955         for (b = 0; b < BN ; b++) {
    956             for (c = 0; c < CN ; c++) {
    957                 for (d = 0; d < DN ; d++) {
    958                     my4DPolyD->coeff[a][b][c][d] = MISC_FLOAT_NUMBER;
    959                     my4DPolyD->coeffErr[a][b][c][d] = MISC_FLOAT_NUMBER;
    960                     my4DPolyD->mask[a][b][c][d] = MISC_INT_NUMBER;
    961                 }
    962             }
    963         }
    964     }
    965     psMemCheckCorruption(1);
    966 
    967     printf("At (w, x, y, z) = (%f, %f, %f, %f): %f\n", MISC_X_VALUE, MISC_X_VALUE,
    968            MISC_X_VALUE, MISC_X_VALUE,
    969            psDPolynomial4DEval(
    970                my4DPolyD,
    971                MISC_X_VALUE,
    972                MISC_X_VALUE,
    973                MISC_X_VALUE,
    974                MISC_X_VALUE
    975            ));
    976 
    977     psFree(my4DPolyD);
    978     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    979     if (0 != memLeaks) {
    980         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    981     }
    982     printFooter(stdout,
    983                 "psFunctions functions",
    984                 "Allocate/Deallocate the psDPolynomial4D structure.",
    985                 testStatus);
    986 
    987 
    988 
    989     /*************************************************************************/
    990     /*  Allocate and initialize data structures                      */
    991     /*************************************************************************/
    992     printPositiveTestHeader(stdout,
    993                             "psFunctions functions",
    994                             "Allocate/Deallocate the psPolynomial1D structure (CHEBYSHEV).");
    995 
    996     my1DPoly = psPolynomial1DAlloc(AN, PS_POLYNOMIAL_CHEB);
    997     for (a = 0; a < AN ; a++) {
    998         my1DPoly->coeff[a] = MISC_FLOAT_NUMBER;
    999         my1DPoly->coeffErr[a] = MISC_FLOAT_NUMBER;
    1000         my1DPoly->mask[a] = MISC_INT_NUMBER;
    1001     }
    1002     psMemCheckCorruption(1);
    1003 
    1004     printf("At (x) = (%f): %f\n", MISC_X_VALUE,
    1005            psPolynomial1DEval(
    1006                my1DPoly,
    1007                MISC_X_CHEB_VALUE
    1008            ));
    1009 
    1010     psFree(my1DPoly);
    1011     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    1012     if (0 != memLeaks) {
    1013         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    1014     }
    1015     printFooter(stdout,
    1016                 "psFunctions functions",
    1017                 "Allocate/Deallocate the psPolynomial1D structure (CHEBYSHEV).",
    1018                 testStatus);
    1019 
    1020 
    1021 
    1022 
    1023     printPositiveTestHeader(stdout,
    1024                             "psFunctions functions",
    1025                             "Allocate/Deallocate the psPolynomial2D structure (CHEBYSHEV).");
    1026     my2DPoly = psPolynomial2DAlloc(AN, BN, PS_POLYNOMIAL_CHEB);
    1027     for (a = 0; a < AN ; a++) {
    1028         for (b = 0; b < BN ; b++) {
    1029             my2DPoly->coeff[a][b] = MISC_FLOAT_NUMBER;
    1030             my2DPoly->coeffErr[a][b] = MISC_FLOAT_NUMBER;
    1031             my2DPoly->mask[a][b] = MISC_INT_NUMBER;
    1032         }
    1033     }
    1034     psMemCheckCorruption(1);
    1035 
    1036     printf("At (x, y) = (%f, %f): %f\n", MISC_X_CHEB_VALUE, MISC_X_CHEB_VALUE,
    1037            psPolynomial2DEval(
    1038                my2DPoly,
    1039                MISC_X_CHEB_VALUE,
    1040                MISC_X_CHEB_VALUE
    1041            ));
    1042 
    1043     psFree(my2DPoly);
    1044     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    1045     if (0 != memLeaks) {
    1046         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    1047     }
    1048     printFooter(stdout,
    1049                 "psFunctions functions",
    1050                 "Allocate/Deallocate the psPolynomial2D structure (CHEBYSHEV).",
    1051                 testStatus);
    1052 
    1053 
    1054 
    1055     printPositiveTestHeader(stdout,
    1056                             "psFunctions functions",
    1057                             "Allocate/Deallocate the psPolynomial3D structure (CHEBYSHEV).");
    1058     my3DPoly = psPolynomial3DAlloc(AN, BN, CN, PS_POLYNOMIAL_CHEB);
    1059     for (a = 0; a < AN ; a++) {
    1060         for (b = 0; b < BN ; b++) {
    1061             for (c = 0; c < CN ; c++) {
    1062                 my3DPoly->coeff[a][b][c] = MISC_FLOAT_NUMBER;
    1063                 my3DPoly->coeffErr[a][b][c] = MISC_FLOAT_NUMBER;
    1064                 my3DPoly->mask[a][b][c] = MISC_INT_NUMBER;
    1065             }
    1066         }
    1067     }
    1068     psMemCheckCorruption(1);
    1069 
    1070     printf("At (x, y, z) = (%f, %f, %f): %f\n", MISC_X_CHEB_VALUE, MISC_X_CHEB_VALUE,
    1071            MISC_X_CHEB_VALUE,
    1072            psPolynomial3DEval(
    1073                my3DPoly,
    1074                MISC_X_CHEB_VALUE,
    1075                MISC_X_CHEB_VALUE,
    1076                MISC_X_CHEB_VALUE
    1077            ));
    1078 
    1079     psFree(my3DPoly);
    1080     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    1081     if (0 != memLeaks) {
    1082         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    1083     }
    1084     printFooter(stdout,
    1085                 "psFunctions functions",
    1086                 "Allocate/Deallocate the psPolynomial3D structure (CHEBYSHEV).",
    1087                 testStatus);
    1088 
    1089 
    1090 
    1091 
    1092     printPositiveTestHeader(stdout,
    1093                             "psFunctions functions",
    1094                             "Allocate/Deallocate the psPolynomial4D structure (CHEBYSHEV).");
    1095     my4DPoly = psPolynomial4DAlloc(AN, BN, CN, DN, PS_POLYNOMIAL_CHEB);
    1096     for (a = 0; a < AN ; a++) {
    1097         for (b = 0; b < BN ; b++) {
    1098             for (c = 0; c < CN ; c++) {
    1099                 for (d = 0; d < DN ; d++) {
    1100                     my4DPoly->coeff[a][b][c][d] = MISC_FLOAT_NUMBER;
    1101                     my4DPoly->coeffErr[a][b][c][d] = MISC_FLOAT_NUMBER;
    1102                     my4DPoly->mask[a][b][c][d] = MISC_INT_NUMBER;
    1103                 }
    1104             }
    1105         }
    1106     }
    1107     psMemCheckCorruption(1);
    1108 
    1109     printf("At (w, x, y, z) = (%f, %f, %f, %f): %f\n", MISC_X_CHEB_VALUE, MISC_X_CHEB_VALUE,
    1110            MISC_X_CHEB_VALUE, MISC_X_CHEB_VALUE,
    1111            psPolynomial4DEval(
    1112                my4DPoly,
    1113                MISC_X_CHEB_VALUE,
    1114                MISC_X_CHEB_VALUE,
    1115                MISC_X_CHEB_VALUE,
    1116                MISC_X_CHEB_VALUE
    1117            ));
    1118 
    1119     psFree(my4DPoly);
    1120     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    1121     if (0 != memLeaks) {
    1122         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    1123     }
    1124     printFooter(stdout,
    1125                 "psFunctions functions",
    1126                 "Allocate/Deallocate the psPolynomial4D structure (CHEBYSHEV).",
    1127                 testStatus);
    1128 
    1129 
    1130 
    1131     /*************************************************************************/
    1132     /*  Allocate and initialize data structures                      */
    1133     /*************************************************************************/
    1134     printPositiveTestHeader(stdout,
    1135                             "psFunctions functions",
    1136                             "Allocate/Deallocate the psDPolynomial1D structure (CHEBYSHEV).");
    1137 
    1138     my1DPolyD = psDPolynomial1DAlloc(AN, PS_POLYNOMIAL_CHEB);
    1139     for (a = 0; a < AN ; a++) {
    1140         my1DPolyD->coeff[a] = MISC_FLOAT_NUMBER;
    1141         my1DPolyD->coeffErr[a] = MISC_FLOAT_NUMBER;
    1142         my1DPolyD->mask[a] = MISC_INT_NUMBER;
    1143     }
    1144     psMemCheckCorruption(1);
    1145 
    1146     printf("At (x) = (%f): %f\n", MISC_X_CHEB_VALUE,
    1147            psDPolynomial1DEval(
    1148                my1DPolyD,
    1149                MISC_X_CHEB_VALUE
    1150            ));
    1151 
    1152     psFree(my1DPolyD);
    1153     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    1154     if (0 != memLeaks) {
    1155         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    1156     }
    1157     printFooter(stdout,
    1158                 "psFunctions functions",
    1159                 "Allocate/Deallocate the psDPolynomial1D structure (CHEBYSHEV).",
    1160                 testStatus);
    1161 
    1162     printPositiveTestHeader(stdout,
    1163                             "psFunctions functions",
    1164                             "Allocate/Deallocate the psDPolynomial2D structure (CHEBYSHEV).");
    1165     my2DPolyD = psDPolynomial2DAlloc(AN, BN, PS_POLYNOMIAL_CHEB);
    1166     for (a = 0; a < AN ; a++) {
    1167         for (b = 0; b < BN ; b++) {
    1168             my2DPolyD->coeff[a][b] = MISC_FLOAT_NUMBER;
    1169             my2DPolyD->coeffErr[a][b] = MISC_FLOAT_NUMBER;
    1170             my2DPolyD->mask[a][b] = MISC_INT_NUMBER;
    1171         }
    1172     }
    1173     psMemCheckCorruption(1);
    1174 
    1175     printf("At (x, y) = (%f, %f): %f\n", MISC_X_CHEB_VALUE, MISC_X_CHEB_VALUE,
    1176            psDPolynomial2DEval(
    1177                my2DPolyD,
    1178                MISC_X_CHEB_VALUE,
    1179                MISC_X_CHEB_VALUE
    1180            ));
    1181 
    1182     psFree(my2DPolyD);
    1183     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    1184     if (0 != memLeaks) {
    1185         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    1186     }
    1187     printFooter(stdout,
    1188                 "psFunctions functions",
    1189                 "Allocate/Deallocate the psDPolynomial2D structure (CHEBYSHEV).",
    1190                 testStatus);
    1191 
    1192 
    1193 
    1194     printPositiveTestHeader(stdout,
    1195                             "psFunctions functions",
    1196                             "Allocate/Deallocate the psDPolynomial3D structure (CHEBYSHEV).");
    1197     my3DPolyD = psDPolynomial3DAlloc(AN, BN, CN, PS_POLYNOMIAL_CHEB);
    1198     for (a = 0; a < AN ; a++) {
    1199         for (b = 0; b < BN ; b++) {
    1200             for (c = 0; c < CN ; c++) {
    1201                 my3DPolyD->coeff[a][b][c] = MISC_FLOAT_NUMBER;
    1202                 my3DPolyD->coeffErr[a][b][c] = MISC_FLOAT_NUMBER;
    1203                 my3DPolyD->mask[a][b][c] = MISC_INT_NUMBER;
    1204             }
    1205         }
    1206     }
    1207     psMemCheckCorruption(1);
    1208 
    1209     printf("At (x, y, z) = (%f, %f, %f): %f\n", MISC_X_CHEB_VALUE, MISC_X_CHEB_VALUE,
    1210            MISC_X_CHEB_VALUE,
    1211            psDPolynomial3DEval(
    1212                my3DPolyD,
    1213                MISC_X_CHEB_VALUE,
    1214                MISC_X_CHEB_VALUE,
    1215                MISC_X_CHEB_VALUE
    1216            ));
    1217 
    1218     psFree(my3DPolyD);
    1219     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    1220     if (0 != memLeaks) {
    1221         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    1222     }
    1223     printFooter(stdout,
    1224                 "psFunctions functions",
    1225                 "Allocate/Deallocate the psDPolynomial3D structure (CHEBYSHEV).",
    1226                 testStatus);
    1227 
    1228 
    1229 
    1230 
    1231     printPositiveTestHeader(stdout,
    1232                             "psFunctions functions",
    1233                             "Allocate/Deallocate the psDPolynomial4D structure (CHEBYSHEV).");
    1234     my4DPolyD = psDPolynomial4DAlloc(AN, BN, CN, DN, PS_POLYNOMIAL_CHEB);
    1235     for (a = 0; a < AN ; a++) {
    1236         for (b = 0; b < BN ; b++) {
    1237             for (c = 0; c < CN ; c++) {
    1238                 for (d = 0; d < DN ; d++) {
    1239                     my4DPolyD->coeff[a][b][c][d] = MISC_FLOAT_NUMBER;
    1240                     my4DPolyD->coeffErr[a][b][c][d] = MISC_FLOAT_NUMBER;
    1241                     my4DPolyD->mask[a][b][c][d] = MISC_INT_NUMBER;
    1242                 }
    1243             }
    1244         }
    1245     }
    1246     psMemCheckCorruption(1);
    1247 
    1248     printf("At (w, x, y, z) = (%f, %f, %f, %f): %f\n", MISC_X_CHEB_VALUE, MISC_X_CHEB_VALUE,
    1249            MISC_X_CHEB_VALUE, MISC_X_CHEB_VALUE,
    1250            psDPolynomial4DEval(
    1251                my4DPolyD,
    1252                MISC_X_CHEB_VALUE,
    1253                MISC_X_CHEB_VALUE,
    1254                MISC_X_CHEB_VALUE,
    1255                MISC_X_CHEB_VALUE
    1256            ));
    1257 
    1258     psFree(my4DPolyD);
    1259     memLeaks = psMemCheckLeaks(currentId,NULL,stderr,false);
    1260     if (0 != memLeaks) {
    1261         psAbort(__func__,"Memory Leaks! (%d leaks)", memLeaks);
    1262     }
    1263     printFooter(stdout,
    1264                 "psFunctions functions",
    1265                 "Allocate/Deallocate the psDPolynomial4D structure (CHEBYSHEV).",
    1266                 testStatus);
    1267 
    1268     return (!testStatus);
    1269 }
    1270 
Note: See TracChangeset for help on using the changeset viewer.