/** @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.7 $  $Name: not supported by cvs2svn $
 *  @date  $Date: 2005-04-07 20:27:41 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
 *
 */

#include "pslib_strict.h"
#include "psTest.h"

psS32 main(psS32 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);
    psS32 nLeaks = psMemCheckLeaks(0, NULL, stdout, false);
    if(nLeaks) {
        printf("ERROR: Found %d memory blocks\n", nLeaks);
    }
    psS32 nBad = psMemCheckCorruption(0);
    if(nBad) {
        printf("ERROR: Found %d bad memory blocks\n", nBad);
    }
    printFooter(stdout, "psVectorSort", "Free arays", true);

    return 0;
}
