/** @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)  Matrix not square for input pointer
 *     E)  Incorrect type for output pointer
 *     F)  Matrix not square for output pointer
 *
 *  @author  Ross Harman, MHPCC
 *
 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
 *  @date  $Date: 2004-08-06 22:34:06 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 *
 */

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

int main(int 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_F32);
    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 - Matrix not square for input pointer
    printNegativeTestHeader(stdout,"psMatrix", "Matrix not square for input pointer",
                            "Invalid operation: inImage not square array.", 0);
    psMatrixTranspose(outImage, badImage2);
    printFooter(stdout, "psMatrix", "Matrix not square for input pointer", true);

    // Test E - 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 F - 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;
}
