/** @file  tst_psMatrix_02.c
 *
 *  @brief Test driver for negative tests for psMatrix transpose function
 *
 *  This test driver contains the following tests for psMatrix test point 2:
 *     A)  Input pointer same as output pointer
 *     B)  Null input psImage
 *     C)  Incorrect type for input pointer
 *     D)  Incorrect type for output pointer
 *     E)  Matrix not square for output pointer
 *
 *  @author  Ross Harman, MHPCC
 *
 *  @version $Revision: 1.4 $  $Name: not supported by cvs2svn $
 *  @date  $Date: 2004-12-09 22:50:39 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 *
 */

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

psS32 main(psS32 argc,
           char* argv[])
{
    psImage *nullImage = NULL;
    psImage *inImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
    psImage *outImage = (psImage*)psImageAlloc(3, 3, PS_TYPE_F64);
    psImage *badImage1 = (psImage*)psImageAlloc(3, 3, PS_TYPE_C32);
    psImage *badImage2 = (psImage*)psImageAlloc(3, 2, PS_TYPE_F64);

    // Test A - Input pointer same as output pointer
    printNegativeTestHeader(stdout,"psMatrix", "Input pointer same as output pointer",
                            "Invalid operation: Pointer to inImage is same as outImage.", 0);
    psMatrixTranspose(inImage, inImage);
    printFooter(stdout, "psMatrix", "Input pointer same as output pointer", true);

    // Test B - Null input psImage
    printNegativeTestHeader(stdout,"psMatrix", "Null input psImage",
                            "Invalid operation: inImage or its data is NULL.", 0);
    psMatrixTranspose(outImage, nullImage);
    printFooter(stdout, "psMatrix", "Null input psImage", true);

    // Test C - Incorrect type for input pointer
    printNegativeTestHeader(stdout,"psMatrix", "Incorrect type for input pointer",
                            "|Invalid operation: inImage not PS_TYPE_F64.", 0);
    psMatrixTranspose(outImage, badImage1);
    printFooter(stdout, "psMatrix", "Incorrect type for input pointer", true);

    // Test D - Incorrect type for output pointer
    printNegativeTestHeader(stdout,"psMatrix", "Incorrect type for output pointer",
                            "Invalid operation: outImage not PS_TYPE_F64.", 0);
    psMatrixTranspose(badImage1, inImage);
    printFooter(stdout, "psMatrix", "Incorrect type for output pointer", true);

    // Test E - Matrix not square for output pointer
    printNegativeTestHeader(stdout,"psMatrix", "Matrix not square for output pointer",
                            "Invalid operation: outImage not square array.", 0);
    psMatrixTranspose(badImage2, inImage);
    printFooter(stdout, "psMatrix", "Matrix not square for output pointer", true);

    return 0;
}
