Changeset 688
- Timestamp:
- May 14, 2004, 11:04:23 AM (22 years ago)
- Location:
- trunk/psLib/test/collections
- Files:
-
- 6 deleted
- 5 edited
-
Makefile (modified) (3 diffs)
-
tst_psArray_01.c (deleted)
-
tst_psArray_02.c (deleted)
-
tst_psArray_03.c (deleted)
-
tst_psArray_04.c (deleted)
-
tst_psArray_05.c (deleted)
-
tst_psArray_06.c (deleted)
-
tst_psSort_01.c (modified) (3 diffs)
-
tst_psSort_02.c (modified) (3 diffs)
-
tst_psSort_03.c (modified) (3 diffs)
-
tst_psSort_04.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/collections/Makefile
r595 r688 3 3 ## Makefile: test/collections 4 4 ## 5 ## $Revision: 1. 2$ $Name: not supported by cvs2svn $6 ## $Date: 2004-05- 06 23:23:02$5 ## $Revision: 1.3 $ $Name: not supported by cvs2svn $ 6 ## $Date: 2004-05-14 21:04:23 $ 7 7 ## 8 8 ## Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 16 16 PSLIB_LIB_DIR = ../../lib 17 17 18 TARGET = tst_psArray_01 \ 19 tst_psArray_02 \ 20 tst_psArray_03 \ 21 tst_psArray_04 \ 22 tst_psArray_05 \ 23 tst_psArray_06 \ 18 TARGET = tst_psVector_01 \ 19 tst_psVector_02 \ 20 tst_psVector_03 \ 24 21 tst_psBitSet_01 \ 25 22 tst_psBitSet_02 \ … … 35 32 all: $(TARGET) 36 33 37 tst_psArray_01: tst_psArray_01.o 38 tst_psArray_02: tst_psArray_02.o 39 tst_psArray_03: tst_psArray_03.o 40 tst_psArray_04: tst_psArray_04.o 41 tst_psArray_05: tst_psArray_05.o 42 tst_psArray_06: tst_psArray_06.o 34 tst_psVector_01: tst_psVector_01.o 35 tst_psVector_02: tst_psVector_02.o 36 tst_psVector_03: tst_psVector_03.o 43 37 tst_psBitSet_01: tst_psBitSet_01.o 44 38 tst_psBitSet_02: tst_psBitSet_02.o -
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 } -
trunk/psLib/test/collections/tst_psSort_02.c
r620 r688 4 4 * 5 5 * This test driver contains the following tests for psSort test point 2: 6 * A) Create arrays7 * B) Sort integer array of indices based on pre-sort order of floating point array8 * C) Free arrays6 * A) Create vectors 7 * B) Sort integer vector of indices based on pre-sort order of floating point vector 8 * C) Free 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 arrays");31 in = ps FloatArrayAlloc(5);29 // Test A - Create float vectors 30 printPositiveTestHeader(stdout,"psSort", "Create vectors"); 31 in = psVectorAlloc(PS_TYPE_FLOAT, 5); 32 32 in->n = 5; 33 out = ps IntArrayAlloc(5);33 out = psVectorAlloc(PS_TYPE_INT32, 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("arr[%d] = %f\n", i, in->vec.f[i]); 42 42 } 43 printFooter(stdout, "psSort", "Create arrays", true);43 printFooter(stdout, "psSort", "Create vectors", true); 44 44 45 45 46 // Test B - Sort integer array of indices based on pre-sort order of floating point array47 printPositiveTestHeader(stdout,"psSort", "Create sorted index array");46 // Test B - Sort integer vector of indices based on pre-sort order of floating point vector 47 printPositiveTestHeader(stdout,"psSort", "Create sorted index vector"); 48 48 out = psSortIndex(out, in); 49 49 for(int i=0; i<5; i++) { 50 printf("arr[%d] = %d\n", i, out-> arr.intArr[i]);50 printf("arr[%d] = %d\n", i, out->vec.i32[i]); 51 51 } 52 printFooter(stdout, "psSort", "Create sorted index array", true);52 printFooter(stdout, "psSort", "Create sorted index vector", true); 53 53 54 54 55 // Test C - Free arrays56 printPositiveTestHeader(stdout,"psSort", "Free arrays");57 ps FloatArrayFree(in);58 ps IntArrayFree(out);55 // Test C - Free vectors 56 printPositiveTestHeader(stdout,"psSort", "Free 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 arrays", true);64 printFooter(stdout, "psSort", "Free vectors", true); 65 65 66 66 } -
trunk/psLib/test/collections/tst_psSort_03.c
r620 r688 4 4 * 5 5 * This test driver contains the following tests for psSort test point 3: 6 * A) Create float arrays of different sizes7 * B) Attempt to sort arrays...should get errors8 * C) Free float arrays6 * A) Create float vectors of different sizes 7 * B) Attempt to sort vectors...should get errors 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 of different sizes");31 in = ps FloatArrayAlloc(5);29 // Test A - Create float vectors 30 printPositiveTestHeader(stdout,"psSort", "Create float vectors of different sizes"); 31 in = psVectorAlloc(PS_TYPE_FLOAT, 5); 32 32 in->n = 5; 33 out = ps FloatArrayAlloc(6);33 out = psVectorAlloc(PS_TYPE_FLOAT, 6); 34 34 out->n = 6; 35 35 in->n = 5; 36 36 for(int i=0; i<5; i++) { 37 printf("arr[%d] = %f\n", i, in-> arr.fltArr[i]);37 printf("arr[%d] = %f\n", i, in->vec.f[i]); 38 38 } 39 printFooter(stdout, "psSort", "Create float arrays of different sizes", true);39 printFooter(stdout, "psSort", "Create float vectors of different sizes", true); 40 40 41 41 42 // Test B - Sort input float array and put results into output float array43 printNegativeTestHeader(stdout,"psSort", "Sort float array",44 "Input and output arraysizes are not equal", 0);42 // Test B - Sort input float vector and put results into output float vector 43 printNegativeTestHeader(stdout,"psSort", "Sort float vector", 44 "Input and output vector sizes are not equal", 0); 45 45 out = psSort(out, in); 46 printFooter(stdout, "psSort", "Sort float array", true);46 printFooter(stdout, "psSort", "Sort float vector", true); 47 47 48 48 49 // Test C - Free float arrays50 printPositiveTestHeader(stdout,"psSort", "Free float arrays");51 ps FloatArrayFree(in);52 ps FloatArrayFree(out);49 // Test C - Free float vectors 50 printPositiveTestHeader(stdout,"psSort", "Free float vectors"); 51 psVectorFree(in); 52 psVectorFree(out); 53 53 psMemCheckLeaks(0, NULL, stdout); 54 54 int nBad = psMemCheckCorruption(0); … … 56 56 printf("ERROR: Found %d bad memory blocks\n", nBad); 57 57 } 58 printFooter(stdout, "psSort", "Free float arrays", true);58 printFooter(stdout, "psSort", "Free float vectors", true); 59 59 60 60 } -
trunk/psLib/test/collections/tst_psSort_04.c
r620 r688 4 4 * 5 5 * This test driver contains the following tests for psSort test point 4: 6 * A) Attempt to sort with null input array7 * B) Attempt to sort with null output array8 * C) Free arrays6 * A) Attempt to sort with null input vector 7 * B) Attempt to sort with null output vector 8 * C) Free 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*badIn = NULL;26 ps Array*badOut = NULL;27 ps Array *goodIn = psFloatArrayAlloc(5);28 ps Array *goodOut = psFloatArrayAlloc(5);25 psVector *badIn = NULL; 26 psVector *badOut = NULL; 27 psVector *goodIn = psVectorAlloc(PS_TYPE_FLOAT, 5); 28 psVector *goodOut = psVectorAlloc(PS_TYPE_FLOAT, 5); 29 29 30 // Test A - Attempt to sort with null input array31 printNegativeTestHeader(stdout,"psSort", "Attempt to sort with null input array",32 "Null input array", 0);30 // Test A - Attempt to sort with null input vector 31 printNegativeTestHeader(stdout,"psSort", "Attempt to sort with null input vector", 32 "Null input vector", 0); 33 33 goodOut = psSort(goodOut, badIn); 34 printFooter(stdout, "psSort", "Attempt to sort with null input array", true);34 printFooter(stdout, "psSort", "Attempt to sort with null input vector", true); 35 35 36 // Test B - Attempt to sort with null output array37 printNegativeTestHeader(stdout,"psSort", "Attempt to sort with null output array",38 "Null output array", 0);36 // Test B - Attempt to sort with null output vector 37 printNegativeTestHeader(stdout,"psSort", "Attempt to sort with null output vector", 38 "Null output vector", 0); 39 39 badOut = psSort(badOut, goodIn); 40 printFooter(stdout, "psSort", "Attempt to sort with null output array", true);40 printFooter(stdout, "psSort", "Attempt to sort with null output vector", true); 41 41 42 // Test C - Free arrays43 printPositiveTestHeader(stdout, "psSort", "Free arrays");44 ps FloatArrayFree(goodIn);45 ps FloatArrayFree(goodOut);42 // Test C - Free vectors 43 printPositiveTestHeader(stdout, "psSort", "Free vectors"); 44 psVectorFree(goodIn); 45 psVectorFree(goodOut); 46 46 psMemCheckLeaks(0, NULL, stdout); 47 47 int nBad = psMemCheckCorruption(0);
Note:
See TracChangeset
for help on using the changeset viewer.
