Changeset 41171 for trunk/psLib/test/sys/tap_psString.c
- Timestamp:
- Nov 27, 2019, 11:57:38 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/sys/tap_psString.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/sys/tap_psString.c
r24023 r41171 111 111 { 112 112 psMemId id = psMemGetId(); 113 psS32 result = 0;114 psS32 result1 = 0;115 char *strResult;116 113 char *stringvalnocopy = "F A I L"; 117 114 118 115 // 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 125 125 psFree(strResult); 126 126 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 149 149 } 150 150 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(); 172 171 173 172 // testStringCopy06() … … 200 199 } 201 200 202 #if 0203 201 // testStrAppend01() 204 202 { 205 203 psMemId id = psMemGetId(); 206 char *str =NULL;204 char *str = NULL; 207 205 // test nonsensical invocations ... 208 206 ssize_t sz = psStringAppend(NULL, NULL); 209 ok( sz == 0, "Failed test point");207 ok(!sz, "append NULL string to NULL string"); 210 208 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 } 215 212 216 213 // testStrAppend02() … … 251 248 } 252 249 253 #if 0254 250 // testStrPrepend01() 255 251 { … … 263 259 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 264 260 } 265 #endif266 261 267 262 // testStrPrepend02()
Note:
See TracChangeset
for help on using the changeset viewer.
