IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7901 for trunk/psLib/test/sys


Ignore:
Timestamp:
Jul 13, 2006, 4:26:25 PM (20 years ago)
Author:
drobbin
Message:

Added str check test for error handling of psString fxns, namely stringSubstitute. Edited memory and type to include MemCheck's for string, line, and region. Added is_psType function to check for NULLs and native types first. <-will have to update all fxns next wrt to this change. Added psStringAlloc, stringFree, regionFree. Added doxygen comments.

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

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/sys/Makefile.am

    r7884 r7901  
    1212        tst_psString \
    1313        tst_psTrace \
    14         tap_psStringSubstitute
     14        tap_psStringSubstitute \
     15        tst_psLine
    1516
    1617tst_psAbort_SOURCES =  tst_psAbort.c
     
    2122tst_psString_SOURCES =  tst_psString.c
    2223tst_psTrace_SOURCES =  tst_psTrace.c
     24tst_psLine_SOURCES =  tst_psLine.c
    2325
    2426tap_psStringSubstitute_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/test/tap/src
  • trunk/psLib/test/sys/tst_psString.c

    r7880 r7901  
    2020 *  @author  Eric Van Alst, MHPCC
    2121 *
    22  *  @version $Revision: 1.10 $  $Name: not supported by cvs2svn $
    23  *  @date  $Date: 2006-07-12 21:25:39 $
     22 *  @version $Revision: 1.11 $  $Name: not supported by cvs2svn $
     23 *  @date  $Date: 2006-07-14 02:26:25 $
    2424 *
    2525 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    5353static psS32 testStrSplit00(void);
    5454static psS32 testNULLStrings(void);
     55static psS32 testStrCheck(void);
    5556
    5657testDescription tests[] = {
     
    7475                              {testStrSplit00,15, "Test String Splitting", 0, false},
    7576                              {testNULLStrings,666, "Test NULL String Error Handling", 0, false},
     77                              {testStrCheck,16, "Test String Allocation and MemCheck", 0, false},
    7678                              {NULL}
    7779                          };
     
    709711    return 0;
    710712}
     713
     714psS32 testStrCheck(void)
     715{
     716    psString str = NULL;
     717    str = psStringAlloc(10);
     718    strcpy(str, "Hello");
     719    if (!psMemCheckString(str)) {
     720        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     721                "psString wasn't properly allocated!\n");
     722        return 1;
     723    }
     724    if (!psMemCheckType(PS_DATA_STRING, str)) {
     725        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     726                "psString wasn't properly allocated!\n");
     727        return 2;
     728    }
     729    psFree(str);
     730
     731    char charStr[10];
     732    if (psMemCheckType(PS_DATA_STRING, charStr)) {
     733        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     734                "Input string is not a psDataType!!!  (Should have returned false)\n");
     735        return 3;
     736    }
     737
     738    return 0;
     739}
     740
  • trunk/psLib/test/sys/verified/tst_psString.stderr

    r7880 r7901  
    175175---> TESTPOINT PASSED (psString{Test NULL String Error Handling} | tst_psString.c)
    176176
     177/***************************** TESTPOINT ******************************************\
     178*             TestFile: tst_psString.c                                             *
     179*            TestPoint: psString{Test String Allocation and MemCheck}              *
     180*             TestType: Positive                                                   *
     181\**********************************************************************************/
     182
     183
     184---> TESTPOINT PASSED (psString{Test String Allocation and MemCheck} | tst_psString.c)
     185
Note: See TracChangeset for help on using the changeset viewer.