VirtualBox

vbox的更動 36527 路徑 trunk/src/VBox/Runtime/testcase


忽略:
時間撮記:
2011-4-4 下午01:16:09 (14 年 以前)
作者:
vboxsync
訊息:

iprt::MiniString -> RTCString.

位置:
trunk/src/VBox/Runtime/testcase
檔案:
修改 2 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Runtime/testcase/tstIprtList.cpp

    r36525 r36527  
    567567     * Big size type (translate to internal pointer list).
    568568     */
    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));
    571571
    572572    /*
  • trunk/src/VBox/Runtime/testcase/tstIprtMiniString.cpp

    r36501 r36527  
    11/* $Id$ */
    22/** @file
    3  * IPRT Testcase - iprt::MiniString.
     3 * IPRT Testcase - RTCString.
    44 */
    55
     
    4242    va_list va;
    4343    va_start(va, pszFormat);
    44     iprt::MiniString strTst(pszFormat, va);
     44    RTCString strTst(pszFormat, va);
    4545    va_end(va);
    4646    RTTESTI_CHECK_MSG(strTst.equals(pszExpect),  ("strTst='%s' expected='%s'\n",  strTst.c_str(), pszExpect));
     
    7070    } while (0)
    7171
    72     iprt::MiniString empty;
     72    RTCString empty;
    7373    CHECK(empty.length() == 0);
    7474    CHECK(empty.capacity() == 0);
    7575
    76     iprt::MiniString sixbytes("12345");
     76    RTCString sixbytes("12345");
    7777    CHECK(sixbytes.length() == 5);
    7878    CHECK(sixbytes.capacity() == 6);
    7979
    80     sixbytes.append(iprt::MiniString("678"));
     80    sixbytes.append(RTCString("678"));
    8181    CHECK(sixbytes.length() == 8);
    8282    CHECK(sixbytes.capacity() >= 9);
     
    9595    CHECK(sixbytes.capacity() == 7);
    9696
    97     iprt::MiniString morebytes("tobereplaced");
     97    RTCString morebytes("tobereplaced");
    9898    morebytes = "newstring ";
    9999    morebytes.append(sixbytes);
     
    101101    CHECK_DUMP(morebytes == "newstring 123456", morebytes.c_str());
    102102
    103     iprt::MiniString third(morebytes);
     103    RTCString third(morebytes);
    104104    third.reserve(100 * 1024);      // 100 KB
    105105    CHECK_DUMP(third == "newstring 123456", morebytes.c_str() );
     
    107107    CHECK(third.length() == morebytes.length());          // must not have changed
    108108
    109     iprt::MiniString copy1(morebytes);
    110     iprt::MiniString copy2 = morebytes;
     109    RTCString copy1(morebytes);
     110    RTCString copy2 = morebytes;
    111111    CHECK(copy1 == copy2);
    112112
     
    117117    CHECK(copy1.length() == 0);
    118118
    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(""));
    151151
    152152    copy2.setNull();
     
    167167
    168168    /* printf */
    169     iprt::MiniString StrFmt;
     169    RTCString StrFmt;
    170170    CHECK(StrFmt.printf("%s-%s-%d", "abc", "def", 42).equals("abc-def-42"));
    171171    test1Hlp1("abc-42-def", "%s-%d-%s", "abc", 42, "def");
     
    175175
    176176    /* substring constructors */
    177     iprt::MiniString SubStr1("", (size_t)0);
     177    RTCString SubStr1("", (size_t)0);
    178178    CHECK_EQUAL(SubStr1, "");
    179179
    180     iprt::MiniString SubStr2("abcdef", 2);
     180    RTCString SubStr2("abcdef", 2);
    181181    CHECK_EQUAL(SubStr2, "ab");
    182182
    183     iprt::MiniString SubStr3("abcdef", 1);
     183    RTCString SubStr3("abcdef", 1);
    184184    CHECK_EQUAL(SubStr3, "a");
    185185
    186     iprt::MiniString SubStr4("abcdef", 6);
     186    RTCString SubStr4("abcdef", 6);
    187187    CHECK_EQUAL(SubStr4, "abcdef");
    188188
    189     iprt::MiniString SubStr5("abcdef", 7);
     189    RTCString SubStr5("abcdef", 7);
    190190    CHECK_EQUAL(SubStr5, "abcdef");
    191191
    192192
    193     iprt::MiniString SubStrBase("abcdef");
    194 
    195     iprt::MiniString SubStr10(SubStrBase, 0);
     193    RTCString SubStrBase("abcdef");
     194
     195    RTCString SubStr10(SubStrBase, 0);
    196196    CHECK_EQUAL(SubStr10, "abcdef");
    197197
    198     iprt::MiniString SubStr11(SubStrBase, 1);
     198    RTCString SubStr11(SubStrBase, 1);
    199199    CHECK_EQUAL(SubStr11, "bcdef");
    200200
    201     iprt::MiniString SubStr12(SubStrBase, 1, 1);
     201    RTCString SubStr12(SubStrBase, 1, 1);
    202202    CHECK_EQUAL(SubStr12, "b");
    203203
    204     iprt::MiniString SubStr13(SubStrBase, 2, 3);
     204    RTCString SubStr13(SubStrBase, 2, 3);
    205205    CHECK_EQUAL(SubStr13, "cde");
    206206
    207     iprt::MiniString SubStr14(SubStrBase, 2, 4);
     207    RTCString SubStr14(SubStrBase, 2, 4);
    208208    CHECK_EQUAL(SubStr14, "cdef");
    209209
    210     iprt::MiniString SubStr15(SubStrBase, 2, 5);
     210    RTCString SubStr15(SubStrBase, 2, 5);
    211211    CHECK_EQUAL(SubStr15, "cdef");
    212212
    213213    /* substr() and substrCP() functions */
    214     iprt::MiniString strTest("");
     214    RTCString strTest("");
    215215    CHECK_EQUAL(strTest.substr(0), "");
    216216    CHECK_EQUAL(strTest.substrCP(0), "");
     
    257257
    258258    /* 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);
    260260    RTTESTI_CHECK(spList1.size() == 3);
    261261    for (size_t i = 0; i < spList1.size(); ++i)
    262262        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);
    264264    RTTESTI_CHECK_RETV(spList2.size() == 5);
    265265    RTTESTI_CHECK(spList2.at(0) == "");
     
    268268    RTTESTI_CHECK(spList2.at(3) == "");
    269269    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);
    271271    RTTESTI_CHECK(spList3.size() == 0);
    272     iprt::list<iprt::MiniString> spList4 = iprt::MiniString().split("");
     272    iprt::list<RTCString> spList4 = RTCString().split("");
    273273    RTTESTI_CHECK(spList4.size() == 0);
    274     iprt::list<iprt::MiniString> spList5 = iprt::MiniString("abcdef").split("");
     274    iprt::list<RTCString> spList5 = RTCString("abcdef").split("");
    275275    RTTESTI_CHECK_RETV(spList5.size() == 1);
    276276    RTTESTI_CHECK(spList5.at(0) == "abcdef");
    277277
    278278    /* join */
    279     iprt::list<iprt::MiniString> jnList;
    280     strTest = iprt::MiniString::join(jnList);
     279    iprt::list<RTCString> jnList;
     280    strTest = RTCString::join(jnList);
    281281    RTTESTI_CHECK(strTest == "");
    282     strTest = iprt::MiniString::join(jnList, "##");
     282    strTest = RTCString::join(jnList, "##");
    283283    RTTESTI_CHECK(strTest == "");
    284284    for (size_t i = 0; i < 5; ++i)
    285285        jnList.append("abcdef");
    286     strTest = iprt::MiniString::join(jnList);
     286    strTest = RTCString::join(jnList);
    287287    RTTESTI_CHECK(strTest == "abcdefabcdefabcdefabcdefabcdef");
    288     strTest = iprt::MiniString::join(jnList, "##");
     288    strTest = RTCString::join(jnList, "##");
    289289    RTTESTI_CHECK(strTest == "abcdef##abcdef##abcdef##abcdef##abcdef");
    290290
    291291    /* special constructor and assignment arguments */
    292     iprt::MiniString StrCtor1("");
     292    RTCString StrCtor1("");
    293293    RTTESTI_CHECK(StrCtor1.isEmpty());
    294294    RTTESTI_CHECK(StrCtor1.length() == 0);
    295295
    296     iprt::MiniString StrCtor2(NULL);
     296    RTCString StrCtor2(NULL);
    297297    RTTESTI_CHECK(StrCtor2.isEmpty());
    298298    RTTESTI_CHECK(StrCtor2.length() == 0);
    299299
    300     iprt::MiniString StrCtor1d(StrCtor1);
     300    RTCString StrCtor1d(StrCtor1);
    301301    RTTESTI_CHECK(StrCtor1d.isEmpty());
    302302    RTTESTI_CHECK(StrCtor1d.length() == 0);
    303303
    304     iprt::MiniString StrCtor2d(StrCtor2);
     304    RTCString StrCtor2d(StrCtor2);
    305305    RTTESTI_CHECK(StrCtor2d.isEmpty());
    306306    RTTESTI_CHECK(StrCtor2d.length() == 0);
     
    308308    for (unsigned i = 0; i < 2; i++)
    309309    {
    310         iprt::MiniString StrAssign;
     310        RTCString StrAssign;
    311311        if (i) StrAssign = "abcdef";
    312312        StrAssign = (char *)NULL;
     
    362362    } while (0)
    363363
    364     iprt::MiniString strTmp;
     364    RTCString strTmp;
    365365    char szDst[16];
    366366
    367367    /* Collect all upper and lower case code points. */
    368     iprt::MiniString strLower("");
     368    RTCString strLower("");
    369369    strLower.reserve(_4M);
    370370
    371     iprt::MiniString strUpper("");
     371    RTCString strUpper("");
    372372    strUpper.reserve(_4M);
    373373
     
    392392    size_t      cch    = 0;
    393393    const char *pszCur = strLower.c_str();
    394     iprt::MiniString    strUpper2("");
     394    RTCString    strUpper2("");
    395395    strUpper2.reserve(strLower.length() + 64);
    396396    for (;;)
     
    436436    cch    = 0;
    437437    pszCur = strUpper.c_str();
    438     iprt::MiniString    strLower2("");
     438    RTCString    strLower2("");
    439439    strLower2.reserve(strUpper.length() + 64);
    440440    for (;;)
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette