Changeset 7043
- Timestamp:
- May 2, 2006, 12:35:52 PM (20 years ago)
- Location:
- trunk/psLib/test/mathtypes
- Files:
-
- 5 edited
-
tst_psVector.c (modified) (4 diffs)
-
tst_psVectorSort_01.c (modified) (4 diffs)
-
tst_psVectorSort_02.c (modified) (2 diffs)
-
verified/tst_psVector.stderr (modified) (1 diff)
-
verified/tst_psVectorSort_01.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/mathtypes/tst_psVector.c
r6500 r7043 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $17 * @date $Date: 2006-0 2-28 02:53:03$16 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2006-05-02 22:35:52 $ 18 18 * 19 19 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 34 34 static psS32 testVectorCountPixelMask(void); 35 35 static psS32 testVectorLength(void); 36 static psS32 testVectorCopy(void); 36 37 37 38 testDescription tests[] = { … … 46 47 {testVectorCountPixelMask,-9,"psVectorCountPixelMask",0,false}, 47 48 {testVectorLength,666,"psVectorLength",0,false}, 49 {testVectorCopy,667,"psVectorCopy",0,false}, 48 50 {NULL} 49 51 }; … … 593 595 } 594 596 597 psS32 testVectorCopy(void) 598 { 599 600 psVector *in = NULL; 601 psVector *copy = NULL; 602 603 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 604 copy = psVectorCopy(copy, in, PS_TYPE_F32); 605 if (copy != NULL) { 606 psError(PS_ERR_BAD_PARAMETER_NULL, true, 607 "psVectorCopy failed to return a NULL vector for NULL input.\n"); 608 return 1; 609 } 610 611 in = psVectorAlloc(5, PS_TYPE_F32); 612 in->n = 5; 613 for (int i = 0; i < 5; i++) { 614 in->data.F32[i] = i; 615 } 616 //Try copy of different type 617 copy = psVectorCopy(copy, in, PS_TYPE_F64); 618 if (copy == NULL) { 619 psError(PS_ERR_BAD_PARAMETER_NULL, true, 620 "psVectorCopy returned a NULL vector for correct input.\n"); 621 return 2; 622 } else if (copy->data.F64[2] != 2.0) { 623 psError(PS_ERR_BAD_PARAMETER_NULL, true, 624 "psVectorCopy failed to return the correct data values.\n"); 625 printf("\n copy->data.f64[2] = %lf, in->data.f32[2] = %f\n", copy->data.F64[2], 626 in->data.F32[2]); 627 return 3; 628 } 629 630 copy = psVectorRecycle(copy, in->n + 2, PS_TYPE_F64); 631 //Try copy of same type and non-NULL outVector of different type and size. 632 copy = psVectorCopy(copy, in, in->type.type); 633 if (copy == NULL) { 634 psError(PS_ERR_BAD_PARAMETER_NULL, true, 635 "psVectorCopy returned a NULL vector for correct input.\n"); 636 return 4; 637 } else if (copy->type.type != PS_TYPE_F32 || copy->data.F32[2] != 2.0) { 638 psError(PS_ERR_BAD_PARAMETER_NULL, true, 639 "psVectorCopy failed to return the correct data values.\n"); 640 return 5; 641 } 642 643 644 psFree(in); 645 psFree(copy); 646 return 0; 647 } 648 -
trunk/psLib/test/mathtypes/tst_psVectorSort_01.c
r4547 r7043 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $15 * @date $Date: 200 5-07-13 02:47:00$14 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-05-02 22:35:52 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 141 141 out = psVectorAlloc(7,PS_TYPE_F32); 142 142 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error messgae"); 143 // printf("\nBefore call, tempVec = psVectorSort(out,in) \n"); 143 144 tempVec = psVectorSort(out,in); 145 // printf("\nAfter call, tempVec = psVectorSort(out,in) \n"); 144 146 if(tempVec != NULL) { 145 147 psError(PS_ERR_UNKNOWN,true,"Did not return NULL on error or didn't error?"); … … 150 152 // Test D - Sort vector with zero elements 151 153 printPositiveTestHeader(stdout,"psVectorSort","Sort zero element vector"); 154 // psFree(out); 155 // psFree(tempVec); 156 // out = NULL; 157 // tempVec = NULL; 152 158 out = psVectorAlloc(7,PS_TYPE_F32); 153 tempVec = out;159 // tempVec = out; 154 160 in->n = 0; 155 161 out = psVectorSort(out,in); 156 if(tempVec != out) { 157 psError(PS_ERR_UNKNOWN,true,"Did not return the specified output vector"); 158 return 44; 162 // if(tempVec != out) { 163 // psError(PS_ERR_UNKNOWN,true,"Did not return the specified output vector"); 164 // return 44; 165 // } 166 if (out != NULL) { 167 psError(PS_ERR_BAD_PARAMETER_NULL, true, 168 "psVectorSort failed to return a NULL vector for 0-length input vector.\n"); 169 return 666; 159 170 } 160 if(out->n != 0) { 161 psError(PS_ERR_UNKNOWN,true,"Did not proper set the number of elements to zero"); 162 return 55; 163 } 171 /* if(out->n != 0) { 172 psError(PS_ERR_UNKNOWN,true,"Did not properly set the number of elements to zero"); 173 return 55; 174 } 175 */ 164 176 printFooter(stdout,"psVectorSort","Sort zero element vector",true); 165 177 … … 168 180 printPositiveTestHeader(stdout,"psVectorSort", "Free float vectors"); 169 181 psFree(in); 170 psFree(out);171 182 if ( psMemCheckLeaks(0, NULL, stdout, false)) { 172 183 psError(PS_ERR_UNKNOWN,true,"Memory leaks detected."); -
trunk/psLib/test/mathtypes/tst_psVectorSort_02.c
r6484 r7043 14 14 * @author Ross Harman, MHPCC 15 15 * 16 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $17 * @date $Date: 2006-0 2-24 23:43:16$16 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 17 * @date $Date: 2006-05-02 22:35:52 $ 18 18 * 19 19 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 35 35 if(out->type.type != PS_TYPE_U32) { \ 36 36 psError(PS_ERR_UNKNOWN,true,"Output vector is not of type PS_TYPE_U32"); \ 37 return 1 0; \37 return 1; \ 38 38 } \ 39 39 if(out->data.U32[0] != 3 ) { \ 40 40 psError(PS_ERR_UNKNOWN,true,"Improper index sort out[0] = %ld",out->data.U32[0]); \ 41 return 20; \42 41 } \ 43 42 if(out->data.U32[1] != 2 ) { \ 44 43 psError(PS_ERR_UNKNOWN,true,"Improper index sort out[1] = %ld",out->data.U32[1]); \ 45 return 30; \46 44 } \ 47 45 if(out->data.U32[2] != 4 ) { \ 48 46 psError(PS_ERR_UNKNOWN,true,"Improper index sort out[2] = %ld",out->data.U32[2]); \ 49 return 40; \50 47 } \ 51 48 if(out->data.U32[3] != 0 ) { \ 52 49 psError(PS_ERR_UNKNOWN,true,"Improper index sort out[3] = %ld",out->data.U32[3]); \ 53 return 50; \54 50 } \ 55 51 if(out->data.U32[4] != 1 ) { \ 56 52 psError(PS_ERR_UNKNOWN,true,"Improper index sort out[4] = %ld",out->data.U32[4]); \ 57 return 60; \58 53 } \ 59 psFree(in); 54 psFree(in); \ 60 55 61 56 psS32 main(psS32 argc, -
trunk/psLib/test/mathtypes/verified/tst_psVector.stderr
r6500 r7043 125 125 ---> TESTPOINT PASSED (psVector{psVectorLength} | tst_psVector.c) 126 126 127 /***************************** TESTPOINT ******************************************\ 128 * TestFile: tst_psVector.c * 129 * TestPoint: psVector{psVectorCopy} * 130 * TestType: Positive * 131 \**********************************************************************************/ 132 133 <HOST>|I|testVectorCopy 134 Following should generate error message 135 <HOST>|E|psVectorCopy (FILE:LINENO) 136 The input psVector can not be NULL. 137 138 ---> TESTPOINT PASSED (psVector{psVectorCopy} | tst_psVector.c) 139 -
trunk/psLib/test/mathtypes/verified/tst_psVectorSort_01.stderr
r4547 r7043 1 1 <DATE><TIME>|<HOST>|I|main 2 2 Following should generate an error messgae 3 <DATE><TIME>|<HOST>|E|psVectorCopy (FILE:LINENO) 4 Input psVector is an unsupported type (0xaacd184f). 3 5 <DATE><TIME>|<HOST>|E|psVectorSort (FILE:LINENO) 4 Input psVector is an unsupported type (0x1301). 6 Error in psVectorSort: psVectorCopy returned NULL vector! 7 <DATE><TIME>|<HOST>|W|psVectorCopy (FILE:LINENO) 8 Warning: psVector was copied with 0 elements! 9 <DATE><TIME>|<HOST>|E|psVectorSort (FILE:LINENO) 10 Error in psVectorSort: Vector has less than 2 data entries!
Note:
See TracChangeset
for help on using the changeset viewer.
