IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 7, 2004, 4:48:01 PM (22 years ago)
Author:
desonia
Message:

fixed psBinaryOp/psUnaryOp to handle the out parameter in a manner like
other functions. Also expanded the types supported to all numeric types.

Location:
trunk/psLib/test/dataManip
Files:
3 edited

Legend:

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

    r1648 r2021  
    1515 *  @author  Ross Harman, MHPCC
    1616 *
    17  *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
    18  *  @date  $Date: 2004-08-27 23:31:35 $
     17 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
     18 *  @date  $Date: 2004-10-08 02:48:01 $
    1919 *
    2020 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8686    printNegativeTestHeader(stdout,"psMatrixVectorArithmetic", "Check for NULL arguments",
    8787                            "Null XXX argument", 0);
    88     psBinaryOp(NULL, image1, "+", image2);
    89     psBinaryOp(image2, NULL, "+", image2);
    90     psBinaryOp(image2, image1, "+", NULL);
    91     psBinaryOp(image2, image1, NULL, image2);
    92     psUnaryOp(NULL, image1, "sin");
    93     psUnaryOp(image2, NULL, "sin");
    94     psUnaryOp(image2, image1, NULL);
    95     printFooter(stdout, "psBitSet", "Check for NULL arguments", true);
    96 
     88    psImage* image6 = (psImage*)psBinaryOp(NULL, image1, "+", image2);
     89    if (image6 == NULL) {
     90        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp failed to make an image given no output to recycle.");
     91        return 1;
     92    }
     93
     94    image6 = (psImage*)psBinaryOp(image6, NULL, "+", image2);
     95    if (image6 != NULL) {
     96        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given a NULL first operand.");
     97        return 2;
     98    }
     99
     100    image6 = (psImage*)psBinaryOp(image6, image1, "+", NULL);
     101    if (image6 != NULL) {
     102        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given a NULL second operand.");
     103        return 3;
     104    }
     105    image6 = (psImage*)psBinaryOp(image6, image1, NULL, image2);
     106    if (image6 != NULL) {
     107        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given a NULL operator.");
     108        return 4;
     109    }
     110
     111    image6 = (psImage*)psUnaryOp(NULL, image1, "sin");
     112    if (image6 == NULL) {
     113        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp failed to make an image given no output to recycle.");
     114        return 5;
     115    }
     116
     117    image6 = (psImage*)psUnaryOp(image6, NULL, "sin");
     118    if (image6 != NULL) {
     119        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp returned a result given a NULL operand.");
     120        return 6;
     121    }
     122
     123    image6 = (psImage*)psUnaryOp(image6, image1, NULL);
     124    if (image6 != NULL) {
     125        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp returned a result given a NULL operator.");
     126        return 7;
     127    }
     128
     129    printFooter(stdout, "psMatrixVectorArithmetic", "Check for NULL arguments", true);
    97130
    98131    // Inconsistent element types
    99132    printNegativeTestHeader(stdout,"psMatrixVectorArithmetic", "Inconsistent element types",
    100133                            "Element types for arguments inconsistent", 0);
    101     psBinaryOp(image2, image3, "+", image2);
    102     psUnaryOp(image2, image3, "sin");
    103     printFooter(stdout, "psBitSet", "Inconsistent element types", true);
     134    image6 = (psImage*)psBinaryOp(image6, image3, "+", image2);
     135    if (image6 != NULL) {
     136        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given operands of different types.");
     137        return 8;
     138    }
     139
     140    image6 = psImageCopy(image6,image2,PS_TYPE_F64);
     141    image6 = (psImage*)psUnaryOp(image6, image3, "sin");
     142    if (image6 == NULL || image6->type.type != PS_TYPE_F32) {
     143        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp failed to convert the type of the output.");
     144        return 9;
     145    }
     146
     147    printFooter(stdout, "psMatrixVectorArithmetic", "Inconsistent element types", true);
    104148
    105149
     
    107151    printNegativeTestHeader(stdout,"psMatrixVectorArithmetic", "Inconsistent element count",
    108152                            "Inconsistent element count", 0);
    109     psBinaryOp(image2, image4, "+", image2);
    110     psUnaryOp(image2, image4, "sin");
    111     psBinaryOp(image2, vector1, "+", image2);
     153    image6 = (psImage*)psBinaryOp(image6, image4, "+", image2);
     154    if (image6 != NULL) {
     155        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given operands of different sizes.");
     156        return 10;
     157    }
     158
     159    image6 = psImageCopy(image6,image2,PS_TYPE_F64);
     160    image6 = (psImage*)psUnaryOp(image6, image4, "sin");
     161    if (image6 == NULL ||
     162            image6->numCols != image6->numCols ||
     163            image6->numRows != image6->numRows) {
     164        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp failed to resize the output.");
     165        return 11;
     166    }
     167
     168    image6 = (psImage*)psBinaryOp(image6, vector1, "+", image2);
     169    if (image6 != NULL) {
     170        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given operands of different sizes.");
     171        return 12;
     172    }
     173
    112174    vector1->type.dimen = PS_DIMEN_TRANSV;
    113     psBinaryOp(image2, vector1, "+", image2);
    114     printFooter(stdout, "psBitSet", "Inconsistent element count", true);
     175    image6 = (psImage*)psBinaryOp(image6, vector1, "+", image2);
     176    if (image6 != NULL) {
     177        psLogMsg(__func__,PS_LOG_ERROR,"psBinaryOp returned a result given operands of different sizes.");
     178        return 13;
     179    }
     180    printFooter(stdout, "psMatrixVectorArithmetic", "Inconsistent element count", true);
    115181
    116182
     
    118184    printNegativeTestHeader(stdout,"psMatrixVectorArithmetic", "Inconsistent dimensionality",
    119185                            "Dimensionality for arguments inconsistent", 0);
    120     psUnaryOp(image2, vector2, "sin");
    121     printFooter(stdout, "psBitSet", "Inconsistent dimensionality", true);
    122 
    123 
    124     // Division by zero
    125     printNegativeTestHeader(stdout,"psMatrixVectorArithmetic", "Divide by zero",
    126                             "Divide by zero", 0);
    127     psBinaryOp(image1, image1, "/", image2);
    128     printFooter(stdout, "psBitSet", "Division by zero", true);
    129 
     186    image6 = psImageCopy(image6,image2,PS_TYPE_F64);
     187    image6 = (psImage*)psUnaryOp(image6, vector2, "sin");
     188    if (image6 != NULL) {
     189        psLogMsg(__func__,PS_LOG_ERROR,"psUnaryOp returned result given wrong type out parameter.");
     190        return 14;
     191    }
     192
     193    printFooter(stdout, "psMatrixVectorArithmetic", "Inconsistent dimensionality", true);
    130194
    131195    // Attempt to use min with complex numbers
    132196    printNegativeTestHeader(stdout,"psMatrixVectorArithmetic", "Use min with complex numbers",
    133197                            "Minimum operation not supported for complex numbers", 0);
    134     psBinaryOp(image5, image5, "min", image5);
    135     printFooter(stdout, "psBitSet", "Use min with complex numbers", true);
     198    image6 = (psImage*)psBinaryOp(image6, image5, "min", image5);
     199    printFooter(stdout, "psMatrixVectorArithmetic", "Use min with complex numbers", true);
    136200
    137201
     
    139203    printNegativeTestHeader(stdout,"psMatrixVectorArithmetic", "Use max with complex numbers",
    140204                            "Maximum operation not supported for complex numbers", 0);
    141     psBinaryOp(image5, image5, "max", image5);
    142     printFooter(stdout, "psBitSet", "Use max with complex numbers", true);
     205    image6 = (psImage*)psBinaryOp(image6, image5, "max", image5);
     206    printFooter(stdout, "psMatrixVectorArithmetic", "Use max with complex numbers", true);
    143207
    144208
     
    146210    printNegativeTestHeader(stdout,"psMatrixVectorArithmetic", "Invalid operation",
    147211                            "Invalid operation", 0);
    148     psBinaryOp(image1, image1, "yarg", image2);
    149     psUnaryOp(image2, image1, "yarg");
    150     printFooter(stdout, "psBitSet", "Invalid operation", true);
     212    image6 = (psImage*)psBinaryOp(image6, image1, "yarg", image2);
     213    image6 = (psImage*)psUnaryOp(image6, image1, "yarg");
     214    printFooter(stdout, "psMatrixVectorArithmetic", "Invalid operation", true);
    151215
    152216    return 0;
  • trunk/psLib/test/dataManip/verified/tst_psMatrixVectorArithmetic03.stderr

    r1761 r2021  
    1 <DATE><TIME>|<HOST>|E|psBinaryOp
    2     : Line <LINENO> - Null out argument
    31<DATE><TIME>|<HOST>|E|psBinaryOp
    42    : Line <LINENO> - Null in1 argument
     
    86    : Line <LINENO> - Null op argument
    97<DATE><TIME>|<HOST>|E|psUnaryOp
    10     : Line <LINENO> - Null out argument
    11 <DATE><TIME>|<HOST>|E|psUnaryOp
    128    : Line <LINENO> - Null in argument
    139<DATE><TIME>|<HOST>|E|psUnaryOp
    1410    : Line <LINENO> - Null op argument
    1511<DATE><TIME>|<HOST>|E|psBinaryOp
    16     : Line <LINENO> - Element types for arguments inconsistent: (1028, 1032, 1032)
    17 <DATE><TIME>|<HOST>|E|psUnaryOp
    1812    : Line <LINENO> - Element types for arguments inconsistent: (1028, 1032)
    1913<DATE><TIME>|<HOST>|E|psBinaryOp
    20     : Inconsistent element count: numRows: 2 vs 3 numCols: 2 vs 3
    21 <DATE><TIME>|<HOST>|E|psUnaryOp
    2214    : Inconsistent element count: numRows: 2 vs 3 numCols: 2 vs 3
    2315<DATE><TIME>|<HOST>|E|psBinaryOp
     
    2517<DATE><TIME>|<HOST>|E|psBinaryOp
    2618    : Inconsistent element count: 2 vs 3
     19<DATE><TIME>|<HOST>|E|psLib.collections.psVectorRecycle
     20    The input psVector must have a vector dimension type.
    2721<DATE><TIME>|<HOST>|E|psUnaryOp
    28     : Line <LINENO> - Dimensionality for arguments inconsistent: (1, 3)
    29 <DATE><TIME>|<HOST>|E|psNanDiv
    30     : Divide by zero
    31 <DATE><TIME>|<HOST>|E|psNanDiv
    32     : Divide by zero
    33 <DATE><TIME>|<HOST>|E|psNanDiv
    34     : Divide by zero
    35 <DATE><TIME>|<HOST>|E|psNanDiv
    36     : Divide by zero
    37 <DATE><TIME>|<HOST>|E|psNanDiv
    38     : Divide by zero
    39 <DATE><TIME>|<HOST>|E|psNanDiv
    40     : Divide by zero
    41 <DATE><TIME>|<HOST>|E|psNanDiv
    42     : Divide by zero
    43 <DATE><TIME>|<HOST>|E|psNanDiv
    44     : Divide by zero
    45 <DATE><TIME>|<HOST>|E|psNanDiv
    46     : Divide by zero
     22    Couldn't create a proper output psVector.
    4723<DATE><TIME>|<HOST>|E|psBinaryOp
    4824    : Minimum operation not supported for complex numbers
  • trunk/psLib/test/dataManip/verified/tst_psMatrixVectorArithmetic03.stdout

    r1150 r2021  
    88
    99
    10 ---> TESTPOINT PASSED (psBitSet{Check for NULL arguments} | tst_psMatrixVectorArithmetic03.c)
     10---> TESTPOINT PASSED (psMatrixVectorArithmetic{Check for NULL arguments} | tst_psMatrixVectorArithmetic03.c)
    1111
    1212/***************************** TESTPOINT ******************************************\
     
    1919
    2020
    21 ---> TESTPOINT PASSED (psBitSet{Inconsistent element types} | tst_psMatrixVectorArithmetic03.c)
     21---> TESTPOINT PASSED (psMatrixVectorArithmetic{Inconsistent element types} | tst_psMatrixVectorArithmetic03.c)
    2222
    2323/***************************** TESTPOINT ******************************************\
     
    3030
    3131
    32 ---> TESTPOINT PASSED (psBitSet{Inconsistent element count} | tst_psMatrixVectorArithmetic03.c)
     32---> TESTPOINT PASSED (psMatrixVectorArithmetic{Inconsistent element count} | tst_psMatrixVectorArithmetic03.c)
    3333
    3434/***************************** TESTPOINT ******************************************\
     
    4141
    4242
    43 ---> TESTPOINT PASSED (psBitSet{Inconsistent dimensionality} | tst_psMatrixVectorArithmetic03.c)
    44 
    45 /***************************** TESTPOINT ******************************************\
    46 *             TestFile: tst_psMatrixVectorArithmetic03.c                           *
    47 *            TestPoint: psMatrixVectorArithmetic{Divide by zero}                   *
    48 *             TestType: Negative                                                   *
    49 *    ExpectedErrorText: Divide by zero                                             *
    50 *  ExpectedStatusValue: 0                                                          *
    51 \**********************************************************************************/
    52 
    53 
    54 ---> TESTPOINT PASSED (psBitSet{Division by zero} | tst_psMatrixVectorArithmetic03.c)
     43---> TESTPOINT PASSED (psMatrixVectorArithmetic{Inconsistent dimensionality} | tst_psMatrixVectorArithmetic03.c)
    5544
    5645/***************************** TESTPOINT ******************************************\
     
    6352
    6453
    65 ---> TESTPOINT PASSED (psBitSet{Use min with complex numbers} | tst_psMatrixVectorArithmetic03.c)
     54---> TESTPOINT PASSED (psMatrixVectorArithmetic{Use min with complex numbers} | tst_psMatrixVectorArithmetic03.c)
    6655
    6756/***************************** TESTPOINT ******************************************\
     
    7463
    7564
    76 ---> TESTPOINT PASSED (psBitSet{Use max with complex numbers} | tst_psMatrixVectorArithmetic03.c)
     65---> TESTPOINT PASSED (psMatrixVectorArithmetic{Use max with complex numbers} | tst_psMatrixVectorArithmetic03.c)
    7766
    7867/***************************** TESTPOINT ******************************************\
     
    8574
    8675
    87 ---> TESTPOINT PASSED (psBitSet{Invalid operation} | tst_psMatrixVectorArithmetic03.c)
     76---> TESTPOINT PASSED (psMatrixVectorArithmetic{Invalid operation} | tst_psMatrixVectorArithmetic03.c)
    8877
Note: See TracChangeset for help on using the changeset viewer.