/** @file  tst_psTime_02.c
 *
 *  @brief Test driver for psTime functions
 *
 *  This test driver contains the following tests for psTime:
 *     A) Incorrect ISO time data
 *     B) Attempt to use null timeval
 *
 *  @author  Ross Harman, MHPCC
 *
 *  @version $Revision: 1.5 $  $Name: not supported by cvs2svn $
 *  @date  $Date: 2004-10-12 01:34:09 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 *
 */

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

int main(int argc, char* argv[])
{

    // Test A - Incorrect ISO time data
    printNegativeTestHeader(stdout,"psTime", "Incorrect ISO time data", "Time not allowed", 0);
    psTimeFromISOTime("2004-99-21T18:22:24.272Z");
    psTimeFromISOTime("2004-07-99T18:22:24.272Z");
    psTimeFromISOTime("2004-07-21T99:22:24.272Z");
    psTimeFromISOTime("2004-07-21T18:99:24.272Z");
    psTimeFromISOTime("2004-07-21T18:22:99.272Z");
    psTimeFromISOTime("2004-07-21T18:22:24.-999Z");
    printFooter(stdout, "psTime", "Incorrect ISO time data", true);


    // Test B - Attempt to use null timeval
    printNegativeTestHeader(stdout,"psTime", "Attempt to use null timeval",
                            "Null value for timeval arg not allowed", 0);
    psTimeFromTimeval(NULL);
    printFooter(stdout, "psTime", "Attempt to use null timeval", true);


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