本文整理汇总了C++中DPQ::check方法的典型用法代码示例。如果您正苦于以下问题:C++ DPQ::check方法的具体用法?C++ DPQ::check怎么用?C++ DPQ::check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DPQ
的用法示例。
在下文中一共展示了DPQ::check方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Index
BOOST_AUTO_TEST_CASE_TEMPLATE( testClear_manyItems, DPQ, both )
{
DPQ dpq;
typedef typename DPQ::Index Index;
for( int i( 0 ); i < 70000; ++i )
{
dpq.push( i );
}
BOOST_CHECK( dpq.check() );
dpq.clear();
BOOST_CHECK( dpq.isEmpty() );
BOOST_CHECK( dpq.check() );
dpq.push( 2 );
dpq.push( 20 );
dpq.push( 30 );
BOOST_CHECK_EQUAL( Index( 3 ), dpq.getSize() );
dpq.clear();
BOOST_CHECK( dpq.isEmpty() );
BOOST_CHECK( dpq.check() );
}
示例2: MAXI
BOOST_AUTO_TEST_CASE_TEMPLATE( testInterleavedSorting, DPQ, both )
{
DPQ dpq;
typedef typename DPQ::Index Index;
const Index MAXI( 101 );
for( int i( MAXI-1 ); i != 0 ; i-=2 )
{
dpq.push( i );
}
for( int i( MAXI ); i != -1 ; i-=2 )
{
dpq.push( i );
}
BOOST_CHECK_EQUAL( MAXI, dpq.getSize() );
BOOST_CHECK( dpq.check() );
int n( 0 );
while( ! dpq.isEmpty() )
{
++n;
BOOST_CHECK_EQUAL( n, dpq.getTop() );
dpq.popTop();
}
BOOST_CHECK_EQUAL( MAXI, Index( n ) );
BOOST_CHECK( dpq.isEmpty() );
BOOST_CHECK( dpq.check() );
}
示例3:
BOOST_AUTO_TEST_CASE_TEMPLATE( testPushAfterPop, DPQ, both )
{
DPQ dpq;
dpq.push( 1 );
const ID id1( dpq.push( 2 ) );
dpq.push( 3 );
dpq.push( 4 );
BOOST_CHECK( dpq.getSize() == 4 );
BOOST_CHECK( dpq.check() );
BOOST_CHECK( dpq.getTop() == 1 );
dpq.pop( id1 );
BOOST_CHECK( dpq.getSize() == 3 );
BOOST_CHECK( dpq.check() );
dpq.push( 1 );
BOOST_CHECK( dpq.getSize() == 4 );
BOOST_CHECK( dpq.check() );
BOOST_CHECK( dpq.getTop() == 1 );
dpq.popTop();
BOOST_CHECK( dpq.getTop() == 1 );
dpq.popTop();
BOOST_CHECK( dpq.getTop() == 3 );
dpq.popTop();
BOOST_CHECK( dpq.getTop() == 4 );
dpq.popTop();
BOOST_CHECK( dpq.isEmpty() );
BOOST_CHECK( dpq.check() );
}
示例4: id
BOOST_AUTO_TEST_CASE_TEMPLATE( testReplace6, DPQ, both )
{
DPQ dpq;
dpq.push( 5 );
dpq.push( 4 );
dpq.push( 3 );
const ID id( dpq.push( 1 ) );
BOOST_CHECK( dpq.check() );
BOOST_CHECK_EQUAL( 4, dpq.getSize() );
BOOST_CHECK_EQUAL( 1, dpq.getTop() );
dpq.replace( id, 3 ); // 1->3 top down
BOOST_CHECK( dpq.check() );
BOOST_CHECK_EQUAL( 4, dpq.getSize() );
BOOST_CHECK_EQUAL( 3, dpq.getTop() );
dpq.popTop();
BOOST_CHECK_EQUAL( 3, dpq.getTop() );
dpq.popTop();
BOOST_CHECK_EQUAL( 4, dpq.getTop() );
dpq.popTop();
BOOST_CHECK_EQUAL( 5, dpq.getTop() );
dpq.popTop();
BOOST_CHECK( dpq.isEmpty() );
BOOST_CHECK( dpq.check() );
}