IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 10, 2004, 1:14:22 PM (22 years ago)
Author:
harman
Message:

Added more testpoints

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/collections/tst_psSort_01.c

    r831 r988  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2004-06-02 23:29:29 $
     12 *  @version $Revision: 1.6 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2004-06-10 23:14:22 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2525    psVector *in = NULL;
    2626    psVector *out = NULL;
     27    psVector *tempVec = NULL;
    2728
    2829
    2930    // Test A - Create float vectors
    3031    printPositiveTestHeader(stdout,"psSort", "Create float vectors");
    31     in = psVectorAlloc(5, PS_TYPE_F32);
    32     in->n = 5;
    33     out = psVectorAlloc(5, PS_TYPE_F32);
    34     out->n = 5;
     32    in = psVectorAlloc(7, PS_TYPE_F32);
     33    in->n = 7;
     34    out = psVectorAlloc(7, PS_TYPE_F32);
     35    out->n = 7;
    3536    in->data.F32[0] = 7.0f;
    3637    in->data.F32[1] = 9.0f;
     
    3839    in->data.F32[3] = 1.0f;
    3940    in->data.F32[4] = 5.0f;
    40     for(int i=0; i<5; i++) {
     41    in->data.F32[5] = 5.0f;
     42    in->data.F32[6] = -20.0f;
     43    for(int i=0; i<7; i++) {
    4144        printf("vec[%d] = %f\n", i, in->data.F32[i]);
    4245    }
     
    4649    // Test B - Sort input float vector and put results into output float vector
    4750    printPositiveTestHeader(stdout,"psSort", "Sort float vector");
     51    tempVec = out;
    4852    out = psSort(out, in);
    49     for(int i=0; i<5; i++) {
     53    for(int i=0; i<7; i++) {
    5054        printf("vec[%d] = %f\n", i, out->data.F32[i]);
     55    }
     56    if(out != tempVec) {
     57        printf("Error: Return pointer not equal to output argument pointer\n");
    5158    }
    5259    printFooter(stdout, "psSort", "Sort float vector", true);
    5360
    5461
    55     // Test C - Free float vectors
     62    // Test C - Sort input float vector into itself
     63    printPositiveTestHeader(stdout,"psSort", "Sort input float vector into itself");
     64    in = psSort(in, in);
     65    for(int i=0; i<7; i++) {
     66        printf("vec[%d] = %f\n", i, out->data.F32[i]);
     67    }
     68    printFooter(stdout, "psSort", "Sort input float vector into itself", true);
     69
     70
     71    // Test D - Free float vectors
    5672    printPositiveTestHeader(stdout,"psSort", "Free float vectors");
    5773    psVectorFree(in);
Note: See TracChangeset for help on using the changeset viewer.