BOOST_AUTO_TEST_CASE_TEMPLATE( testReplaceTop, DPQ, both ) { DPQ dpq; dpq.push( 4 ); dpq.push( 2 ); dpq.push( 1 ); BOOST_CHECK_EQUAL( 1, dpq.getTop() ); dpq.replaceTop( 3 ); BOOST_CHECK( dpq.check() ); BOOST_CHECK_EQUAL( 2, dpq.getTop() ); dpq.popTop(); BOOST_CHECK_EQUAL( 3, dpq.getTop() ); dpq.popTop(); BOOST_CHECK_EQUAL( 4, dpq.getTop() ); dpq.popTop(); BOOST_CHECK( dpq.isEmpty() ); BOOST_CHECK( dpq.check() ); }
void testReplaceTop() { DPQ dpq; dpq.push( 4 ); dpq.push( 2 ); dpq.push( 1 ); BOOST_CHECK_EQUAL( 1, dpq.getTop() ); dpq.replaceTop( 3 ); BOOST_CHECK( dpq.checkConsistency() ); BOOST_CHECK_EQUAL( 2, dpq.getTop() ); dpq.popTop(); BOOST_CHECK_EQUAL( 3, dpq.getTop() ); dpq.popTop(); BOOST_CHECK_EQUAL( 4, dpq.getTop() ); dpq.popTop(); BOOST_CHECK( dpq.isEmpty() ); BOOST_CHECK( dpq.checkConsistency() ); }