- Timestamp:
- Oct 1, 2020 7:55:24 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstUtf8.cpp
r83886 r86400 99 99 if (rc == VINF_SUCCESS) 100 100 { 101 RTStrFree(pszUtf8); 101 102 rc = RTStrCurrentCPToUtf8(&pszUtf8, pszCurrent); 102 103 if (rc == VINF_SUCCESS) … … 105 106 RTTestFailed(hTest, "%d: The third part of random UTF-16 -> UTF-8 -> Current -> UTF-8 failed with return value %Rrc.", 106 107 __LINE__, rc); 107 } 108 else if (rc == VERR_NO_TRANSLATION) 109 RTTestPassed(hTest, "The second part of random UTF-16 -> UTF-8 -> Current -> UTF-8 returned VERR_NO_TRANSLATION. This is probably as it should be.\n"); 110 else if (rc == VWRN_NO_TRANSLATION) 111 RTTestPassed(hTest, "The second part of random UTF-16 -> UTF-8 -> Current -> UTF-8 returned VWRN_NO_TRANSLATION. This is probably as it should be.\n"); 108 if (RT_SUCCESS(rc)) 109 RTStrFree(pszUtf8); 110 RTStrFree(pszCurrent); 111 } 112 112 else 113 RTTestFailed(hTest, "%d: The second part of random UTF-16 -> UTF-8 -> Current -> UTF-8 failed with return value %Rrc.", 114 __LINE__, rc); 113 { 114 if (rc == VERR_NO_TRANSLATION) 115 RTTestPassed(hTest, "The second part of random UTF-16 -> UTF-8 -> Current -> UTF-8 returned VERR_NO_TRANSLATION. This is probably as it should be.\n"); 116 else if (rc == VWRN_NO_TRANSLATION) 117 RTTestPassed(hTest, "The second part of random UTF-16 -> UTF-8 -> Current -> UTF-8 returned VWRN_NO_TRANSLATION. This is probably as it should be.\n"); 118 else 119 RTTestFailed(hTest, "%d: The second part of random UTF-16 -> UTF-8 -> Current -> UTF-8 failed with return value %Rrc.", 120 __LINE__, rc); 121 if (RT_SUCCESS(rc)) 122 RTStrFree(pszCurrent); 123 RTStrFree(pszUtf8); 124 } 115 125 } 116 126 else 117 127 RTTestFailed(hTest, "%d: The first part of random UTF-16 -> UTF-8 -> Current -> UTF-8 failed with return value %Rrc.", 118 128 __LINE__, rc); 129 RTMemFree(pwszRand); 119 130 120 131 /* … … 142 153 RTTestPrintf(hTest, RTTESTLVL_FAILURE, "First differing character is at position %d and has the value %x.\n", i, pwsz[i]); 143 154 } 155 RTUtf16Free(pwsz); 144 156 } 145 157 else 146 158 RTTestFailed(hTest, "%d: The second part of random UTF-16 -> UTF-8 -> UTF-16 failed with return value %Rrc.", 147 159 __LINE__, rc); 160 RTStrFree(pszUtf8); 148 161 } 149 162 else 150 163 RTTestFailed(hTest, "%d: The first part of random UTF-16 -> UTF-8 -> UTF-16 failed with return value %Rrc.", 151 164 __LINE__, rc); 165 RTMemFree(pwszRand); 152 166 153 167 /* … … 178 192 RTTestPrintf(hTest, RTTESTLVL_FAILURE, "First differing character is at position %d and has the value %x.\n", i, pwsz[i]); 179 193 } 194 RTUtf16Free(pwsz); 180 195 } 181 196 else … … 184 199 else 185 200 RTTestFailed(hTest, "%d: The first part of random UTF-16 -> fixed length UTF-8 -> UTF-16 failed with return value %Rrc.\n", __LINE__, rc); 201 RTMemFree(pwszRand); 186 202 187 203 /* … … 215 231 else 216 232 RTTestFailed(hTest, "%d: The second part of random UTF-16 -> UTF-8 -> fixed length UTF-16 failed with return value %Rrc.\n", __LINE__, rc); 233 RTStrFree(pszUtf8); 217 234 } 218 235 else 219 236 RTTestFailed(hTest, "%d: The first part of random UTF-16 -> UTF-8 -> fixed length UTF-16 failed with return value %Rrc.\n", 220 237 __LINE__, rc); 238 RTMemFree(pwszRand); 239 221 240 pwszRand = (PRTUTF16)RTMemAlloc(31 * sizeof(*pwsz)); 222 241 for (int i = 0; i < 30; i++) … … 230 249 RTTestFailed(hTest, "%d: Random UTF-16 -> fixed length UTF-8 with too small buffer returned value %d instead of VERR_BUFFER_OVERFLOW.\n", 231 250 __LINE__, rc); 251 RTMemFree(pwszRand); 232 252 233 253 /* … … 249 269 RTTestFailed(hTest, "%d: The second part of random UTF-16 -> UTF-8 -> fixed length UTF-16 with too short buffer returned value %Rrc instead of VERR_BUFFER_OVERFLOW.\n", 250 270 __LINE__, rc); 271 RTStrFree(pszUtf8); 251 272 } 252 273 else 253 274 RTTestFailed(hTest, "%d:The first part of random UTF-16 -> UTF-8 -> fixed length UTF-16 failed with return value %Rrc.\n", 254 275 __LINE__, rc); 255 276 RTMemFree(pwszRand); 256 277 257 278 RTTestSubDone(hTest); … … 495 516 496 517 /** @todo RTCpsToUtf8 or something. */ 518 RTUniFree(paCps); 497 519 } 498 520 else
Note:
See TracChangeset
for help on using the changeset viewer.