/** @file  tst_psVectorSort_04.c
 *
 *  @brief Test driver for psVectorSort functions
 *
 *  This test driver contains the following tests for psVectorSort test point 4:
 *     A)  Attempt to sort with null input vector
 *     B)  Free vectors
 *
 *  @author  Ross Harman, MHPCC
 *
 *  @version $Revision: 1.3 $  $Name: not supported by cvs2svn $
 *  @date  $Date: 2004-08-06 22:34:05 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 *
 */

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

int main(int argc,
         char* argv[])
{
    psVector *badIn = NULL;
    psVector *goodOut = psVectorAlloc(5, PS_TYPE_F32);

    // Test A - Attempt to sort with null input vector
    printNegativeTestHeader(stdout,"psVectorSort", "Attempt to sort with null input vector",
                            "Null input vector", 0);
    goodOut = psVectorSort(goodOut, badIn);
    printFooter(stdout, "psVectorSort", "Attempt to sort with null input vector", true);

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

    return 0;
}
