VirtualBox

Changeset 46208 in vbox for trunk/src


Ignore:
Timestamp:
May 22, 2013 9:26:27 AM (12 years ago)
Author:
vboxsync
Message:

tstRTStrCache: check that a real strcache impl doesn't return duplicates.

Location:
trunk/src/VBox/Runtime
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/strcache.cpp

    r46203 r46208  
    11391139RT_EXPORT_SYMBOL(RTStrCacheLength);
    11401140
     1141
     1142RTDECL(bool) RTStrCacheIsRealImpl(void)
     1143{
     1144    return true;
     1145}
     1146RT_EXPORT_SYMBOL(RTStrCacheIsRealImpl);
     1147
  • trunk/src/VBox/Runtime/generic/strcache-stubs-generic.cpp

    r46107 r46208  
    124124RT_EXPORT_SYMBOL(RTStrCacheLength);
    125125
     126
     127RTDECL(bool) RTStrCacheIsRealImpl(void)
     128{
     129    return false;
     130}
     131RT_EXPORT_SYMBOL(RTStrCacheIsRealImpl);
     132
  • trunk/src/VBox/Runtime/testcase/tstRTStrCache.cpp

    r46199 r46208  
    122122    }
    123123
     124    if (RTStrCacheIsRealImpl())
     125    {
     126        for (uint32_t i = 1; i < RT_ELEMENTS(pszTest1Rets); i++)
     127        {
     128            uint32_t cRefs;
     129            const char *psz1, *psz2;
     130            RTTESTI_CHECK((psz1 = RTStrCacheEnterN(hStrCache, szTest,  i)) == pszTest1Rets[i]);
     131            RTTESTI_CHECK((psz2 = RTStrCacheEnterN(hStrCache, szTest2, i)) == pszTest2Rets[i]);
     132            RTTESTI_CHECK_MSG((cRefs = RTStrCacheRelease(hStrCache, psz1)) == 1, ("cRefs=%#x i=%#x\n", cRefs, i));
     133            RTTESTI_CHECK_MSG((cRefs = RTStrCacheRelease(hStrCache, psz2)) == 1, ("cRefs=%#x i=%#x\n", cRefs, i));
     134        }
     135    }
     136
    124137    for (uint32_t i = 1; i < RT_ELEMENTS(pszTest1Rets); i++)
    125138    {
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