Changeset 831 for trunk/psLib/test/collections/tst_psVector_03.c
- Timestamp:
- Jun 2, 2004, 1:29:39 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/collections/tst_psVector_03.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/collections/tst_psVector_03.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 … … 44 44 // Test A - Create void pointer vector 45 45 printPositiveTestHeader(stdout,"psVector", "Create void pointer vector"); 46 psVector *psVec = psVectorAlloc( PS_TYPE_PTR, 5);46 psVector *psVec = psVectorAlloc(5, PS_TYPE_PTR); 47 47 printf("Vector size = %d\n", psVec->nalloc); 48 48 printf("Vector population = %d\n", psVec->n); … … 57 57 ts->y = 10.1*i; 58 58 mySt[i] = ts; 59 psVec-> vec.vp[i] = ts;59 psVec->data.PTR[i] = ts; 60 60 psVec->n++; 61 61 psMemIncrRefCounter(ts); … … 63 63 64 64 for(int i = 0; i < 5; i++) { 65 testStruct *ts = (testStruct*)psVec-> vec.vp[i];65 testStruct *ts = (testStruct*)psVec->data.PTR[i]; 66 66 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); 67 67 } … … 73 73 // Test C - Reallocate void pointer vector bigger 74 74 printPositiveTestHeader(stdout,"psVector", "Reallocate void pointer vector bigger"); 75 psVec = psVectorRealloc( psVec, 10);75 psVec = psVectorRealloc(10, psVec); 76 76 printf("Adding more elements to void pointer vector...\n"); 77 77 for(int i = 5; i < 10; i++) { … … 80 80 ts->y = 10.1*i; 81 81 mySt[i] = ts; 82 psVec-> vec.vp[i] = ts;82 psVec->data.PTR[i] = ts; 83 83 psVec->n++; 84 84 psMemIncrRefCounter(ts); 85 85 } 86 86 for(int i = 0; i < 10; i++) { 87 testStruct *ts = (testStruct*)psVec-> vec.vp[i];87 testStruct *ts = (testStruct*)psVec->data.PTR[i]; 88 88 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); 89 89 } … … 95 95 // Test D - Reallocate void pointer vector smaller 96 96 printPositiveTestHeader(stdout,"psVector","Reallocate void pointer vector smaller"); 97 psVec = psVectorRealloc( psVec, 3);97 psVec = psVectorRealloc(3, psVec); 98 98 for(int i = 0; i < 3; i++) { 99 testStruct *ts = (testStruct*)psVec-> vec.vp[i];99 testStruct *ts = (testStruct*)psVec->data.PTR[i]; 100 100 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); 101 101 }
Note:
See TracChangeset
for help on using the changeset viewer.
