Changeset 988 for trunk/psLib/test/collections/tst_psSort_01.c
- Timestamp:
- Jun 10, 2004, 1:14:22 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/collections/tst_psSort_01.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/collections/tst_psSort_01.c
r831 r988 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-06- 02 23:29:29$12 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-06-10 23:14:22 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 25 25 psVector *in = NULL; 26 26 psVector *out = NULL; 27 psVector *tempVec = NULL; 27 28 28 29 29 30 // Test A - Create float vectors 30 31 printPositiveTestHeader(stdout,"psSort", "Create float vectors"); 31 in = psVectorAlloc( 5, PS_TYPE_F32);32 in->n = 5;33 out = psVectorAlloc( 5, PS_TYPE_F32);34 out->n = 5;32 in = psVectorAlloc(7, PS_TYPE_F32); 33 in->n = 7; 34 out = psVectorAlloc(7, PS_TYPE_F32); 35 out->n = 7; 35 36 in->data.F32[0] = 7.0f; 36 37 in->data.F32[1] = 9.0f; … … 38 39 in->data.F32[3] = 1.0f; 39 40 in->data.F32[4] = 5.0f; 40 for(int i=0; i<5; i++) { 41 in->data.F32[5] = 5.0f; 42 in->data.F32[6] = -20.0f; 43 for(int i=0; i<7; i++) { 41 44 printf("vec[%d] = %f\n", i, in->data.F32[i]); 42 45 } … … 46 49 // Test B - Sort input float vector and put results into output float vector 47 50 printPositiveTestHeader(stdout,"psSort", "Sort float vector"); 51 tempVec = out; 48 52 out = psSort(out, in); 49 for(int i=0; i< 5; i++) {53 for(int i=0; i<7; i++) { 50 54 printf("vec[%d] = %f\n", i, out->data.F32[i]); 55 } 56 if(out != tempVec) { 57 printf("Error: Return pointer not equal to output argument pointer\n"); 51 58 } 52 59 printFooter(stdout, "psSort", "Sort float vector", true); 53 60 54 61 55 // Test C - Free float vectors 62 // Test C - Sort input float vector into itself 63 printPositiveTestHeader(stdout,"psSort", "Sort input float vector into itself"); 64 in = psSort(in, in); 65 for(int i=0; i<7; i++) { 66 printf("vec[%d] = %f\n", i, out->data.F32[i]); 67 } 68 printFooter(stdout, "psSort", "Sort input float vector into itself", true); 69 70 71 // Test D - Free float vectors 56 72 printPositiveTestHeader(stdout,"psSort", "Free float vectors"); 57 73 psVectorFree(in);
Note:
See TracChangeset
for help on using the changeset viewer.
