Changeset 831 for trunk/psLib/test/collections/tst_psVector_02.c
- Timestamp:
- Jun 2, 2004, 1:29:39 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/collections/tst_psVector_02.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/collections/tst_psVector_02.c
r717 r831 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-0 5-18 19:22:34$14 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-06-02 23:29:29 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 39 39 // Test A - Create void pointer vector 40 40 printPositiveTestHeader(stdout,"psVector", "Create void pointer vector"); 41 psVector *psVec = psVectorAlloc( PS_TYPE_PTR, 5);41 psVector *psVec = psVectorAlloc(5, PS_TYPE_PTR); 42 42 printf("Vector size = %d\n", psVec->nalloc); 43 43 printf("Vector population = %d\n", psVec->n); … … 52 52 ts->y = 10.1*i; 53 53 mySt[i] = ts; 54 psVec-> vec.vp[i] = ts;54 psVec->data.PTR[i] = ts; 55 55 psVec->n++; 56 56 psMemIncrRefCounter(ts); … … 58 58 59 59 for(int i = 0; i < 5; i++) { 60 testStruct *ts = (testStruct*)psVec-> vec.vp[i];60 testStruct *ts = (testStruct*)psVec->data.PTR[i]; 61 61 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); 62 62 } … … 68 68 // Test C - Reallocate void pointer vector bigger 69 69 printPositiveTestHeader(stdout,"psVector", "Reallocate void pointer vector bigger"); 70 psVec = psVectorRealloc( psVec, 10);70 psVec = psVectorRealloc(10, psVec); 71 71 printf("Adding more elements to void pointer vector...\n"); 72 72 for(int i = 5; i < 10; i++) { … … 75 75 ts->y = 10.1*i; 76 76 mySt[i] = ts; 77 psVec-> vec.vp[i] = ts;77 psVec->data.PTR[i] = ts; 78 78 psVec->n++; 79 79 psMemIncrRefCounter(ts); 80 80 } 81 81 for(int i = 0; i < 10; i++) { 82 testStruct *ts = (testStruct*)psVec-> vec.vp[i];82 testStruct *ts = (testStruct*)psVec->data.PTR[i]; 83 83 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); 84 84 } … … 90 90 // Test D - Reallocate void pointer vector smaller 91 91 printPositiveTestHeader(stdout,"psVector","Reallocate void pointer vector smaller"); 92 psVec = psVectorRealloc( psVec, 3);92 psVec = psVectorRealloc(3, psVec); 93 93 for(int i = 0; i < 3; i++) { 94 testStruct *ts = (testStruct*)psVec-> vec.vp[i];94 testStruct *ts = (testStruct*)psVec->data.PTR[i]; 95 95 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); 96 96 }
Note:
See TracChangeset
for help on using the changeset viewer.
