VirtualBox

Changeset 64342 in vbox for trunk/src


Ignore:
Timestamp:
Oct 20, 2016 7:28:01 PM (8 years ago)
Author:
vboxsync
Message:

tstRTStrFormat: duh!

File:
1 edited

Legend:

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

    r64341 r64342  
    214214            const size_t cchCompare = cbBuf >= sizeof(g_szCheck42Expect) ? sizeof(g_szCheck42Expect) - 1 \
    215215                                    : cbBuf > 0 ? cbBuf - 1 : 0; \
    216             /*size_t       cch1Expect = cchCompare; */ \
     216            size_t       cch1Expect = cchCompare; \
    217217            ssize_t      cch2Expect = cbBuf >= sizeof(g_szCheck42Expect) \
    218218                                    ? sizeof(g_szCheck42Expect) - 1 : -(ssize_t)sizeof(g_szCheck42Expect); \
    219219            \
    220             cch2 = RTStrPrintf(pszBuf, cbBuf, g_szCheck42Fmt, arg, 42, arg, 42);\
     220            cch = RTStrPrintf(pszBuf, cbBuf, g_szCheck42Fmt, arg, 42, arg, 42);\
    221221            if (   memcmp(pszBuf, g_szCheck42Expect, cchCompare) != 0 \
    222222                || pszBuf[cchCompare] != chAfter) \
     
    225225                              "    wanted: '%s'\n", \
    226226                              __LINE__, fmt, cbBuf, cbBuf ? pszBuf : "", g_szCheck42Expect); \
    227             /*if (cch != cch1Expect) - code is buggy */ \
    228             /*     RTTestIFailed("at line %d: Invalid length %d returned for cbBuf=%zu, expected %zd! (#1)\n", */ \
    229             /*                   __LINE__, cch, cbBuf, cch1Expect); */ \
     227            if (cch != cch1Expect) \
     228                 RTTestIFailed("at line %d: Invalid length %d returned for cbBuf=%zu, expected %zd! (#1)\n", \
     229                               __LINE__, cch, cbBuf, cch1Expect); \
    230230            \
    231231            cch2 = RTStrPrintf2(pszBuf, cbBuf, g_szCheck42Fmt, arg, 42, arg, 42);\
     
    246246    if (strcmp(pszBuf, Correct)) \
    247247        RTTestIFailed("error:    '%s'\n" \
    248                       "expected: '%s'\n", pszBuf, Correct); \
     248                      "expected: '%s'\n", pszBuf, Correct);
     249
     250    /*
     251     * Test the waters.
     252     */
     253    CHECK42("%d", 127, "127");
     254    CHECK42("%s", "721", "721");
    249255
    250256    /*
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