本文整理汇总了C++中UtlDList::get方法的典型用法代码示例。如果您正苦于以下问题:C++ UtlDList::get方法的具体用法?C++ UtlDList::get怎么用?C++ UtlDList::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UtlDList
的用法示例。
在下文中一共展示了UtlDList::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testGet
/*!a Test case for the get() method.
*
* The test data for this test is :-
* 1) The first entry is a CollectableString
* 2) The first entry is a CollectableInt
* 3) The List has only one entry
* 4) The List has no entries
*/
void testGet()
{
const int testCount = 4 ;
const char* prefix = "Verify the get() method for a list when " ;
const char* Msgs[] = { \
"the first entry is a CollectableString", \
"the first entry is a CollectableInt", \
"when the list has only one entry", \
"when the list is empty" \
} ;
const char* suffix1 = ":- verify return value" ;
const char* suffix2 = ":- verify the number of entries in the list" ;
UtlDList testList ;
testList.append(&commonString1) ;
testList.append(&commonInt1) ;
testList.append(&commonString2) ;
UtlContainable* expectedValue[] = { \
&commonString1 , &commonInt1, &commonString2, NULL \
} ;
int entryCount[] = { 2, 1, 0, 0 } ;
for (int i = 0 ; i < testCount ; i++)
{
UtlContainable* actual = testList.get() ;
string msg ;
TestUtilities::createMessage(3, &msg, prefix, Msgs[i], suffix1) ;
CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.data(), expectedValue[i], actual) ;
TestUtilities::createMessage(3, &msg, prefix, Msgs[i], suffix2) ;
CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.data(), entryCount[i], (int)testList.entries()) ;
}
} //testGet()