Changeset 17567 for trunk/psLib/test/math/tap_psMatrix02.c
- Timestamp:
- May 7, 2008, 1:12:13 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/math/tap_psMatrix02.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/math/tap_psMatrix02.c
r13124 r17567 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $15 * @date $Date: 200 7-05-02 04:20:06$14 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2008-05-07 23:12:13 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 28 28 { 29 29 psLogSetFormat("HLNM"); 30 plan_tests( 11);30 plan_tests(23); 31 31 32 32 // Input pointer same as output pointer … … 34 34 // a requirement. However, we should probably fix the case where the input 35 35 // image equals the output image. 36 if (0){36 { 37 37 psMemId id = psMemGetId(); 38 38 psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64); 39 ok(psMatrixTranspose(inImage, inImage) == NULL, "psMatrixTranspose(): inImage = outImage results in NULL"); 40 ok(psMemGetRefCounter(inImage) == 1, "psMatrixTranspose(): the output image was freed on an error."); 39 ok(psMatrixTranspose(inImage, inImage) == NULL, "psMatrixTranspose(): inImage == outImage results in NULL"); 41 40 psFree(inImage); 42 41 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 50 49 psImage *nullImage = NULL; 51 50 psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64); 52 psMemIncrRefCounter(outImage);53 51 ok(psMatrixTranspose(outImage, nullImage) == NULL, "psMatrixTranspose(): inImage = NULL results in NULL return"); 54 ok(psMemGetRefCounter(outImage) == 1, "psMatrixTranspose(): the output image was freed on an error.");55 52 psFree(outImage); 56 53 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 57 54 } 58 55 59 60 56 // Incorrect type for input pointer 61 // Merge with tap_psMatrix01.c, get rid of this test (redundant)62 57 { 63 58 psMemId id = psMemGetId(); 59 psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_U8); 64 60 psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64); 65 psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_U8); 66 psMemIncrRefCounter(outImage); 67 ok(psMatrixTranspose(outImage, badImage1) == NULL, "psMatrixTranspose(): inImage = outImage results in NULL return"); 68 ok(psMemGetRefCounter(outImage) == 1, "the output image was freed on the error."); 61 ok(psMatrixTranspose(outImage, inImage) == NULL, "psMatrixTranspose(): inImage wrong type (U8) results in NULL return"); 69 62 psFree(outImage); 70 psFree( badImage1);63 psFree(inImage); 71 64 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 72 65 } 73 66 67 // Incorrect type for input pointer 68 { 69 psMemId id = psMemGetId(); 70 psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_S32); 71 psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64); 72 ok(psMatrixTranspose(outImage, inImage) == NULL, "psMatrixTranspose(): inImage wrong type (S32) results in NULL return"); 73 psFree(outImage); 74 psFree(inImage); 75 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 76 } 74 77 75 78 // Incorrect type for output pointer … … 77 80 psMemId id = psMemGetId(); 78 81 psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64); 79 psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_U8); 80 badImage1 = psMatrixTranspose(badImage1, inImage); 81 ok(badImage1 != NULL, "psMatrixTranspose() results in non-NULL return"); 82 psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_U8); 83 outImage = psMatrixTranspose(outImage, inImage); 84 ok(outImage != NULL, "psMatrixTranspose() results in non-NULL return"); 85 82 86 // check that the type was changed. 83 ok( badImage1->type.type == PS_TYPE_F64, "the output type was changed to F64");87 ok(outImage->type.type == PS_TYPE_F64, "the output type was changed to F64"); 84 88 psFree(inImage); 85 psFree( badImage1);89 psFree(outImage); 86 90 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 87 91 } 88 92 89 90 // Matrix not square for output pointer 91 // XXX: We should probably do more here. 93 // output target matrix not square (Nx > Ny) for output pointer 92 94 { 93 95 psMemId id = psMemGetId(); 94 96 psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64); 95 psImage *badImage2 = (psImage*)psImageAlloc(3, 2, PS_TYPE_F64); 96 ok(psMatrixTranspose(badImage2, inImage) != NULL, "psMatrixTranspose(): non-square matrix results in non-NULL"); 97 psImage *outImage = (psImage*)psImageAlloc(3, 2, PS_TYPE_F64); 98 ok(psMatrixTranspose(outImage, inImage) != NULL, "psMatrixTranspose(): non-square matrix results in non-NULL"); 99 ok(outImage->numCols == 3, "psMatrixTranspose(): output matrix dimensions match input"); 100 ok(outImage->numRows == 3, "psMatrixTranspose(): output matrix dimensions match input"); 97 101 psFree(inImage); 98 psFree(badImage2); 102 psFree(outImage); 103 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 104 } 105 106 // input matrix not square (Nx < Ny) 107 { 108 psMemId id = psMemGetId(); 109 psImage *inImage = (psImage*)psImageAlloc(2, 3, PS_TYPE_F64); 110 psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64); 111 ok(psMatrixTranspose(outImage, inImage) != NULL, "psMatrixTranspose(): non-square matrix results in non-NULL"); 112 ok(outImage->numCols == 3, "psMatrixTranspose(): output matrix dimensions match input"); 113 ok(outImage->numRows == 2, "psMatrixTranspose(): output matrix dimensions match input"); 114 psFree(inImage); 115 psFree(outImage); 116 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 117 } 118 119 // input matrix not square (Nx > Ny) 120 { 121 psMemId id = psMemGetId(); 122 psImage *inImage = (psImage*)psImageAlloc(3, 2, PS_TYPE_F64); 123 psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64); 124 ok(psMatrixTranspose(outImage, inImage) != NULL, "psMatrixTranspose(): non-square matrix results in non-NULL"); 125 ok(outImage->numCols == 2, "psMatrixTranspose(): output matrix dimensions match input"); 126 ok(outImage->numRows == 3, "psMatrixTranspose(): output matrix dimensions match input"); 127 psFree(inImage); 128 psFree(outImage); 99 129 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 100 130 }
Note:
See TracChangeset
for help on using the changeset viewer.
