IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 27, 2019, 11:57:38 AM (6 years ago)
Author:
eugene
Message:

updates to psLib tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/sys/tap_psString.c

    r24023 r41171  
    111111    {
    112112        psMemId id = psMemGetId();
    113         psS32   result = 0;
    114         psS32   result1 = 0;
    115         char  *strResult;
    116113        char  *stringvalnocopy = "F A I L";
    117114
    118115        // Test point #4 Verify empty string copy with length - psStringNCopy
    119         strResult = psStringNCopy(stringvalnocopy, 0);
    120         // Perform string compare and get sting length
    121         result = strcmp(strResult, stringvalnocopy);
    122         result1 = strlen(strResult);
    123         ok(result != 0,
    124              "test point #4 strcmp result = %d didn't expected %d",result,0);
     116        char *strResult = psStringNCopy(stringvalnocopy, 0);
     117
     118        // Perform string compare and get string length
     119        int result = strcmp(strResult, stringvalnocopy);
     120        ok(result != 0, "test point #4 strcmp result = %d, expected %d", result, 4);
     121
     122        int resultLen = strlen(strResult);
     123        ok(resultLen == 0, "test point #4 strcmp result = %d, expected %d", resultLen, 0);
     124
    125125        psFree(strResult);
    126126        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    149149    }
    150150
    151 // XXX This test needs to be modified to check for maximum size
    152 //     This will require a mod to psStringNCopy source to check for maximum size
    153 //
    154 //psS32 testStringCopy05()
    155 //{
    156 //    char  *strResult;
    157 //    char  stringval[20] = "E R R O R";
    158 //    psS32   negativeSize = -5;
    159 //
    160 //    // Test point #6 Copy string with negative size - psStringNCopy
    161 //    strResult = psStringNCopy(stringval, negativeSize);
    162 //    if ( strResult != NULL ) {
    163 //        fprintf(stderr,"Failed test point #6 return value = %p expected NULL\n",
    164 //                strResult);
    165 //        return 1;
    166 //    }
    167 //    // Memory should not have been allocated
    168 //
    169 //    return 0;
    170 //}
    171 
     151    // XXX This test needs to be modified to check for maximum size
     152    // This will require a mod to psStringNCopy source to check for maximum size
     153
     154    // psS32 testStringCopy05()
     155    skip_start (1, 6, "Skipping psSTringNCopy() because of failure to test max value");
     156    {
     157      char  *strResult;
     158      char  stringval[20] = "E R R O R";
     159      psS32   negativeSize = -5;
     160
     161      // Test point #6 Copy string with negative size - psStringNCopy
     162      strResult = psStringNCopy(stringval, negativeSize);
     163      if ( strResult != NULL ) {
     164        fprintf(stderr,"Failed test point #6 return value = %p expected NULL\n",
     165                strResult);
     166        return 1;
     167      }
     168      // Memory should not have been allocated
     169    }
     170    skip_end();
    172171
    173172    // testStringCopy06()
     
    200199    }
    201200
    202 #if 0
    203201    // testStrAppend01()
    204202    {
    205203        psMemId id = psMemGetId();
    206         char *str=NULL;
     204        char *str = NULL;
    207205        // test nonsensical invocations ...
    208206        ssize_t sz = psStringAppend(NULL, NULL);
    209         ok(sz == 0, "Failed test point");
     207        ok(!sz, "append NULL string to NULL string");
    210208        sz = psStringAppend(&str, NULL);
    211         ok(sz == 0, "Failed test point");
    212         ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    213     }
    214 #endif
     209        ok(!sz, "append NULL string to NULL string");
     210        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     211    }
    215212
    216213    // testStrAppend02()
     
    251248    }
    252249
    253 #if 0
    254250    // testStrPrepend01()
    255251    {
     
    263259        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    264260    }
    265 #endif
    266261
    267262    // testStrPrepend02()
Note: See TracChangeset for help on using the changeset viewer.