Changeset 872
- Timestamp:
- Jun 4, 2004, 1:42:57 PM (22 years ago)
- Location:
- trunk/psLib/test/dataManip
- Files:
-
- 1 added
- 2 edited
-
tst_psMatrix03.c (modified) (6 diffs)
-
verified/tst_psMatrix03.stderr (added)
-
verified/tst_psMatrix03.stdout (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataManip/tst_psMatrix03.c
r831 r872 8 8 * C) Determine solution to matrix equation 9 9 * 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 * 11 14 * @author Ross Harman, MHPCC 12 15 * 13 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-06-0 2 23:29:39$16 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2004-06-04 23:42:18 $ 15 18 * 16 19 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 21 24 #include "psTest.h" 22 25 23 #define PRINT_MATRIX(IMAGE) \26 #define PRINT_MATRIX(IMAGE) \ 24 27 for(int i=IMAGE->numRows-1; i>-1; i--) { \ 25 28 for(int j=0; j<IMAGE->numCols; j++) { \ 26 29 printf("%f ", IMAGE->data.F64[i][j]); \ 27 } \28 printf("\n"); \30 } \ 31 printf("\n"); \ 29 32 } 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) \ 35 for(int i=0; i<VECTOR->n; i++) { \ 36 printf("%f\n", VECTOR->data.F64[i]); \ 34 37 } 35 38 … … 40 43 psImage *luImage = NULL; 41 44 psImage *inImage = NULL; 45 psImage *tempImage = NULL; 46 psVector *tempVector = NULL; 42 47 psVector *perm = NULL; 43 48 psVector *outVector = NULL; … … 73 78 // Test B - Calculate LU matrix 74 79 printPositiveTestHeader(stdout, "psMatrix", "Calculate LU matrix"); 75 psMatrixLUD(luImage, perm, inImage); 80 tempImage = luImage; 81 luImage = psMatrixLUD(luImage, perm, inImage); 76 82 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 } 77 88 printFooter(stdout, "psMatrix", "Calculate LU matrix", true); 78 89 … … 80 91 // Test C - Determine solution to matrix equation 81 92 printPositiveTestHeader(stdout, "psMatrix", "Determine solution to matrix equation"); 82 psMatrixLUSolve(outVector, luImage, inVector, perm); 93 tempVector = outVector; 94 outVector = psMatrixLUSolve(outVector, luImage, inVector, perm); 83 95 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 } 84 101 printFooter(stdout, "psMatrix", "Determine solution to matrix equation", true); 85 102 … … 99 116 printFooter(stdout, "psMatrix" ,"Free input and output images and vectors", true); 100 117 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); 101 142 return 0; 102 143 } -
trunk/psLib/test/dataManip/verified/tst_psMatrix03.stdout
r804 r872 24 24 0.750000 -2.750000 -6.500000 25 25 4.000000 5.000000 6.000000 26 Error: Resulting image is not PS_DIMEN_IMAGE 26 27 27 28 ---> TESTPOINT PASSED (psMatrix{Calculate LU matrix} | tst_psMatrix03.c) … … 36 37 -2.000000 37 38 3.000000 39 Error: Resulting image is not PS_DIMEN_VECTOR 38 40 39 41 ---> TESTPOINT PASSED (psMatrix{Determine solution to matrix equation} | tst_psMatrix03.c) … … 48 50 ---> TESTPOINT PASSED (psMatrix{Free input and output images and vectors} | tst_psMatrix03.c) 49 51 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.
