VirtualBox

Changeset 74194 in vbox for trunk/src


Ignore:
Timestamp:
Sep 11, 2018 11:38:01 AM (6 years ago)
Author:
vboxsync
Message:

IPRT/rest: More array tests. bugref:9167

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTCRest-1.cpp

    r74193 r74194  
    15351535        RTTESTI_CHECK_RC(Arr2.insert(2, new MyRestInt16(2)), VINF_SUCCESS);
    15361536        verifyArray(Arr2, __LINE__, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
     1537        RTTESTI_CHECK_MSG(MyRestInt16::s_cInstances == Arr2.size(), ("%zu vs %zu\n", MyRestInt16::s_cInstances, Arr2.size()));
    15371538
    15381539        RTTESTI_CHECK(Arr2.size() == 10);
     
    15411542        {
    15421543            MyRestInt16 *pCur = Arr2.at(i);
    1543             RTTESTI_CHECK(pCur->m_iValue == i);
     1544            RTTESTI_CHECK(pCur->m_iValue == (int16_t)i);
    15441545
    15451546            MyRestInt16 const *pCur2 = pConstArr2->at(i);
    1546             RTTESTI_CHECK(pCur2->m_iValue == i);
     1547            RTTESTI_CHECK(pCur2->m_iValue == (int16_t)i);
    15471548        }
    15481549
     
    15581559        RTTESTI_CHECK_RC(Arr2.replaceCopy(2, MyRestInt16(2)), VWRN_ALREADY_EXISTS);
    15591560        verifyArray(Arr2, __LINE__, 11, 0, 1, 2, 3, 4, 5, 6, 77, 8, 9, 10);
     1561        RTTESTI_CHECK_MSG(MyRestInt16::s_cInstances == Arr2.size(), ("%zu vs %zu\n", MyRestInt16::s_cInstances, Arr2.size()));
    15601562
    15611563        /* copy constructor: */
     
    15651567        }
    15661568        verifyArray(Arr2, __LINE__, 11, 0, 1, 2, 3, 4, 5, 6, 77, 8, 9, 10);
     1569        RTTESTI_CHECK_MSG(MyRestInt16::s_cInstances == Arr2.size(), ("%zu vs %zu\n", MyRestInt16::s_cInstances, Arr2.size()));
    15671570
    15681571        {
     
    15731576        }
    15741577        verifyArray(Arr2, __LINE__, 11, 0, 1, 2, 3, 4, 5, 6, 77, 8, 9, 10);
    1575 
    1576         /* copy method: */
     1578        RTTESTI_CHECK_MSG(MyRestInt16::s_cInstances == Arr2.size(), ("%zu vs %zu\n", MyRestInt16::s_cInstances, Arr2.size()));
     1579
     1580        /* copy method + clear: */
    15771581        {
    15781582            RTCRestArray<MyRestInt16> Arr2Copy3;
     
    15861590        }
    15871591        verifyArray(Arr2, __LINE__, 11, 0, 1, 2, 3, 4, 5, 6, 77, 8, 9, 10);
     1592        RTTESTI_CHECK_MSG(MyRestInt16::s_cInstances == Arr2.size(), ("%zu vs %zu\n", MyRestInt16::s_cInstances, Arr2.size()));
     1593
     1594        /* Check setNull and resetToDefaults with copies: */
     1595        {
     1596            RTCRestArray<MyRestInt16> Arr2Copy4(Arr2);
     1597            verifyArray(Arr2Copy4, __LINE__, 11, 0, 1, 2, 3, 4, 5, 6, 77, 8, 9, 10);
     1598
     1599            RTTESTI_CHECK_RC(Arr2Copy4.setNull(), VINF_SUCCESS);
     1600            verifyArray(Arr2Copy4, __LINE__, 0);
     1601            RTTESTI_CHECK_MSG(MyRestInt16::s_cInstances == Arr2.size(), ("%zu vs %zu\n", MyRestInt16::s_cInstances, Arr2.size()));
     1602            RTTESTI_CHECK(Arr2Copy4.isNull() == true);
     1603
     1604            RTTESTI_CHECK_RC(Arr2Copy4.resetToDefault(), VINF_SUCCESS);
     1605            RTTESTI_CHECK(Arr2Copy4.isNull() == false);
     1606            verifyArray(Arr2Copy4, __LINE__, 0);
     1607        }
     1608        verifyArray(Arr2, __LINE__, 11, 0, 1, 2, 3, 4, 5, 6, 77, 8, 9, 10);
     1609        {
     1610            RTCRestArray<MyRestInt16> Arr2Copy5(Arr2);
     1611            verifyArray(Arr2Copy5, __LINE__, 11, 0, 1, 2, 3, 4, 5, 6, 77, 8, 9, 10);
     1612
     1613            RTTESTI_CHECK_RC(Arr2Copy5.resetToDefault(), VINF_SUCCESS);
     1614            verifyArray(Arr2Copy5, __LINE__, 0);
     1615            RTTESTI_CHECK_MSG(MyRestInt16::s_cInstances == Arr2.size(), ("%zu vs %zu\n", MyRestInt16::s_cInstances, Arr2.size()));
     1616            RTTESTI_CHECK(Arr2Copy5.isNull() == false);
     1617
     1618            RTTESTI_CHECK_RC(Arr2Copy5.setNull(), VINF_SUCCESS);
     1619            RTTESTI_CHECK(Arr2Copy5.isNull() == true);
     1620
     1621            RTTESTI_CHECK_RC(Arr2Copy5.append(new MyRestInt16(100)), VINF_SUCCESS);
     1622            RTTESTI_CHECK(Arr2Copy5.isNull() == false);
     1623            verifyArray(Arr2Copy5, __LINE__, 1, 100);
     1624            RTTESTI_CHECK_MSG(MyRestInt16::s_cInstances == Arr2.size() + 1, ("%zu vs %zu\n", MyRestInt16::s_cInstances, Arr2.size() + 1));
     1625        }
     1626        verifyArray(Arr2, __LINE__, 11, 0, 1, 2, 3, 4, 5, 6, 77, 8, 9, 10);
     1627
    15881628        RTTESTI_CHECK_MSG(MyRestInt16::s_cInstances == Arr2.size(), ("%zu vs %zu\n", MyRestInt16::s_cInstances, Arr2.size()));
    15891629    }
     
    16401680            RTTESTI_CHECK_RC(Arr3.removeAt(i), VINF_SUCCESS);
    16411681            cElements--;
    1642             RTTESTI_CHECK(Arr3.size() == cElements);
     1682            RTTESTI_CHECK((ssize_t)Arr3.size() == cElements);
    16431683        }
    16441684
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