IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 688


Ignore:
Timestamp:
May 14, 2004, 11:04:23 AM (22 years ago)
Author:
harman
Message:

Updated tests to reflect major changes to psVector

Location:
trunk/psLib/test/collections
Files:
6 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/collections/Makefile

    r595 r688  
    33##  Makefile:   test/collections
    44##
    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 $
    77##
    88##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1616PSLIB_LIB_DIR = ../../lib
    1717
    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  \
     18TARGET = tst_psVector_01 \
     19         tst_psVector_02 \
     20         tst_psVector_03 \
    2421         tst_psBitSet_01 \
    2522         tst_psBitSet_02 \
     
    3532all: $(TARGET)
    3633
    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
     34tst_psVector_01: tst_psVector_01.o
     35tst_psVector_02: tst_psVector_02.o
     36tst_psVector_03: tst_psVector_03.o
    4337tst_psBitSet_01: tst_psBitSet_01.o
    4438tst_psBitSet_02: tst_psBitSet_02.o
  • trunk/psLib/test/collections/tst_psSort_01.c

    r620 r688  
    44 *
    55 *  This test driver contains the following tests for psSort test point 1:
    6  *     A)  Create float arrays
    7  *     B)  Sort input float array and put results into output float array
    8  *     C)  Free float arrays
     6 *     A)  Create float vectors
     7 *     B)  Sort input float vector and put results into output float vector
     8 *     C)  Free float vectors
    99 *
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    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 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323         char* argv[])
    2424{
    25     psArray *in = NULL;
    26     psArray *out = NULL;
     25    psVector *in = NULL;
     26    psVector *out = NULL;
    2727
    2828
    29     // Test A - Create float arrays
    30     printPositiveTestHeader(stdout,"psSort", "Create float arrays");
    31     in = psFloatArrayAlloc(5);
     29    // Test A - Create float vectors
     30    printPositiveTestHeader(stdout,"psSort", "Create float vectors");
     31    in = psVectorAlloc(PS_TYPE_FLOAT, 5);
    3232    in->n = 5;
    33     out = psFloatArrayAlloc(5);
     33    out = psVectorAlloc(PS_TYPE_FLOAT, 5);
    3434    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;
    4040    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]);
    4242    }
    43     printFooter(stdout, "psSort", "Create float arrays", true);
     43    printFooter(stdout, "psSort", "Create float vectors", true);
    4444
    4545
    46     // Test B - Sort input float array and put results into output float array
    47     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");
    4848    out = psSort(out, in);
    4949    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]);
    5151    }
    52     printFooter(stdout, "psSort", "Sort float array", true);
     52    printFooter(stdout, "psSort", "Sort float vector", true);
    5353
    5454
    55     // Test C - Free float arrays
    56     printPositiveTestHeader(stdout,"psSort", "Free float arrays");
    57     psFloatArrayFree(in);
    58     psFloatArrayFree(out);
     55    // Test C - Free float vectors
     56    printPositiveTestHeader(stdout,"psSort", "Free float vectors");
     57    psVectorFree(in);
     58    psVectorFree(out);
    5959    psMemCheckLeaks(0, NULL, stdout);
    6060    int nBad = psMemCheckCorruption(0);
     
    6262        printf("ERROR: Found %d bad memory blocks\n", nBad);
    6363    }
    64     printFooter(stdout, "psSort", "Free float arrays", true);
     64    printFooter(stdout, "psSort", "Free float vectors", true);
    6565
     66    return 0;
    6667}
  • trunk/psLib/test/collections/tst_psSort_02.c

    r620 r688  
    44 *
    55 *  This test driver contains the following tests for psSort test point 2:
    6  *     A)  Create arrays
    7  *     B)  Sort integer array of indices based on pre-sort order of floating point array
    8  *     C)  Free arrays
     6 *     A)  Create vectors
     7 *     B)  Sort integer vector of indices based on pre-sort order of floating point vector
     8 *     C)  Free vectors
    99 *
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    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 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323         char* argv[])
    2424{
    25     psArray *in = NULL;
    26     psArray *out = NULL;
     25    psVector *in = NULL;
     26    psVector *out = NULL;
    2727
    2828
    29     // Test A - Create float arrays
    30     printPositiveTestHeader(stdout,"psSort", "Create arrays");
    31     in = psFloatArrayAlloc(5);
     29    // Test A - Create float vectors
     30    printPositiveTestHeader(stdout,"psSort", "Create vectors");
     31    in = psVectorAlloc(PS_TYPE_FLOAT, 5);
    3232    in->n = 5;
    33     out = psIntArrayAlloc(5);
     33    out = psVectorAlloc(PS_TYPE_INT32, 5);
    3434    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;
    4040    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]);
    4242    }
    43     printFooter(stdout, "psSort", "Create arrays", true);
     43    printFooter(stdout, "psSort", "Create vectors", true);
    4444
    4545
    46     // Test B - Sort integer array of indices based on pre-sort order of floating point array
    47     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");
    4848    out = psSortIndex(out, in);
    4949    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]);
    5151    }
    52     printFooter(stdout, "psSort", "Create sorted index array", true);
     52    printFooter(stdout, "psSort", "Create sorted index vector", true);
    5353
    5454
    55     // Test C - Free arrays
    56     printPositiveTestHeader(stdout,"psSort", "Free arrays");
    57     psFloatArrayFree(in);
    58     psIntArrayFree(out);
     55    // Test C - Free vectors
     56    printPositiveTestHeader(stdout,"psSort", "Free vectors");
     57    psVectorFree(in);
     58    psVectorFree(out);
    5959    psMemCheckLeaks(0, NULL, stdout);
    6060    int nBad = psMemCheckCorruption(0);
     
    6262        printf("ERROR: Found %d bad memory blocks\n", nBad);
    6363    }
    64     printFooter(stdout, "psSort", "Free arrays", true);
     64    printFooter(stdout, "psSort", "Free vectors", true);
    6565
    6666}
  • trunk/psLib/test/collections/tst_psSort_03.c

    r620 r688  
    44 *
    55 *  This test driver contains the following tests for psSort test point 3:
    6  *     A)  Create float arrays of different sizes
    7  *     B)  Attempt to sort arrays...should get errors
    8  *     C)  Free float arrays
     6 *     A)  Create float vectors of different sizes
     7 *     B)  Attempt to sort vectors...should get errors
     8 *     C)  Free float vectors
    99 *
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    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 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323         char* argv[])
    2424{
    25     psArray *in = NULL;
    26     psArray *out = NULL;
     25    psVector *in = NULL;
     26    psVector *out = NULL;
    2727
    2828
    29     // Test A - Create float arrays
    30     printPositiveTestHeader(stdout,"psSort", "Create float arrays of different sizes");
    31     in = psFloatArrayAlloc(5);
     29    // Test A - Create float vectors
     30    printPositiveTestHeader(stdout,"psSort", "Create float vectors of different sizes");
     31    in = psVectorAlloc(PS_TYPE_FLOAT, 5);
    3232    in->n = 5;
    33     out = psFloatArrayAlloc(6);
     33    out = psVectorAlloc(PS_TYPE_FLOAT, 6);
    3434    out->n = 6;
    3535    in->n = 5;
    3636    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]);
    3838    }
    39     printFooter(stdout, "psSort", "Create float arrays of different sizes", true);
     39    printFooter(stdout, "psSort", "Create float vectors of different sizes", true);
    4040
    4141
    42     // Test B - Sort input float array and put results into output float array
    43     printNegativeTestHeader(stdout,"psSort", "Sort float array",
    44                             "Input and output array sizes 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);
    4545    out = psSort(out, in);
    46     printFooter(stdout, "psSort", "Sort float array", true);
     46    printFooter(stdout, "psSort", "Sort float vector", true);
    4747
    4848
    49     // Test C - Free float arrays
    50     printPositiveTestHeader(stdout,"psSort", "Free float arrays");
    51     psFloatArrayFree(in);
    52     psFloatArrayFree(out);
     49    // Test C - Free float vectors
     50    printPositiveTestHeader(stdout,"psSort", "Free float vectors");
     51    psVectorFree(in);
     52    psVectorFree(out);
    5353    psMemCheckLeaks(0, NULL, stdout);
    5454    int nBad = psMemCheckCorruption(0);
     
    5656        printf("ERROR: Found %d bad memory blocks\n", nBad);
    5757    }
    58     printFooter(stdout, "psSort", "Free float arrays", true);
     58    printFooter(stdout, "psSort", "Free float vectors", true);
    5959
    6060}
  • trunk/psLib/test/collections/tst_psSort_04.c

    r620 r688  
    44 *
    55 *  This test driver contains the following tests for psSort test point 4:
    6  *     A)  Attempt to sort with null input array
    7  *     B)  Attempt to sort with null output array
    8  *     C)  Free arrays
     6 *     A)  Attempt to sort with null input vector
     7 *     B)  Attempt to sort with null output vector
     8 *     C)  Free vectors
    99 *
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    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 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323         char* argv[])
    2424{
    25     psArray *badIn = NULL;
    26     psArray *badOut = NULL;
    27     psArray *goodIn = psFloatArrayAlloc(5);
    28     psArray *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);
    2929
    30     // Test A - Attempt to sort with null input array
    31     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);
    3333    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);
    3535
    36     // Test B - Attempt to sort with null output array
    37     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);
    3939    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);
    4141
    42     // Test C - Free arrays
    43     printPositiveTestHeader(stdout, "psSort", "Free arrays");
    44     psFloatArrayFree(goodIn);
    45     psFloatArrayFree(goodOut);
     42    // Test C - Free vectors
     43    printPositiveTestHeader(stdout, "psSort", "Free vectors");
     44    psVectorFree(goodIn);
     45    psVectorFree(goodOut);
    4646    psMemCheckLeaks(0, NULL, stdout);
    4747    int nBad = psMemCheckCorruption(0);
Note: See TracChangeset for help on using the changeset viewer.