VirtualBox

Ignore:
Timestamp:
Oct 29, 2010 2:42:36 PM (14 years ago)
Author:
vboxsync
Message:

iprt::MiniString: Fixed bug in compare("") and equals("") caused by m_psz=NULL when m_cch=0 and RTStr[I]Cmp regarding NULL and "" as different things. Added format+va_list constructor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstIprtMiniString.cpp

    r33605 r33610  
    3737
    3838
     39static void test1Hlp1(const char *pszExpect, const char *pszFormat, ...)
     40{
     41    va_list va;
     42    va_start(va, pszFormat);
     43    iprt::MiniString strTst(pszFormat, va);
     44    va_end(va);
     45    RTTESTI_CHECK_MSG(strTst.equals(pszExpect),  ("strTst='%s' expected='%s'\n",  strTst.c_str(), pszExpect));
     46}
    3947
    4048static void test1(RTTEST hTest)
     
    118126    CHECK(iprt::MiniString("abc").equalsIgnoreCase("ABC"));
    119127    CHECK(!iprt::MiniString("abc").equalsIgnoreCase("dBC"));
     128    CHECK(iprt::MiniString("").equals(""));
     129    CHECK(iprt::MiniString("").equalsIgnoreCase(""));
    120130
    121131    copy2.setNull();
     
    138148    iprt::MiniString StrFmt;
    139149    CHECK(StrFmt.printf("%s-%s-%d", "abc", "def", 42).equals("abc-def-42"));
     150    test1Hlp1("abc-42-def", "%s-%d-%s", "abc", 42, "def");
     151    test1Hlp1("", "");
     152    test1Hlp1("1", "1");
     153    test1Hlp1("foobar", "%s", "foobar");
    140154
    141155#undef CHECK
Note: See TracChangeset for help on using the changeset viewer.

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