vbox的更動 36563 路徑 trunk/src/VBox/Runtime/testcase
- 時間撮記:
- 2011-4-5 下午03:28:31 (14 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Runtime/testcase/tstIprtList.cpp
r36532 r36563 218 218 219 219 /* 220 * Contains 221 */ 222 L<T1, T2> testList2; 223 224 /* Check full list. */ 225 RTTESTI_CHECK( testList.contains(paTestData[0])); 226 RTTESTI_CHECK( testList.contains(paTestData[cTestItems / 2])); 227 RTTESTI_CHECK( testList.contains(paTestData[cTestItems - 1])); 228 RTTESTI_CHECK(!testList.contains(T1())); 229 /* Check empty list. */ 230 RTTESTI_CHECK(!testList2.contains(paTestData[0])); 231 RTTESTI_CHECK(!testList2.contains(paTestData[cTestItems / 2])); 232 RTTESTI_CHECK(!testList2.contains(paTestData[cTestItems - 1])); 233 RTTESTI_CHECK(!testList2.contains(T1())); 234 235 /* 220 236 * Copy operator 221 237 */ 222 L<T1, T2> testList2(testList); 223 224 /* Check that all is correctly appended. */ 225 RTTESTI_CHECK_RETV(testList2.size() == cTestItems); 226 for (size_t i = 0; i < testList2.size(); ++i) 227 RTTESTI_CHECK(testList2.at(i) == paTestData[i]); 228 229 /* 230 * "=" operator 231 */ 232 L<T1, T2> testList3; 233 testList3 = testList; 238 L<T1, T2> testList3(testList); 234 239 235 240 /* Check that all is correctly appended. */ … … 239 244 240 245 /* 246 * "=" operator 247 */ 248 L<T1, T2> testList4; 249 testList4 = testList; 250 251 /* Check that all is correctly appended. */ 252 RTTESTI_CHECK_RETV(testList4.size() == cTestItems); 253 for (size_t i = 0; i < testList4.size(); ++i) 254 RTTESTI_CHECK(testList4.at(i) == paTestData[i]); 255 256 /* 241 257 * Append list 242 258 */ 243 testList 2.append(testList3);259 testList3.append(testList4); 244 260 245 261 /* Check that all is correctly appended. */ 246 RTTESTI_CHECK_RETV(testList 2.size() == cTestItems * 2);247 for (size_t i = 0; i < testList 2.size(); ++i)248 RTTESTI_CHECK(testList 2.at(i) == paTestData[i % cTestItems]);262 RTTESTI_CHECK_RETV(testList3.size() == cTestItems * 2); 263 for (size_t i = 0; i < testList3.size(); ++i) 264 RTTESTI_CHECK(testList3.at(i) == paTestData[i % cTestItems]); 249 265 250 266 /* 251 267 * Prepend list 252 268 */ 253 testList 2.prepend(testList3);269 testList3.prepend(testList4); 254 270 255 271 /* Check that all is correctly appended. */ 256 RTTESTI_CHECK_RETV(testList 2.size() == cTestItems * 3);257 for (size_t i = 0; i < testList 2.size(); ++i)258 RTTESTI_CHECK(testList 2.at(i) == paTestData[i % cTestItems]);272 RTTESTI_CHECK_RETV(testList3.size() == cTestItems * 3); 273 for (size_t i = 0; i < testList3.size(); ++i) 274 RTTESTI_CHECK(testList3.at(i) == paTestData[i % cTestItems]); 259 275 260 276 /* 261 277 * "value" method 262 278 */ 263 for (size_t i = 0; i < testList 2.size(); ++i)264 RTTESTI_CHECK(testList 2.value(i) == paTestData[i % cTestItems]);265 for (size_t i = 0; i < testList 2.size(); ++i)266 RTTESTI_CHECK(testList 2.value(i, T1()) == paTestData[i % cTestItems]);267 RTTESTI_CHECK(testList 2.value(testList2.size() + 1) == T1()); /* Invalid index */268 RTTESTI_CHECK(testList 2.value(testList2.size() + 1, T1()) == T1()); /* Invalid index */279 for (size_t i = 0; i < testList3.size(); ++i) 280 RTTESTI_CHECK(testList3.value(i) == paTestData[i % cTestItems]); 281 for (size_t i = 0; i < testList3.size(); ++i) 282 RTTESTI_CHECK(testList3.value(i, T1()) == paTestData[i % cTestItems]); 283 RTTESTI_CHECK(testList3.value(testList3.size() + 1) == T1()); /* Invalid index */ 284 RTTESTI_CHECK(testList3.value(testList3.size() + 1, T1()) == T1()); /* Invalid index */ 269 285 270 286 /* … … 301 317 302 318 /* Remove Range */ 303 testList 2.removeRange(cTestItems, cTestItems * 2);304 RTTESTI_CHECK_RETV(testList 2.size() == cTestItems * 2);305 for (size_t i = 0; i < testList 2.size(); ++i)306 RTTESTI_CHECK(testList 2.at(i) == paTestData[i % cTestItems]);319 testList3.removeRange(cTestItems, cTestItems * 2); 320 RTTESTI_CHECK_RETV(testList3.size() == cTestItems * 2); 321 for (size_t i = 0; i < testList3.size(); ++i) 322 RTTESTI_CHECK(testList3.at(i) == paTestData[i % cTestItems]); 307 323 308 324 /* Remove the first half (reverse) */ … … 539 555 uint8_t au8TestInts[s_cTestCount]; 540 556 for (size_t i = 0; i < RT_ELEMENTS(au8TestInts); ++i) 541 au8TestInts[i] = (uint8_t)RTRandU32Ex( 0, UINT8_MAX);557 au8TestInts[i] = (uint8_t)RTRandU32Ex(1, UINT8_MAX); 542 558 test1<RTCList, uint8_t, uint8_t, uint8_t>("ST: Native type", au8TestInts, RT_ELEMENTS(au8TestInts)); 543 559 test1<RTCMTList, uint8_t, uint8_t, uint8_t>("MT: Native type", au8TestInts, RT_ELEMENTS(au8TestInts)); … … 545 561 uint16_t au16TestInts[s_cTestCount]; 546 562 for (size_t i = 0; i < RT_ELEMENTS(au16TestInts); ++i) 547 au16TestInts[i] = (uint16_t)RTRandU32Ex( 0, UINT16_MAX);563 au16TestInts[i] = (uint16_t)RTRandU32Ex(1, UINT16_MAX); 548 564 test1<RTCList, uint16_t, uint16_t, uint16_t>("ST: Native type", au16TestInts, RT_ELEMENTS(au16TestInts)); 549 565 test1<RTCMTList, uint16_t, uint16_t, uint16_t>("MT: Native type", au16TestInts, RT_ELEMENTS(au16TestInts)); … … 551 567 uint32_t au32TestInts[s_cTestCount]; 552 568 for (size_t i = 0; i < RT_ELEMENTS(au32TestInts); ++i) 553 au32TestInts[i] = RTRandU32 ();569 au32TestInts[i] = RTRandU32Ex(1, UINT32_MAX); 554 570 test1<RTCList, uint32_t, uint32_t, uint32_t>("ST: Native type", au32TestInts, RT_ELEMENTS(au32TestInts)); 555 571 test1<RTCMTList, uint32_t, uint32_t, uint32_t>("MT: Native type", au32TestInts, RT_ELEMENTS(au32TestInts)); … … 560 576 uint64_t au64TestInts[s_cTestCount]; 561 577 for (size_t i = 0; i < RT_ELEMENTS(au64TestInts); ++i) 562 au64TestInts[i] = RTRandU64 ();578 au64TestInts[i] = RTRandU64Ex(1, UINT64_MAX); 563 579 test1<RTCList, uint64_t, uint64_t, uint64_t>("ST: Specialized type", au64TestInts, RT_ELEMENTS(au64TestInts)); 564 580 test1<RTCMTList, uint64_t, uint64_t, uint64_t>("MT: Specialized type", au64TestInts, RT_ELEMENTS(au64TestInts));
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器