public:
PQueue& m_Queue;
size_t m_nPopError;
+ size_t m_nPopErrorEq;
size_t m_nPopSuccess;
size_t m_nPopFailed;
virtual void test()
{
m_nPopError = 0;
+ m_nPopErrorEq = 0;
m_nPopSuccess = 0;
m_nPopFailed = 0;
while ( !m_Queue.empty() ) {
if ( m_Queue.pop( val )) {
++m_nPopSuccess;
- if ( val.key >= nPrevKey )
+ if ( val.key > nPrevKey )
++m_nPopError;
+ else if ( val.key == nPrevKey )
+ ++m_nPopErrorEq;
nPrevKey = val.key;
}
else
// Analyze result
size_t nTotalPopped = 0;
size_t nTotalError = 0;
+ size_t nTotalErrorEq = 0;
size_t nTotalFailed = 0;
for ( CppUnitMini::ThreadPool::iterator it = pool.begin(); it != pool.end(); ++it ) {
Popper<PQueue> * pThread = static_cast<Popper<PQueue> *>(*it);
nTotalPopped += pThread->m_nPopSuccess;
nTotalError += pThread->m_nPopError;
+ nTotalErrorEq += pThread->m_nPopErrorEq;
nTotalFailed += pThread->m_nPopFailed;
}
- CPPUNIT_MSG( " Total: popped=" << nTotalPopped << ", error=" << nTotalError << ", empty pop=" << nTotalFailed );
+ CPPUNIT_MSG( " Total: popped=" << nTotalPopped << ", empty pop=" << nTotalFailed
+ << "\n Errors: pop equal=" << nTotalErrorEq << ", priority violation=" << nTotalError
+ );
CPPUNIT_CHECK( nTotalPopped == nThreadItemCount * s_nThreadCount );
CPPUNIT_CHECK( nTotalError == 0 );
+ CPPUNIT_CHECK( nTotalErrorEq == 0 );
}
CPPUNIT_MSG( testQueue.statistics() );