Changeset 688 for trunk/psLib/test/collections/tst_psSort_01.c
- Timestamp:
- May 14, 2004, 11:04:23 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/collections/tst_psSort_01.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/collections/tst_psSort_01.c
r620 r688 4 4 * 5 5 * This test driver contains the following tests for psSort test point 1: 6 * A) Create float arrays7 * B) Sort input float array and put results into output float array8 * C) Free float arrays6 * A) Create float vectors 7 * B) Sort input float vector and put results into output float vector 8 * C) Free float vectors 9 9 * 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-05- 08 01:19:28$12 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-05-14 21:04:23 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 char* argv[]) 24 24 { 25 ps Array*in = NULL;26 ps Array*out = NULL;25 psVector *in = NULL; 26 psVector *out = NULL; 27 27 28 28 29 // Test A - Create float arrays30 printPositiveTestHeader(stdout,"psSort", "Create float arrays");31 in = ps FloatArrayAlloc(5);29 // Test A - Create float vectors 30 printPositiveTestHeader(stdout,"psSort", "Create float vectors"); 31 in = psVectorAlloc(PS_TYPE_FLOAT, 5); 32 32 in->n = 5; 33 out = ps FloatArrayAlloc(5);33 out = psVectorAlloc(PS_TYPE_FLOAT, 5); 34 34 out->n = 5; 35 in-> arr.fltArr[0] = 7.0f;36 in-> arr.fltArr[1] = 9.0f;37 in-> arr.fltArr[2] = 3.0f;38 in-> arr.fltArr[3] = 1.0f;39 in-> arr.fltArr[4] = 5.0f;35 in->vec.f[0] = 7.0f; 36 in->vec.f[1] = 9.0f; 37 in->vec.f[2] = 3.0f; 38 in->vec.f[3] = 1.0f; 39 in->vec.f[4] = 5.0f; 40 40 for(int i=0; i<5; i++) { 41 printf(" arr[%d] = %f\n", i, in->arr.fltArr[i]);41 printf("vec[%d] = %f\n", i, in->vec.f[i]); 42 42 } 43 printFooter(stdout, "psSort", "Create float arrays", true);43 printFooter(stdout, "psSort", "Create float vectors", true); 44 44 45 45 46 // Test B - Sort input float array and put results into output float array47 printPositiveTestHeader(stdout,"psSort", "Sort float array");46 // Test B - Sort input float vector and put results into output float vector 47 printPositiveTestHeader(stdout,"psSort", "Sort float vector"); 48 48 out = psSort(out, in); 49 49 for(int i=0; i<5; i++) { 50 printf(" arr[%d] = %f\n", i, out->arr.fltArr[i]);50 printf("vec[%d] = %f\n", i, out->vec.f[i]); 51 51 } 52 printFooter(stdout, "psSort", "Sort float array", true);52 printFooter(stdout, "psSort", "Sort float vector", true); 53 53 54 54 55 // Test C - Free float arrays56 printPositiveTestHeader(stdout,"psSort", "Free float arrays");57 ps FloatArrayFree(in);58 ps FloatArrayFree(out);55 // Test C - Free float vectors 56 printPositiveTestHeader(stdout,"psSort", "Free float vectors"); 57 psVectorFree(in); 58 psVectorFree(out); 59 59 psMemCheckLeaks(0, NULL, stdout); 60 60 int nBad = psMemCheckCorruption(0); … … 62 62 printf("ERROR: Found %d bad memory blocks\n", nBad); 63 63 } 64 printFooter(stdout, "psSort", "Free float arrays", true);64 printFooter(stdout, "psSort", "Free float vectors", true); 65 65 66 return 0; 66 67 }
Note:
See TracChangeset
for help on using the changeset viewer.
