Changeset 94494 in vbox
- Timestamp:
- Apr 6, 2022 1:49:44 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/testcase/tstGuestCtrlParseBuffer.cpp
r93115 r94494 40 40 * Defined Constants And Macros * 41 41 *********************************************************************************************************************************/ 42 #define STR_SIZE(a_sz) a_sz, sizeof(a_sz)42 #define STR_SIZE(a_sz) RT_STR_TUPLE(a_sz) 43 43 44 44 … … 194 194 #endif 195 195 196 RTTestIPrintf(RTTESTLVL_INFO, "Doing basic tests ...\n"); 197 198 if (sizeof("sizecheck") != 10) 199 RTTestFailed(hTest, "Basic size test #1 failed (%zu <-> 10)", sizeof("sizecheck")); 200 if (sizeof("off=rab") != 8) 201 RTTestFailed(hTest, "Basic size test #2 failed (%zu <-> 7)", sizeof("off=rab")); 202 if (sizeof("off=rab\0\0") != 10) 203 RTTestFailed(hTest, "Basic size test #3 failed (%zu <-> 10)", sizeof("off=rab\0\0")); 204 205 RTTestIPrintf(RTTESTLVL_INFO, "Doing line tests ...\n"); 206 207 /* Don't let the assertions trigger here 208 * -- we rely on the return values in the test(s) below. */ 209 RTAssertSetQuiet(true); 210 211 unsigned iTest; 212 for (iTest = 0; iTest < RT_ELEMENTS(g_aTestBlocks); iTest++) 196 AssertCompile(sizeof("sizecheck") == 10); 197 AssertCompile(sizeof("off=rab") == 8); 198 AssertCompile(sizeof("off=rab\0\0") == 10); 199 200 RTTestSub(hTest, "Lines"); 201 for (unsigned iTest = 0; iTest < RT_ELEMENTS(g_aTestBlocks); iTest++) 213 202 { 214 203 RTTestIPrintf(RTTESTLVL_DEBUG, "=> Test #%u\n", iTest); … … 225 214 iResult = stream.ParseBlock(curBlock); 226 215 if (iResult != g_aTestBlocks[iTest].iResult) 227 RTTestFailed(hTest, " \tReturned %Rrc, expected %Rrc\n", iResult, g_aTestBlocks[iTest].iResult);216 RTTestFailed(hTest, "Block #%u: Returned %Rrc, expected %Rrc", iTest, iResult, g_aTestBlocks[iTest].iResult); 228 217 else if (stream.GetOffset() != g_aTestBlocks[iTest].offAfter) 229 RTTestFailed(hTest, "\tOffset %zu wrong, expected %u\n", stream.GetOffset(), g_aTestBlocks[iTest].offAfter); 218 RTTestFailed(hTest, "Block #%uOffset %zu wrong, expected %u\n", 219 iTest, stream.GetOffset(), g_aTestBlocks[iTest].offAfter); 230 220 else if (iResult == VERR_MORE_DATA) 231 221 RTTestIPrintf(RTTESTLVL_DEBUG, "\tMore data (Offset: %zu)\n", stream.GetOffset()); … … 233 223 if (RT_SUCCESS(iResult) || iResult == VERR_MORE_DATA) 234 224 if (curBlock.GetCount() != g_aTestBlocks[iTest].cMapElements) 235 RTTestFailed(hTest, " \tMap has %u elements, expected %u\n",236 curBlock.GetCount(), g_aTestBlocks[iTest].cMapElements);225 RTTestFailed(hTest, "Block #%u: Map has %u elements, expected %u\n", 226 iTest, curBlock.GetCount(), g_aTestBlocks[iTest].cMapElements); 237 227 238 228 /* There is remaining data left in the buffer (which needs to be merged … … 252 242 } 253 243 254 RTTestIPrintf(RTTESTLVL_INFO, "Doing block tests ...\n"); 255 256 for (iTest = 0; iTest < RT_ELEMENTS(g_aTestStream); iTest++) 244 RTTestSub(hTest, "Blocks"); 245 for (unsigned iTest = 0; iTest < RT_ELEMENTS(g_aTestStream); iTest++) 257 246 { 258 247 RTTestIPrintf(RTTESTLVL_DEBUG, "=> Block test #%u\n", iTest); … … 268 257 GuestProcessStreamBlock curBlock; 269 258 iResult = stream.ParseBlock(curBlock); 270 RTTestIPrintf(RTTESTLVL_DEBUG, " \tReturned with %Rrc\n", iResult);259 RTTestIPrintf(RTTESTLVL_DEBUG, "Block #%u: Returned with %Rrc", iTest, iResult); 271 260 if (RT_SUCCESS(iResult)) 272 261 { … … 280 269 281 270 if (iResult != g_aTestStream[iTest].iResult) 282 RTTestFailed(hTest, " \tReturned %Rrc, expected %Rrc\n", iResult, g_aTestStream[iTest].iResult);271 RTTestFailed(hTest, "Block #%uReturned %Rrc, expected %Rrc", iTest, iResult, g_aTestStream[iTest].iResult); 283 272 else if (cBlocks != g_aTestStream[iTest].cBlocks) 284 RTTestFailed(hTest, " \tReturned %u blocks, expected %u\n", cBlocks, g_aTestStream[iTest].cBlocks);273 RTTestFailed(hTest, "Block #%uReturned %u blocks, expected %u", iTest, cBlocks, g_aTestStream[iTest].cBlocks); 285 274 } 286 275 else 287 RTTestFailed(hTest, " \tAdding data failed with %Rrc", iResult);276 RTTestFailed(hTest, "Block #%u: Adding data failed with %Rrc", iTest, iResult); 288 277 } 289 278
Note:
See TracChangeset
for help on using the changeset viewer.

