IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11374


Ignore:
Timestamp:
Jan 29, 2007, 11:32:50 AM (19 years ago)
Author:
gusciora
Message:

Latest version. Removed VERBOSE macro.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/math/tap_psPolynomialEval1D.c

    r10740 r11374  
    1 /** tst_psFunc08.c
     1/**
    22*
    33*  This test driver will exercise the psPolynomialXDEval functions for both
    44*  ORD and CHEB type polynomials.
    55*
    6 *  @version  $Revision: 1.2 $  $Name: not supported by cvs2svn $
    7 *  @date  $Date: 2006-12-15 00:41:49 $
     6*  @version  $Revision: 1.3 $  $Name: not supported by cvs2svn $
     7*  @date  $Date: 2007-01-29 21:32:50 $
    88*
    99*  XXX: Probably should test single- and multi-dimensional polynomials in
     
    2525#define TESTPOINTS   5
    2626#define ERROR_TOL    0.001
    27 #define VERBOSE 0
    2827
    2928psF32 poly1DCoeff[TERMS]        = { -4.3, 2.3, -3.2, 1.9};
     
    4544    psLogSetFormat("HLNM");
    4645    psLogSetLevel(PS_LOG_INFO);
    47 
    4846    plan_tests(24);
    49     diag("psPolynomial1DEval() tests");
    5047
    5148    // Allocate and evaluate an ordinary polynomial structure
     
    5451
    5552        // Allocate polynomial structure
    56         diag("Allocate a 1D polynomial with psPolynomial1DAlloc()");
    5753        psPolynomial1D* polyOrd = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, TERMS-1);
    5854        ok(polyOrd != NULL, "Ordinary psPolynomial1D successfully allocated");
     
    6763
    6864        // Evaluate test points and verify results
    69         psBool errorFlag = false;
     65        bool errorFlag = false;
    7066        for(psS32 i = 0; i < TESTPOINTS; i++)
    7167        {
    7268            psF64 result = psPolynomial1DEval(polyOrd,poly1DXValue[i]);
    73             if(fabs(poly1DXResult[i]-result) > ERROR_TOL ) {
    74                 if (VERBOSE) {
    75                     psError(PS_ERR_UNKNOWN,true,"Evaluated value %g not as expected %g",
    76                             result, poly1DXResult[i]);
    77                 }
     69            if (fabs(poly1DXResult[i]-result) > ERROR_TOL ) {
     70                diag("Evaluated value %g not as expected %g", result, poly1DXResult[i]);
    7871                errorFlag = true;
    7972            }
     
    8881    // Allocate Cheby polynomial structure
    8982    {
    90         psBool errorFlag = false;
    91         psMemId id = psMemGetId();
    92         diag("Allocate a 1D polynomial with psPolynomial1DAlloc()");
     83        bool errorFlag = false;
     84        psMemId id = psMemGetId();
    9385        psPolynomial1D*  polyCheb = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1);
    9486        ok(polyCheb != NULL, "Chebyshev psPolynomial1D successfully allocated");
     
    10597        {
    10698            psF64 resultCheb = psPolynomial1DEval(polyCheb,poly1DXChebValue[i]);
    107             if(fabs(poly1DXChebResult[i]-resultCheb) > ERROR_TOL ) {
    108                 if (VERBOSE) {
    109                     psError(PS_ERR_UNKNOWN,true,"Evaluated value %g not as expected %g",
    110                             resultCheb, poly1DXChebResult[i]);
    111                 }
     99            if (fabs(poly1DXChebResult[i]-resultCheb) > ERROR_TOL ) {
     100                diag("Evaluated value %g not as expected %g", resultCheb, poly1DXChebResult[i]);
    112101                errorFlag = true;
    113102            }
     
    121110    // Allocate polynomial with unallowable type
    122111    {
    123         diag("Allocate a 1D polynomial with an unallowed type");
    124112        psMemId id = psMemGetId();
    125113        psPolynomial1D* polyOrd = psPolynomial1DAlloc(99, TERMS-1);
     
    127115        skip_start(polyOrd!=NULL, 1, "Skipping tests because psPolynomial1DAlloc() failed");
    128116
    129         diag("Attempt to evaluate an 1D polynomial with an unallowed type");
    130117        // Attempt to evaluation invalid polynomial type
    131118        psF64 result = psPolynomial1DEval(polyOrd, 0.0);
     
    139126    // Allocate polynomial, test the psPolynomial1DEvalVector() routines
    140127    {
    141         diag("Test psPolynomial1DEvalVector(), ordinary polynomials");
    142128        psMemId id = psMemGetId();
    143129        psPolynomial1D* polyOrd = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, TERMS-1);
     
    166152
    167153        // Verify the results
    168         psBool errorFlag = false;
    169         for(psS32 i = 0; i < TESTPOINTS; i++)
    170         {
    171             if(fabs(poly1DXResult[i]-outputOrd->data.F64[i]) > ERROR_TOL) {
    172                 if (VERBOSE) {
    173                     psError(PS_ERR_UNKNOWN,true,"Result[%d] %lg not equal to expected %lg",
    174                             i, outputOrd->data.F64[i], poly1DXResult[i]);
    175                 }
     154        bool errorFlag = false;
     155        for(psS32 i = 0; i < TESTPOINTS; i++)
     156        {
     157            if (fabs(poly1DXResult[i]-outputOrd->data.F64[i]) > ERROR_TOL) {
     158                diag("Result[%d] %lg not equal to expected %lg",
     159                     i, outputOrd->data.F64[i], poly1DXResult[i]);
    176160                errorFlag = TRUE;
    177161            }
     
    199183    // Allocate polynomial, test the psPolynomial1DEvalVector() routines (Chebyshev)
    200184    {
    201         diag("Test psPolynomial1DEvalVector(), Cheby polynomials");
    202185        psMemId id = psMemGetId();
    203186        psPolynomial1D* polyCheb = psPolynomial1DAlloc(PS_POLYNOMIAL_CHEB, TERMS-1);
     
    226209
    227210        // Verify the results
    228         psBool errorFlag = false;
    229         for(psS32 i = 0; i < TESTPOINTS; i++)
    230         {
    231             if(fabs(poly1DXChebResult[i]-outputCheb->data.F64[i]) > ERROR_TOL) {
    232                 if (VERBOSE) {
    233                     psError(PS_ERR_UNKNOWN,true,"ResultCheb[%d] %lg not equal to expected %lg",
    234                             i, outputCheb->data.F64[i], poly1DXChebResult[i]);
    235                 }
     211        bool errorFlag = false;
     212        for(psS32 i = 0; i < TESTPOINTS; i++)
     213        {
     214            if (fabs(poly1DXChebResult[i]-outputCheb->data.F64[i]) > ERROR_TOL) {
     215                diag("ResultCheb[%d] %lg not equal to expected %lg",
     216                     i, outputCheb->data.F64[i], poly1DXChebResult[i]);
    236217                errorFlag = TRUE;
    237218            }
Note: See TracChangeset for help on using the changeset viewer.