/** @file  tst_psVectorSort_03.c
 *
 *  @brief Test driver for psVectorSort functions
 *
 *  This test driver contains the following tests for psVectorSort test point 3:
 *     A)  Create float vectors of different sizes
 *     B)  Attempt to sort vectors...should get errors
 *     C)  Free float vectors
 *
 *  @author  Ross Harman, MHPCC
 *
 *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
 *  @date  $Date: 2004-07-15 23:52:34 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 *
 */

#include "pslib.h"
#include "psTest.h"

int main(int argc,
         char* argv[])
{
    psVector *in = NULL;
    psVector *out = NULL;


    // Test A - Create float vectors
    printPositiveTestHeader(stdout,"psVectorSort", "Create float vectors of different sizes");
    in = psVectorAlloc(5, PS_TYPE_F32);
    in->n = 5;
    out = psVectorAlloc(6, PS_TYPE_F32);
    out->n = 6;
    in->n = 5;
    for(int i=0; i<5; i++) {
        printf("arr[%d] = %f\n", i, in->data.F32[i]);
    }
    printFooter(stdout, "psVectorSort", "Create float vectors of different sizes", true);


    // Test B - Sort input float vector and put results into output float vector
    printNegativeTestHeader(stdout,"psVectorSort", "Sort float vector",
                            "Input and output vector sizes are not equal", 0);
    out = psVectorSort(out, in);
    printFooter(stdout, "psVectorSort", "Sort float vector", true);


    // Test C - Free float vectors
    printPositiveTestHeader(stdout,"psVectorSort", "Free float vectors");
    psFree(in);
    psFree(out);
    psMemCheckLeaks(0, NULL, stdout);
    int nBad = psMemCheckCorruption(0);
    if(nBad) {
        printf("ERROR: Found %d bad memory blocks\n", nBad);
    }
    printFooter(stdout, "psVectorSort", "Free float vectors", true);

}
