Changeset 2204 for trunk/psLib/test/collections/tst_psArray.c
- Timestamp:
- Oct 26, 2004, 2:57:34 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/collections/tst_psArray.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/collections/tst_psArray.c
r1920 r2204 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $15 * @date $Date: 2004- 09-28 23:26:49$14 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-10-27 00:57:33 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 typedef struct 27 27 { 28 intx;28 psS32 x; 29 29 float y; 30 30 } … … 32 32 33 33 34 int main(intargc,35 char* argv[])34 psS32 main(psS32 argc, 35 char* argv[]) 36 36 { 37 37 // Create array of pointers … … 51 51 // Test B - Add data to void pointer array 52 52 printPositiveTestHeader(stdout, "psArray", "Add data to void pointer array"); 53 for( inti = 0; i < 5; i++) {53 for(psS32 i = 0; i < 5; i++) { 54 54 testStruct *ts = psAlloc(sizeof(testStruct)); 55 55 ts->x = 10*i; … … 60 60 } 61 61 62 for( inti = 0; i < 5; i++) {62 for(psS32 i = 0; i < 5; i++) { 63 63 testStruct *ts = (testStruct*)psArr->data[i]; 64 64 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); … … 85 85 psArr = psArrayRealloc(psArr,10); 86 86 printf("Adding more elements to void pointer array...\n"); 87 for( inti = 5; i < 10; i++) {87 for(psS32 i = 5; i < 10; i++) { 88 88 testStruct *ts = psAlloc(sizeof(testStruct)); 89 89 ts->x = 10*i; … … 94 94 psMemIncrRefCounter(ts); 95 95 } 96 for( inti = 0; i < 10; i++) {96 for(psS32 i = 0; i < 10; i++) { 97 97 testStruct *ts = (testStruct*)psArr->data[i]; 98 98 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); … … 118 118 printPositiveTestHeader(stdout,"psArray","Reallocate void pointer array smaller"); 119 119 psArr = psArrayRealloc(psArr,3); 120 for( inti = 0; i < 3; i++) {120 for(psS32 i = 0; i < 3; i++) { 121 121 testStruct *ts = (testStruct*)psArr->data[i]; 122 122 printf("ts[%d].x = %d ts[%d].y = %.2f\n", i, ts->x, i, ts->y); … … 142 142 printPositiveTestHeader(stdout, "psArray", "Free void pointer array"); 143 143 psFree(psArr); 144 for( inti = 0; i < 10; i++) {144 for(psS32 i = 0; i < 10; i++) { 145 145 psFree(mySt[i]); 146 146 } 147 147 psMemCheckLeaks(0, NULL, stdout); 148 intnBad = psMemCheckCorruption(0);148 psS32 nBad = psMemCheckCorruption(0); 149 149 if(nBad) { 150 150 printf("ERROR: Found %d bad memory blocks\n", nBad);
Note:
See TracChangeset
for help on using the changeset viewer.
