class createPool : public CppUnit::TestFixture
{ public: // insert your test code here. // this is only demonstration code void createPool_001()
{ // this is demonstration code
rtlRandomPool aPool = rtl_random_createPool();
// LLA: seems to be that another test is not possible for createPool()
CPPUNIT_ASSERT_MESSAGE("create failed", aPool != nullptr);
rtl_random_destroyPool(aPool);
}
// Change the following lines only, if you add, remove or rename // member functions of the current class, // because these macros are need by auto register mechanism.
CPPUNIT_TEST_SUITE(createPool);
CPPUNIT_TEST(createPool_001);
CPPUNIT_TEST_SUITE_END();
}; // class createPool
class destroyPool : public CppUnit::TestFixture
{ public: // insert your test code here. void destroyPool_000()
{ // GPF, if failed
rtl_random_destroyPool(nullptr);
}
// LLA: seems to be that another test is not possible for createPool()
CPPUNIT_ASSERT_MESSAGE("create failed", aPool != nullptr);
rtl_random_destroyPool(aPool);
} // Change the following lines only, if you add, remove or rename // member functions of the current class, // because these macros are need by auto register mechanism.
CPPUNIT_TEST_SUITE(destroyPool);
CPPUNIT_TEST(destroyPool_000);
CPPUNIT_TEST(destroyPool_001);
CPPUNIT_TEST_SUITE_END();
}; // class destroyPool
class addBytes : public CppUnit::TestFixture
{ public: // insert your test code here. // this is only demonstration code void addBytes_000()
{
rtlRandomPool aPool = rtl_random_createPool();
// Change the following lines only, if you add, remove or rename // member functions of the current class, // because these macros are need by auto register mechanism.
CPPUNIT_TEST_SUITE(addBytes);
CPPUNIT_TEST(addBytes_000);
CPPUNIT_TEST(addBytes_001);
CPPUNIT_TEST_SUITE_END();
}; // class addBytes
namespace {
class Statistics
{ int m_nDispensation[256];
int m_nMin; int m_nMax; int m_nAverage; int m_nMinDeviation; int m_nMaxDeviation;
class getBytes : public CppUnit::TestFixture
{ public: // insert your test code here. void getBytes_000()
{
rtlRandomPool aPool = rtl_random_createPool();
int nCountMax = 10000; for(nCount = 0;nCount < nCountMax; ++nCount) // run 100000000 through getBytes(...)
{ /* rtlRandomError aError = */ rtl_random_getBytes(aPool, pBuffer.get(), nBufLen); // CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
for (sal_uInt32 i=0;i<nBufLen;++i)
aStat.addValue(pBuffer[i], 1);
}
aStat.build(nCountMax * nBufLen);
aStat.print();
CPPUNIT_ASSERT_MESSAGE("deviation should be less average", aStat.getMaxDeviation() < aStat.getAverage());
rtl_random_destroyPool(aPool);
}
// Change the following lines only, if you add, remove or rename // member functions of the current class, // because these macros are need by auto register mechanism.
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.