vbox的更動 36527 路徑 trunk/src/VBox/Runtime/testcase
- 時間撮記:
- 2011-4-4 下午01:16:09 (14 年 以前)
- 位置:
- trunk/src/VBox/Runtime/testcase
- 檔案:
-
- 修改 2 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Runtime/testcase/tstIprtList.cpp
r36525 r36527 567 567 * Big size type (translate to internal pointer list). 568 568 */ 569 test1<iprt::list, iprt::MiniString, iprt::MiniString*, const char *>("ST: Class type", g_apszTestStrings, RT_ELEMENTS(g_apszTestStrings));570 test1<iprt::mtlist, iprt::MiniString, iprt::MiniString*, const char *>("MT: Class type", g_apszTestStrings, RT_ELEMENTS(g_apszTestStrings));569 test1<iprt::list, RTCString, RTCString *, const char *>("ST: Class type", g_apszTestStrings, RT_ELEMENTS(g_apszTestStrings)); 570 test1<iprt::mtlist, RTCString, RTCString *, const char *>("MT: Class type", g_apszTestStrings, RT_ELEMENTS(g_apszTestStrings)); 571 571 572 572 /* -
trunk/src/VBox/Runtime/testcase/tstIprtMiniString.cpp
r36501 r36527 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT Testcase - iprt::MiniString.3 * IPRT Testcase - RTCString. 4 4 */ 5 5 … … 42 42 va_list va; 43 43 va_start(va, pszFormat); 44 iprt::MiniString strTst(pszFormat, va);44 RTCString strTst(pszFormat, va); 45 45 va_end(va); 46 46 RTTESTI_CHECK_MSG(strTst.equals(pszExpect), ("strTst='%s' expected='%s'\n", strTst.c_str(), pszExpect)); … … 70 70 } while (0) 71 71 72 iprt::MiniString empty;72 RTCString empty; 73 73 CHECK(empty.length() == 0); 74 74 CHECK(empty.capacity() == 0); 75 75 76 iprt::MiniString sixbytes("12345");76 RTCString sixbytes("12345"); 77 77 CHECK(sixbytes.length() == 5); 78 78 CHECK(sixbytes.capacity() == 6); 79 79 80 sixbytes.append( iprt::MiniString("678"));80 sixbytes.append(RTCString("678")); 81 81 CHECK(sixbytes.length() == 8); 82 82 CHECK(sixbytes.capacity() >= 9); … … 95 95 CHECK(sixbytes.capacity() == 7); 96 96 97 iprt::MiniString morebytes("tobereplaced");97 RTCString morebytes("tobereplaced"); 98 98 morebytes = "newstring "; 99 99 morebytes.append(sixbytes); … … 101 101 CHECK_DUMP(morebytes == "newstring 123456", morebytes.c_str()); 102 102 103 iprt::MiniString third(morebytes);103 RTCString third(morebytes); 104 104 third.reserve(100 * 1024); // 100 KB 105 105 CHECK_DUMP(third == "newstring 123456", morebytes.c_str() ); … … 107 107 CHECK(third.length() == morebytes.length()); // must not have changed 108 108 109 iprt::MiniString copy1(morebytes);110 iprt::MiniString copy2 = morebytes;109 RTCString copy1(morebytes); 110 RTCString copy2 = morebytes; 111 111 CHECK(copy1 == copy2); 112 112 … … 117 117 CHECK(copy1.length() == 0); 118 118 119 CHECK( iprt::MiniString("abc") < iprt::MiniString("def"));120 CHECK( iprt::MiniString("") < iprt::MiniString("def"));121 CHECK( iprt::MiniString("abc") > iprt::MiniString(""));122 CHECK( iprt::MiniString("abc") != iprt::MiniString("def"));123 CHECK_DUMP_I( iprt::MiniString("def") > iprt::MiniString("abc"));124 CHECK( iprt::MiniString("abc") == iprt::MiniString("abc"));125 CHECK( iprt::MiniString("").compare("") == 0);126 CHECK( iprt::MiniString("").compare(NULL) == 0);127 CHECK( iprt::MiniString("").compare("a") < 0);128 CHECK( iprt::MiniString("a").compare("") > 0);129 CHECK( iprt::MiniString("a").compare(NULL) > 0);130 131 CHECK( iprt::MiniString("abc") < "def");132 CHECK( iprt::MiniString("abc") != "def");133 CHECK_DUMP_I( iprt::MiniString("def") > "abc");134 CHECK( iprt::MiniString("abc") == "abc");135 136 CHECK( iprt::MiniString("abc").equals("abc"));137 CHECK(! iprt::MiniString("abc").equals("def"));138 CHECK( iprt::MiniString("abc").equalsIgnoreCase("Abc"));139 CHECK( iprt::MiniString("abc").equalsIgnoreCase("ABc"));140 CHECK( iprt::MiniString("abc").equalsIgnoreCase("ABC"));141 CHECK(! iprt::MiniString("abc").equalsIgnoreCase("dBC"));142 CHECK( iprt::MiniString("").equals(""));143 CHECK( iprt::MiniString("").equals(NULL));144 CHECK(! iprt::MiniString("").equals("a"));145 CHECK(! iprt::MiniString("a").equals(""));146 CHECK(! iprt::MiniString("a").equals(NULL));147 CHECK( iprt::MiniString("").equalsIgnoreCase(""));148 CHECK( iprt::MiniString("").equalsIgnoreCase(NULL));149 CHECK(! iprt::MiniString("").equalsIgnoreCase("a"));150 CHECK(! iprt::MiniString("a").equalsIgnoreCase(""));119 CHECK(RTCString("abc") < RTCString("def")); 120 CHECK(RTCString("") < RTCString("def")); 121 CHECK(RTCString("abc") > RTCString("")); 122 CHECK(RTCString("abc") != RTCString("def")); 123 CHECK_DUMP_I(RTCString("def") > RTCString("abc")); 124 CHECK(RTCString("abc") == RTCString("abc")); 125 CHECK(RTCString("").compare("") == 0); 126 CHECK(RTCString("").compare(NULL) == 0); 127 CHECK(RTCString("").compare("a") < 0); 128 CHECK(RTCString("a").compare("") > 0); 129 CHECK(RTCString("a").compare(NULL) > 0); 130 131 CHECK(RTCString("abc") < "def"); 132 CHECK(RTCString("abc") != "def"); 133 CHECK_DUMP_I(RTCString("def") > "abc"); 134 CHECK(RTCString("abc") == "abc"); 135 136 CHECK(RTCString("abc").equals("abc")); 137 CHECK(!RTCString("abc").equals("def")); 138 CHECK(RTCString("abc").equalsIgnoreCase("Abc")); 139 CHECK(RTCString("abc").equalsIgnoreCase("ABc")); 140 CHECK(RTCString("abc").equalsIgnoreCase("ABC")); 141 CHECK(!RTCString("abc").equalsIgnoreCase("dBC")); 142 CHECK(RTCString("").equals("")); 143 CHECK(RTCString("").equals(NULL)); 144 CHECK(!RTCString("").equals("a")); 145 CHECK(!RTCString("a").equals("")); 146 CHECK(!RTCString("a").equals(NULL)); 147 CHECK(RTCString("").equalsIgnoreCase("")); 148 CHECK(RTCString("").equalsIgnoreCase(NULL)); 149 CHECK(!RTCString("").equalsIgnoreCase("a")); 150 CHECK(!RTCString("a").equalsIgnoreCase("")); 151 151 152 152 copy2.setNull(); … … 167 167 168 168 /* printf */ 169 iprt::MiniString StrFmt;169 RTCString StrFmt; 170 170 CHECK(StrFmt.printf("%s-%s-%d", "abc", "def", 42).equals("abc-def-42")); 171 171 test1Hlp1("abc-42-def", "%s-%d-%s", "abc", 42, "def"); … … 175 175 176 176 /* substring constructors */ 177 iprt::MiniString SubStr1("", (size_t)0);177 RTCString SubStr1("", (size_t)0); 178 178 CHECK_EQUAL(SubStr1, ""); 179 179 180 iprt::MiniString SubStr2("abcdef", 2);180 RTCString SubStr2("abcdef", 2); 181 181 CHECK_EQUAL(SubStr2, "ab"); 182 182 183 iprt::MiniString SubStr3("abcdef", 1);183 RTCString SubStr3("abcdef", 1); 184 184 CHECK_EQUAL(SubStr3, "a"); 185 185 186 iprt::MiniString SubStr4("abcdef", 6);186 RTCString SubStr4("abcdef", 6); 187 187 CHECK_EQUAL(SubStr4, "abcdef"); 188 188 189 iprt::MiniString SubStr5("abcdef", 7);189 RTCString SubStr5("abcdef", 7); 190 190 CHECK_EQUAL(SubStr5, "abcdef"); 191 191 192 192 193 iprt::MiniString SubStrBase("abcdef");194 195 iprt::MiniString SubStr10(SubStrBase, 0);193 RTCString SubStrBase("abcdef"); 194 195 RTCString SubStr10(SubStrBase, 0); 196 196 CHECK_EQUAL(SubStr10, "abcdef"); 197 197 198 iprt::MiniString SubStr11(SubStrBase, 1);198 RTCString SubStr11(SubStrBase, 1); 199 199 CHECK_EQUAL(SubStr11, "bcdef"); 200 200 201 iprt::MiniString SubStr12(SubStrBase, 1, 1);201 RTCString SubStr12(SubStrBase, 1, 1); 202 202 CHECK_EQUAL(SubStr12, "b"); 203 203 204 iprt::MiniString SubStr13(SubStrBase, 2, 3);204 RTCString SubStr13(SubStrBase, 2, 3); 205 205 CHECK_EQUAL(SubStr13, "cde"); 206 206 207 iprt::MiniString SubStr14(SubStrBase, 2, 4);207 RTCString SubStr14(SubStrBase, 2, 4); 208 208 CHECK_EQUAL(SubStr14, "cdef"); 209 209 210 iprt::MiniString SubStr15(SubStrBase, 2, 5);210 RTCString SubStr15(SubStrBase, 2, 5); 211 211 CHECK_EQUAL(SubStr15, "cdef"); 212 212 213 213 /* substr() and substrCP() functions */ 214 iprt::MiniString strTest("");214 RTCString strTest(""); 215 215 CHECK_EQUAL(strTest.substr(0), ""); 216 216 CHECK_EQUAL(strTest.substrCP(0), ""); … … 257 257 258 258 /* split */ 259 iprt::list< iprt::MiniString> spList1 = iprt::MiniString("##abcdef##abcdef####abcdef##").split("##", iprt::MiniString::RemoveEmptyParts);259 iprt::list<RTCString> spList1 = RTCString("##abcdef##abcdef####abcdef##").split("##", RTCString::RemoveEmptyParts); 260 260 RTTESTI_CHECK(spList1.size() == 3); 261 261 for (size_t i = 0; i < spList1.size(); ++i) 262 262 RTTESTI_CHECK(spList1.at(i) == "abcdef"); 263 iprt::list< iprt::MiniString> spList2 = iprt::MiniString("##abcdef##abcdef####abcdef##").split("##", iprt::MiniString::KeepEmptyParts);263 iprt::list<RTCString> spList2 = RTCString("##abcdef##abcdef####abcdef##").split("##", RTCString::KeepEmptyParts); 264 264 RTTESTI_CHECK_RETV(spList2.size() == 5); 265 265 RTTESTI_CHECK(spList2.at(0) == ""); … … 268 268 RTTESTI_CHECK(spList2.at(3) == ""); 269 269 RTTESTI_CHECK(spList2.at(4) == "abcdef"); 270 iprt::list< iprt::MiniString> spList3 = iprt::MiniString().split("##", iprt::MiniString::KeepEmptyParts);270 iprt::list<RTCString> spList3 = RTCString().split("##", RTCString::KeepEmptyParts); 271 271 RTTESTI_CHECK(spList3.size() == 0); 272 iprt::list< iprt::MiniString> spList4 = iprt::MiniString().split("");272 iprt::list<RTCString> spList4 = RTCString().split(""); 273 273 RTTESTI_CHECK(spList4.size() == 0); 274 iprt::list< iprt::MiniString> spList5 = iprt::MiniString("abcdef").split("");274 iprt::list<RTCString> spList5 = RTCString("abcdef").split(""); 275 275 RTTESTI_CHECK_RETV(spList5.size() == 1); 276 276 RTTESTI_CHECK(spList5.at(0) == "abcdef"); 277 277 278 278 /* join */ 279 iprt::list< iprt::MiniString> jnList;280 strTest = iprt::MiniString::join(jnList);279 iprt::list<RTCString> jnList; 280 strTest = RTCString::join(jnList); 281 281 RTTESTI_CHECK(strTest == ""); 282 strTest = iprt::MiniString::join(jnList, "##");282 strTest = RTCString::join(jnList, "##"); 283 283 RTTESTI_CHECK(strTest == ""); 284 284 for (size_t i = 0; i < 5; ++i) 285 285 jnList.append("abcdef"); 286 strTest = iprt::MiniString::join(jnList);286 strTest = RTCString::join(jnList); 287 287 RTTESTI_CHECK(strTest == "abcdefabcdefabcdefabcdefabcdef"); 288 strTest = iprt::MiniString::join(jnList, "##");288 strTest = RTCString::join(jnList, "##"); 289 289 RTTESTI_CHECK(strTest == "abcdef##abcdef##abcdef##abcdef##abcdef"); 290 290 291 291 /* special constructor and assignment arguments */ 292 iprt::MiniString StrCtor1("");292 RTCString StrCtor1(""); 293 293 RTTESTI_CHECK(StrCtor1.isEmpty()); 294 294 RTTESTI_CHECK(StrCtor1.length() == 0); 295 295 296 iprt::MiniString StrCtor2(NULL);296 RTCString StrCtor2(NULL); 297 297 RTTESTI_CHECK(StrCtor2.isEmpty()); 298 298 RTTESTI_CHECK(StrCtor2.length() == 0); 299 299 300 iprt::MiniString StrCtor1d(StrCtor1);300 RTCString StrCtor1d(StrCtor1); 301 301 RTTESTI_CHECK(StrCtor1d.isEmpty()); 302 302 RTTESTI_CHECK(StrCtor1d.length() == 0); 303 303 304 iprt::MiniString StrCtor2d(StrCtor2);304 RTCString StrCtor2d(StrCtor2); 305 305 RTTESTI_CHECK(StrCtor2d.isEmpty()); 306 306 RTTESTI_CHECK(StrCtor2d.length() == 0); … … 308 308 for (unsigned i = 0; i < 2; i++) 309 309 { 310 iprt::MiniString StrAssign;310 RTCString StrAssign; 311 311 if (i) StrAssign = "abcdef"; 312 312 StrAssign = (char *)NULL; … … 362 362 } while (0) 363 363 364 iprt::MiniString strTmp;364 RTCString strTmp; 365 365 char szDst[16]; 366 366 367 367 /* Collect all upper and lower case code points. */ 368 iprt::MiniString strLower("");368 RTCString strLower(""); 369 369 strLower.reserve(_4M); 370 370 371 iprt::MiniString strUpper("");371 RTCString strUpper(""); 372 372 strUpper.reserve(_4M); 373 373 … … 392 392 size_t cch = 0; 393 393 const char *pszCur = strLower.c_str(); 394 iprt::MiniString strUpper2("");394 RTCString strUpper2(""); 395 395 strUpper2.reserve(strLower.length() + 64); 396 396 for (;;) … … 436 436 cch = 0; 437 437 pszCur = strUpper.c_str(); 438 iprt::MiniString strLower2("");438 RTCString strLower2(""); 439 439 strLower2.reserve(strUpper.length() + 64); 440 440 for (;;)
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器