IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 872


Ignore:
Timestamp:
Jun 4, 2004, 1:42:57 PM (22 years ago)
Author:
harman
Message:

Added more tests

Location:
trunk/psLib/test/dataManip
Files:
1 added
2 edited

Legend:

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

    r831 r872  
    88 *     C)  Determine solution to matrix equation 
    99 *     D)  Free input and output images and vectors
    10  *
     10 *     E)  Attempt to use null image input argument
     11 *     F)  Attempt to use null input vector argument
     12 *     G)  ttempt to use null LU image argument
     13 *
    1114 *  @author  Ross Harman, MHPCC
    1215 *
    13  *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
    14  *  @date  $Date: 2004-06-02 23:29:39 $
     16 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2004-06-04 23:42:18 $
    1518 *
    1619 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2124#include "psTest.h"
    2225
    23 #define PRINT_MATRIX(IMAGE)                         \
     26#define PRINT_MATRIX(IMAGE)                     \
    2427for(int i=IMAGE->numRows-1; i>-1; i--) {        \
    2528    for(int j=0; j<IMAGE->numCols; j++) {       \
    2629        printf("%f ", IMAGE->data.F64[i][j]);   \
    27     }                                          \
    28     printf("\n");                              \
     30    }                                           \
     31    printf("\n");                               \
    2932}
    30 
    31 #define PRINT_VECTOR(VECTOR)                        \
    32 for(int i=0; i<VECTOR->n; i++) {               \
    33     printf("%f\n", VECTOR->data.F64[i]);          \
     33\
     34#define PRINT_VECTOR(VECTOR)                    \
     35for(int i=0; i<VECTOR->n; i++) {                \
     36    printf("%f\n", VECTOR->data.F64[i]);        \
    3437}
    3538
     
    4043    psImage *luImage = NULL;
    4144    psImage *inImage = NULL;
     45    psImage *tempImage = NULL;
     46    psVector *tempVector = NULL;
    4247    psVector *perm = NULL;
    4348    psVector *outVector = NULL;
     
    7378    // Test B - Calculate LU matrix
    7479    printPositiveTestHeader(stdout, "psMatrix", "Calculate LU matrix");
    75     psMatrixLUD(luImage, perm, inImage);
     80    tempImage = luImage;
     81    luImage = psMatrixLUD(luImage, perm, inImage);
    7682    PRINT_MATRIX(luImage);
     83    if(luImage->type.type != PS_DIMEN_IMAGE) {
     84        printf("Error: Resulting image is not PS_DIMEN_IMAGE\n");
     85    } else if(luImage != tempImage) {
     86        printf("Error: Return pointer not equal to output argument pointer\n");
     87    }
    7788    printFooter(stdout, "psMatrix", "Calculate LU matrix", true);
    7889
     
    8091    // Test C - Determine solution to matrix equation
    8192    printPositiveTestHeader(stdout, "psMatrix", "Determine solution to matrix equation");
    82     psMatrixLUSolve(outVector, luImage, inVector, perm);
     93    tempVector = outVector;
     94    outVector = psMatrixLUSolve(outVector, luImage, inVector, perm);
    8395    PRINT_VECTOR(outVector);
     96    if(outVector->type.type != PS_DIMEN_VECTOR) {
     97        printf("Error: Resulting image is not PS_DIMEN_VECTOR\n");
     98    } else if(outVector != tempVector) {
     99        printf("Error: Return pointer not equal to output argument pointer\n");
     100    }
    84101    printFooter(stdout, "psMatrix", "Determine solution to matrix equation", true);
    85102
     
    99116    printFooter(stdout, "psMatrix" ,"Free input and output images and vectors", true);
    100117
     118
     119    // Test E - Attempt to use null image input argument
     120    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null image input argument",
     121                            "Invalid operation: inImage or its data is NULL.", 0);
     122    psImage *imageTest = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
     123    psMatrixLUD(imageTest, NULL, NULL);
     124    printFooter(stdout, "psMatrix", "Attempt to use null image input argument", true);
     125
     126
     127    // Test F - Attempt to use null input vector argument
     128    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null input vector argument",
     129                            "Invalid operation: inVector or its data is NULL.", 0);
     130    psVector *vectorBad = NULL;
     131    psVector *vectorBadOut = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
     132    psVector *permBad = (psVector*)psVectorAlloc(3, PS_TYPE_F64);
     133    psMatrixLUSolve(vectorBadOut, imageTest, vectorBad, permBad);
     134    printFooter(stdout, "psMatrix", "Attempt to use null input vector argument", true);
     135
     136
     137    // Test G - Attempt to use null LU image argument
     138    printNegativeTestHeader(stdout,"psMatrix", "Attempt to use null LU image argument",
     139                            "Invalid operation: inImage or its data is NULL.", 0);
     140    psMatrixLUSolve(vectorBadOut, NULL, vectorBad, permBad);
     141    printFooter(stdout, "psMatrix", "Attempt to use null LU image argument", true);
    101142    return 0;
    102143}
  • trunk/psLib/test/dataManip/verified/tst_psMatrix03.stdout

    r804 r872  
    24240.750000 -2.750000 -6.500000
    25254.000000 5.000000 6.000000
     26Error: Resulting image is not PS_DIMEN_IMAGE
    2627
    2728---> TESTPOINT PASSED (psMatrix{Calculate LU matrix} | tst_psMatrix03.c)
     
    3637-2.000000
    37383.000000
     39Error: Resulting image is not PS_DIMEN_VECTOR
    3840
    3941---> TESTPOINT PASSED (psMatrix{Determine solution to matrix equation} | tst_psMatrix03.c)
     
    4850---> TESTPOINT PASSED (psMatrix{Free input and output images and vectors} | tst_psMatrix03.c)
    4951
     52/----------------------------- TESTPOINT ------------------------------------------\
     53|             TestFile: tst_psMatrix03.c                                           |
     54|            TestPoint: psMatrix{Attempt to use null image input argument}         |
     55|             TestType: Negative                                                   |
     56|    ExpectedErrorText: Invalid operation: inImage or its data is NULL.            |
     57|  ExpectedStatusValue: 0                                                          |
     58\----------------------------------------------------------------------------------/
     59
     60
     61---> TESTPOINT PASSED (psMatrix{Attempt to use null image input argument} | tst_psMatrix03.c)
     62
     63/----------------------------- TESTPOINT ------------------------------------------\
     64|             TestFile: tst_psMatrix03.c                                           |
     65|            TestPoint: psMatrix{Attempt to use null input vector argument}        |
     66|             TestType: Negative                                                   |
     67|    ExpectedErrorText: Invalid operation: inVector or its data is NULL.           |
     68|  ExpectedStatusValue: 0                                                          |
     69\----------------------------------------------------------------------------------/
     70
     71
     72---> TESTPOINT PASSED (psMatrix{Attempt to use null input vector argument} | tst_psMatrix03.c)
     73
     74/----------------------------- TESTPOINT ------------------------------------------\
     75|             TestFile: tst_psMatrix03.c                                           |
     76|            TestPoint: psMatrix{Attempt to use null LU image argument}            |
     77|             TestType: Negative                                                   |
     78|    ExpectedErrorText: Invalid operation: inImage or its data is NULL.            |
     79|  ExpectedStatusValue: 0                                                          |
     80\----------------------------------------------------------------------------------/
     81
     82
     83---> TESTPOINT PASSED (psMatrix{Attempt to use null LU image argument} | tst_psMatrix03.c)
     84
Note: See TracChangeset for help on using the changeset viewer.