IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 25, 2006, 12:18:00 PM (20 years ago)
Author:
drobbin
Message:

fixed ConfigFormat, Write. Added extra error checks. Updated/expanded corresponding tests.

Location:
trunk/psLib/test/types
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/types/tst_psMetadata_07.c

    r6187 r6190  
    1616*  @author  David Robbins, MHPCC
    1717*
    18 *  @version $Revision: 1.17 $  $Name: not supported by cvs2svn $
    19 *  @date  $Date: 2006-01-23 23:52:15 $
     18*  @version $Revision: 1.18 $  $Name: not supported by cvs2svn $
     19*  @date  $Date: 2006-01-25 22:18:00 $
    2020*
    2121*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5858        vec->data.S32[i] = i+1;
    5959    }
     60    vec->n = 5;
    6061    time->sec = 1000;
    6162    time->nsec = 25;
     
    137138{
    138139    psMetadata *newMD = NULL;
     140    //Return false for NULL input metadata
     141    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     142    if (psMetadataConfigWrite(newMD, "mdcfgwrt.out")) {
     143        psError(PS_ERR_BAD_PARAMETER_NULL, false,
     144                "psMetadataConfigWrite failed to return false for NULL input metadata.\n");
     145        return 1;
     146    }
    139147    newMD = setupMeta();
    140     printPositiveTestHeader(stdout, "psMetadata", "Test E - psMetadataConfigWrite");
     148    //Return false for NULL input filename
     149    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     150    if (psMetadataConfigWrite(newMD, NULL)) {
     151        psError(PS_ERR_BAD_PARAMETER_NULL, false,
     152                "psMetadataConfigWrite failed to return false for NULL input filename.\n");
     153        return 2;
     154    }
     155    //Return false for bad input filename
     156    psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message");
     157    if (psMetadataConfigWrite(newMD, "temp")) {
     158        psError(PS_ERR_BAD_PARAMETER_NULL, false,
     159                "psMetadataConfigWrite failed to return false for bad input filename.\n");
     160        return 3;
     161    }
     162    //Return true for valid inputs
    141163    if ( !psMetadataConfigWrite(newMD, "mdcfgwrt.out") ) {
    142164        fprintf(stderr, "Failed test point E - Failed to write metadata to file. \n");
    143     }
    144 
    145     printFooter(stdout, "psMetadata", "Test E - psMetadataConfigWrite", true);
     165        return 4;
     166    }
     167
     168    //Make sure the output file matches the verified file output.
     169    FILE *verified;
     170    FILE *output;
     171    verified = fopen("mdcfgwrt.verified", "r");
     172    output = fopen("mdcfgwrt.out", "r");
     173    char buffer1[100];
     174    char buffer2[100];
     175    while ( fscanf(verified, "%s", buffer1) != EOF ) {
     176        if (fscanf(output, "%s", buffer2) == EOF) {
     177            psError(PS_ERR_BAD_PARAMETER_SIZE, false,
     178                    "Output file is smaller than the expected output file.\n");
     179            return 5;
     180        }
     181        if (strncmp(buffer1, buffer2, 100) ) {
     182            psError(PS_ERR_BAD_PARAMETER_VALUE, false,
     183                    "Output file contents do not match the expected output.\n");
     184            return 6;
     185        }
     186    }
     187    if (fscanf(output, "%s", buffer2) != EOF) {
     188        psError(PS_ERR_BAD_PARAMETER_SIZE, false,
     189                "Output file is larger than the expected output file.\n");
     190        return 7;
     191    }
     192    fclose(verified);
     193    fclose(output);
     194
    146195    psFree(newMD);
    147196    return 0;
  • trunk/psLib/test/types/verified/tst_psMetadata_07.stderr

    r6187 r6190  
    1414\**********************************************************************************/
    1515
     16<DATE><TIME>|<HOST>|I|testMetaWrite
     17    Following should generate error message
     18<DATE><TIME>|<HOST>|E|psMetadataConfigWrite (FILE:LINENO)
     19    Unallowable operation: md is NULL.
     20<DATE><TIME>|<HOST>|I|testMetaWrite
     21    Following should generate error message
     22<DATE><TIME>|<HOST>|E|psMetadataConfigWrite (FILE:LINENO)
     23    Unallowable operation: filename is NULL.
     24<DATE><TIME>|<HOST>|I|testMetaWrite
     25    Following should generate error message
     26<DATE><TIME>|<HOST>|E|psMetadataConfigWrite (FILE:LINENO)
     27    Failed to open specified file, temp
    1628
    1729---> TESTPOINT PASSED (psMetadata_07{Test psMetadataConfigWrite} | tst_psMetadata_07.c)
  • trunk/psLib/test/types/verified/tst_psMetadata_07.stdout

    r6187 r6190  
    3535---> TESTPOINT PASSED (psMetadata{Test D - Get and Decrement Iterator} | tst_psMetadata_07.c)
    3636
    37 /***************************** TESTPOINT ******************************************\
    38 *             TestFile: tst_psMetadata_07.c                                        *
    39 *            TestPoint: psMetadata{Test E - psMetadataConfigWrite}                 *
    40 *             TestType: Positive                                                   *
    41 \**********************************************************************************/
    42 
    43 
    44 ---> TESTPOINT PASSED (psMetadata{Test E - psMetadataConfigWrite} | tst_psMetadata_07.c)
    45 
Note: See TracChangeset for help on using the changeset viewer.