xref: /aoo41x/main/sal/qa/rtl/random/rtl_random.cxx (revision 87d2adbc)
1*87d2adbcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*87d2adbcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*87d2adbcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*87d2adbcSAndrew Rist  * distributed with this work for additional information
6*87d2adbcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*87d2adbcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*87d2adbcSAndrew Rist  * "License"); you may not use this file except in compliance
9*87d2adbcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*87d2adbcSAndrew Rist  *
11*87d2adbcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*87d2adbcSAndrew Rist  *
13*87d2adbcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*87d2adbcSAndrew Rist  * software distributed under the License is distributed on an
15*87d2adbcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*87d2adbcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*87d2adbcSAndrew Rist  * specific language governing permissions and limitations
18*87d2adbcSAndrew Rist  * under the License.
19*87d2adbcSAndrew Rist  *
20*87d2adbcSAndrew Rist  *************************************************************/
21*87d2adbcSAndrew Rist 
22*87d2adbcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
26cdf0e10cSrcweir #include "precompiled_sal.hxx"
27cdf0e10cSrcweir // autogenerated file with codegen.pl
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <algorithm> // STL
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <testshl/simpleheader.hxx>
32cdf0e10cSrcweir #include <rtl/random.h>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir namespace rtl_random
35cdf0e10cSrcweir {
36cdf0e10cSrcweir 
37cdf0e10cSrcweir class createPool : public CppUnit::TestFixture
38cdf0e10cSrcweir {
39cdf0e10cSrcweir public:
40cdf0e10cSrcweir     // initialise your test code values here.
setUp()41cdf0e10cSrcweir     void setUp()
42cdf0e10cSrcweir     {
43cdf0e10cSrcweir     }
44cdf0e10cSrcweir 
tearDown()45cdf0e10cSrcweir     void tearDown()
46cdf0e10cSrcweir     {
47cdf0e10cSrcweir     }
48cdf0e10cSrcweir 
49cdf0e10cSrcweir     // insert your test code here.
50cdf0e10cSrcweir     // this is only demonstration code
createPool_001()51cdf0e10cSrcweir     void createPool_001()
52cdf0e10cSrcweir     {
53cdf0e10cSrcweir         // this is demonstration code
54cdf0e10cSrcweir 
55cdf0e10cSrcweir         rtlRandomPool aPool = rtl_random_createPool();
56cdf0e10cSrcweir 
57cdf0e10cSrcweir         // LLA: seems to be that an other test is not possible for createPool()
58cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("create failed", aPool != NULL);
59cdf0e10cSrcweir 
60cdf0e10cSrcweir         rtl_random_destroyPool(aPool);
61cdf0e10cSrcweir     }
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     // Change the following lines only, if you add, remove or rename
64cdf0e10cSrcweir     // member functions of the current class,
65cdf0e10cSrcweir     // because these macros are need by auto register mechanism.
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     CPPUNIT_TEST_SUITE(createPool);
68cdf0e10cSrcweir     CPPUNIT_TEST(createPool_001);
69cdf0e10cSrcweir     CPPUNIT_TEST_SUITE_END();
70cdf0e10cSrcweir }; // class createPool
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 
73cdf0e10cSrcweir class destroyPool : public CppUnit::TestFixture
74cdf0e10cSrcweir {
75cdf0e10cSrcweir public:
76cdf0e10cSrcweir     // initialise your test code values here.
setUp()77cdf0e10cSrcweir     void setUp()
78cdf0e10cSrcweir     {
79cdf0e10cSrcweir     }
80cdf0e10cSrcweir 
tearDown()81cdf0e10cSrcweir     void tearDown()
82cdf0e10cSrcweir     {
83cdf0e10cSrcweir     }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     // insert your test code here.
destroyPool_000()86cdf0e10cSrcweir     void destroyPool_000()
87cdf0e10cSrcweir     {
88cdf0e10cSrcweir         // GPF, if failed
89cdf0e10cSrcweir         rtl_random_destroyPool(NULL);
90cdf0e10cSrcweir     }
91cdf0e10cSrcweir 
destroyPool_001()92cdf0e10cSrcweir     void destroyPool_001()
93cdf0e10cSrcweir     {
94cdf0e10cSrcweir         rtlRandomPool aPool = rtl_random_createPool();
95cdf0e10cSrcweir 
96cdf0e10cSrcweir         // LLA: seems to be that an other test is not possible for createPool()
97cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("create failed", aPool != NULL);
98cdf0e10cSrcweir 
99cdf0e10cSrcweir         rtl_random_destroyPool(aPool);
100cdf0e10cSrcweir     }
101cdf0e10cSrcweir     // Change the following lines only, if you add, remove or rename
102cdf0e10cSrcweir     // member functions of the current class,
103cdf0e10cSrcweir     // because these macros are need by auto register mechanism.
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     CPPUNIT_TEST_SUITE(destroyPool);
106cdf0e10cSrcweir     CPPUNIT_TEST(destroyPool_000);
107cdf0e10cSrcweir     CPPUNIT_TEST(destroyPool_001);
108cdf0e10cSrcweir     CPPUNIT_TEST_SUITE_END();
109cdf0e10cSrcweir }; // class destroyPool
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 
112cdf0e10cSrcweir class addBytes : public CppUnit::TestFixture
113cdf0e10cSrcweir {
114cdf0e10cSrcweir public:
115cdf0e10cSrcweir     // initialise your test code values here.
setUp()116cdf0e10cSrcweir     void setUp()
117cdf0e10cSrcweir     {
118cdf0e10cSrcweir     }
119cdf0e10cSrcweir 
tearDown()120cdf0e10cSrcweir     void tearDown()
121cdf0e10cSrcweir     {
122cdf0e10cSrcweir     }
123cdf0e10cSrcweir 
124cdf0e10cSrcweir     // insert your test code here.
125cdf0e10cSrcweir     // this is only demonstration code
addBytes_000()126cdf0e10cSrcweir     void addBytes_000()
127cdf0e10cSrcweir     {
128cdf0e10cSrcweir         rtlRandomPool aPool = rtl_random_createPool();
129cdf0e10cSrcweir 
130cdf0e10cSrcweir         sal_uInt32  nBufLen = 4;
131cdf0e10cSrcweir         sal_uInt8   *pBuffer = new sal_uInt8[ nBufLen ];
132cdf0e10cSrcweir         memset(pBuffer, 0, nBufLen);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir         rtlRandomError aError = rtl_random_addBytes(NULL, NULL, 0);
135cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
136cdf0e10cSrcweir 
137cdf0e10cSrcweir         /* rtlRandomError */ aError = rtl_random_addBytes(aPool, NULL, 0);
138cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir         /* rtlRandomError */ aError = rtl_random_addBytes(aPool, pBuffer, nBufLen);
141cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
142cdf0e10cSrcweir 
143cdf0e10cSrcweir         rtl_random_destroyPool(aPool);
144cdf0e10cSrcweir         delete [] pBuffer;
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     }
147cdf0e10cSrcweir 
addBytes_001()148cdf0e10cSrcweir     void addBytes_001()
149cdf0e10cSrcweir         {
150cdf0e10cSrcweir             rtlRandomPool aPool = rtl_random_createPool();
151cdf0e10cSrcweir 
152cdf0e10cSrcweir             sal_uInt32  nBufLen = 4;
153cdf0e10cSrcweir             sal_uInt8   *pBuffer = new sal_uInt8[ nBufLen ];
154cdf0e10cSrcweir 
155cdf0e10cSrcweir             memset(pBuffer, 0, nBufLen);
156cdf0e10cSrcweir 
157cdf0e10cSrcweir             rtl_random_addBytes(aPool, pBuffer, nBufLen);
158cdf0e10cSrcweir 
159cdf0e10cSrcweir             t_print("%2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3]);
160cdf0e10cSrcweir 
161cdf0e10cSrcweir             rtl_random_destroyPool(aPool);
162cdf0e10cSrcweir             delete [] pBuffer;
163cdf0e10cSrcweir         }
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 
166cdf0e10cSrcweir     // Change the following lines only, if you add, remove or rename
167cdf0e10cSrcweir     // member functions of the current class,
168cdf0e10cSrcweir     // because these macros are need by auto register mechanism.
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     CPPUNIT_TEST_SUITE(addBytes);
171cdf0e10cSrcweir     CPPUNIT_TEST(addBytes_000);
172cdf0e10cSrcweir     CPPUNIT_TEST(addBytes_001);
173cdf0e10cSrcweir     CPPUNIT_TEST_SUITE_END();
174cdf0e10cSrcweir }; // class addBytes
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 
177cdf0e10cSrcweir class Statistics
178cdf0e10cSrcweir {
179cdf0e10cSrcweir     int m_nDispensation[256];
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     int m_nMin;
182cdf0e10cSrcweir     int m_nMax;
183cdf0e10cSrcweir     int m_nAverage;
184cdf0e10cSrcweir     int m_nMinDeviation;
185cdf0e10cSrcweir     int m_nMaxDeviation;
186cdf0e10cSrcweir 
187cdf0e10cSrcweir public:
clearDispensation()188cdf0e10cSrcweir     void clearDispensation()
189cdf0e10cSrcweir         {
190cdf0e10cSrcweir             for (int i = 0;i < 256;i ++)                        // clear array
191cdf0e10cSrcweir             {
192cdf0e10cSrcweir                 m_nDispensation[i] = 0;
193cdf0e10cSrcweir             }
194cdf0e10cSrcweir         }
Statistics()195cdf0e10cSrcweir     Statistics()
196cdf0e10cSrcweir         {
197cdf0e10cSrcweir             clearDispensation();
198cdf0e10cSrcweir         }
~Statistics()199cdf0e10cSrcweir     ~Statistics(){}
200cdf0e10cSrcweir 
addValue(sal_Int16 _nIndex,sal_Int32 _nValue)201cdf0e10cSrcweir     void addValue(sal_Int16 _nIndex, sal_Int32 _nValue)
202cdf0e10cSrcweir         {
203cdf0e10cSrcweir             OSL_ASSERT(_nIndex >= 0 && _nIndex < 256);
204cdf0e10cSrcweir             m_nDispensation[_nIndex] += _nValue;
205cdf0e10cSrcweir         }
206cdf0e10cSrcweir 
build(sal_Int32 _nCountMax)207cdf0e10cSrcweir     void build(sal_Int32 _nCountMax)
208cdf0e10cSrcweir         {
209cdf0e10cSrcweir             m_nMin = _nCountMax;
210cdf0e10cSrcweir             m_nMax = 0;
211cdf0e10cSrcweir 
212cdf0e10cSrcweir             m_nAverage = _nCountMax / 256;
213cdf0e10cSrcweir 
214cdf0e10cSrcweir             m_nMinDeviation = _nCountMax;
215cdf0e10cSrcweir             m_nMaxDeviation = 0;
216cdf0e10cSrcweir 
217cdf0e10cSrcweir             for (int i = 0;i < 256;i ++)                        // show dispensation
218cdf0e10cSrcweir             {
219cdf0e10cSrcweir                 m_nMin = std::min(m_nMin, m_nDispensation[i]);
220cdf0e10cSrcweir                 m_nMax = std::max(m_nMax, m_nDispensation[i]);
221cdf0e10cSrcweir 
222cdf0e10cSrcweir                 m_nMinDeviation = std::min(m_nMinDeviation, abs(m_nAverage - m_nDispensation[i]));
223cdf0e10cSrcweir                 m_nMaxDeviation = std::max(m_nMaxDeviation, abs(m_nAverage - m_nDispensation[i]));
224cdf0e10cSrcweir             }
225cdf0e10cSrcweir         }
226cdf0e10cSrcweir 
print()227cdf0e10cSrcweir     void print()
228cdf0e10cSrcweir         {
229cdf0e10cSrcweir             // LLA: these are only info values
230cdf0e10cSrcweir             t_print("\nSome statistics\n");
231cdf0e10cSrcweir             t_print("Min: %d\n", m_nMin);
232cdf0e10cSrcweir             t_print("Max: %d\n", m_nMax);
233cdf0e10cSrcweir             t_print("Average: %d\n", m_nAverage);
234cdf0e10cSrcweir             t_print("Min abs deviation: %d\n", m_nMinDeviation);
235cdf0e10cSrcweir             t_print("Max abs deviation: %d\n", m_nMaxDeviation);
236cdf0e10cSrcweir         }
237cdf0e10cSrcweir 
getAverage()238cdf0e10cSrcweir     sal_Int32 getAverage() {return m_nAverage;}
getMaxDeviation()239cdf0e10cSrcweir     sal_Int32 getMaxDeviation() {return m_nMaxDeviation;}
240cdf0e10cSrcweir 
241cdf0e10cSrcweir };
242cdf0e10cSrcweir 
243cdf0e10cSrcweir class getBytes : public CppUnit::TestFixture
244cdf0e10cSrcweir {
245cdf0e10cSrcweir public:
246cdf0e10cSrcweir     // initialise your test code values here.
setUp()247cdf0e10cSrcweir     void setUp()
248cdf0e10cSrcweir     {
249cdf0e10cSrcweir     }
250cdf0e10cSrcweir 
tearDown()251cdf0e10cSrcweir     void tearDown()
252cdf0e10cSrcweir     {
253cdf0e10cSrcweir     }
254cdf0e10cSrcweir 
255cdf0e10cSrcweir     // insert your test code here.
getBytes_000()256cdf0e10cSrcweir     void getBytes_000()
257cdf0e10cSrcweir     {
258cdf0e10cSrcweir         rtlRandomPool aPool = rtl_random_createPool();
259cdf0e10cSrcweir 
260cdf0e10cSrcweir         sal_uInt32  nBufLen = 4;
261cdf0e10cSrcweir         sal_uInt8   *pBuffer = new sal_uInt8[ nBufLen ];
262cdf0e10cSrcweir         memset(pBuffer, 0, nBufLen);
263cdf0e10cSrcweir 
264cdf0e10cSrcweir         rtlRandomError aError = rtl_random_getBytes(NULL, NULL, 0);
265cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
266cdf0e10cSrcweir 
267cdf0e10cSrcweir         /* rtlRandomError */ aError = rtl_random_getBytes(aPool, NULL, 0);
268cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_Argument);
269cdf0e10cSrcweir 
270cdf0e10cSrcweir         /* rtlRandomError */ aError = rtl_random_getBytes(aPool, pBuffer, nBufLen);
271cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
272cdf0e10cSrcweir 
273cdf0e10cSrcweir         rtl_random_destroyPool(aPool);
274cdf0e10cSrcweir         delete [] pBuffer;
275cdf0e10cSrcweir     }
276cdf0e10cSrcweir 
getBytes_001()277cdf0e10cSrcweir     void getBytes_001()
278cdf0e10cSrcweir     {
279cdf0e10cSrcweir         rtlRandomPool aPool = rtl_random_createPool();
280cdf0e10cSrcweir 
281cdf0e10cSrcweir         sal_uInt32  nBufLen = 4;
282cdf0e10cSrcweir         sal_uInt8   *pBuffer = new sal_uInt8[ nBufLen ];
283cdf0e10cSrcweir         memset(pBuffer, 0, nBufLen);
284cdf0e10cSrcweir 
285cdf0e10cSrcweir         rtlRandomError aError = rtl_random_getBytes(aPool, pBuffer, nBufLen);
286cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
287cdf0e10cSrcweir 
288cdf0e10cSrcweir         t_print("%2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3]);
289cdf0e10cSrcweir 
290cdf0e10cSrcweir         rtl_random_destroyPool(aPool);
291cdf0e10cSrcweir         delete [] pBuffer;
292cdf0e10cSrcweir     }
293cdf0e10cSrcweir 
getBytes_002()294cdf0e10cSrcweir     void getBytes_002()
295cdf0e10cSrcweir     {
296cdf0e10cSrcweir         rtlRandomPool aPool = rtl_random_createPool();
297cdf0e10cSrcweir 
298cdf0e10cSrcweir         sal_uInt32  nBufLen = 4;
299cdf0e10cSrcweir         sal_uInt8   *pBuffer = new sal_uInt8[ nBufLen << 1 ];
300cdf0e10cSrcweir         memset(pBuffer, 0, nBufLen << 1);
301cdf0e10cSrcweir 
302cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[4] == 0 && pBuffer[5] == 0 && pBuffer[6] == 0 && pBuffer[7] == 0);
303cdf0e10cSrcweir 
304cdf0e10cSrcweir         rtlRandomError aError = rtl_random_getBytes(aPool, pBuffer, nBufLen);
305cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
306cdf0e10cSrcweir 
307cdf0e10cSrcweir         t_print("%2x %2x %2x %2x %2x %2x %2x %2x\n", pBuffer[0], pBuffer[1], pBuffer[2], pBuffer[3], pBuffer[4], pBuffer[5], pBuffer[6], pBuffer[7]);
308cdf0e10cSrcweir 
309cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("internal memory overwrite", pBuffer[4] == 0 && pBuffer[5] == 0 && pBuffer[6] == 0 && pBuffer[7] == 0);
310cdf0e10cSrcweir 
311cdf0e10cSrcweir         rtl_random_destroyPool(aPool);
312cdf0e10cSrcweir         delete [] pBuffer;
313cdf0e10cSrcweir     }
314cdf0e10cSrcweir 
getBytes_003()315cdf0e10cSrcweir     void getBytes_003()
316cdf0e10cSrcweir     {
317cdf0e10cSrcweir         rtlRandomPool aPool = rtl_random_createPool();
318cdf0e10cSrcweir 
319cdf0e10cSrcweir         sal_uInt32  nBufLen = 1;
320cdf0e10cSrcweir         sal_uInt8   *pBuffer = new sal_uInt8[ nBufLen ];
321cdf0e10cSrcweir         memset(pBuffer, 0, nBufLen);
322cdf0e10cSrcweir 
323cdf0e10cSrcweir         Statistics aStat;
324cdf0e10cSrcweir 
325cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[0] == 0);
326cdf0e10cSrcweir 
327cdf0e10cSrcweir         int nCount = 0;
328cdf0e10cSrcweir 
329cdf0e10cSrcweir         int nCountMax = 1000000;
330cdf0e10cSrcweir         for(nCount = 0;nCount < nCountMax; nCount ++)                  // run 100000000 through getBytes(...)
331cdf0e10cSrcweir         {
332cdf0e10cSrcweir             /* rtlRandomError aError = */ rtl_random_getBytes(aPool, pBuffer, nBufLen);
333cdf0e10cSrcweir             /* CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None); */
334cdf0e10cSrcweir 
335cdf0e10cSrcweir             aStat.addValue(pBuffer[0], 1);
336cdf0e10cSrcweir         }
337cdf0e10cSrcweir 
338cdf0e10cSrcweir         aStat.build(nCountMax);
339cdf0e10cSrcweir         aStat.print();
340cdf0e10cSrcweir 
341cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("deviation should be less average", aStat.getMaxDeviation() < aStat.getAverage());
342cdf0e10cSrcweir 
343cdf0e10cSrcweir         rtl_random_destroyPool(aPool);
344cdf0e10cSrcweir         delete [] pBuffer;
345cdf0e10cSrcweir     }
346cdf0e10cSrcweir 
getBytes_003_1()347cdf0e10cSrcweir     void getBytes_003_1()
348cdf0e10cSrcweir     {
349cdf0e10cSrcweir         rtlRandomPool aPool = rtl_random_createPool();
350cdf0e10cSrcweir 
351cdf0e10cSrcweir         sal_uInt32  nBufLen = 256;
352cdf0e10cSrcweir         sal_uInt8   *pBuffer = new sal_uInt8[ nBufLen ];
353cdf0e10cSrcweir         memset(pBuffer, 0, nBufLen);
354cdf0e10cSrcweir 
355cdf0e10cSrcweir         Statistics aStat;
356cdf0e10cSrcweir 
357cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("memset failed", pBuffer[0] == 0);
358cdf0e10cSrcweir 
359cdf0e10cSrcweir         int nCount = 0;
360cdf0e10cSrcweir 
361cdf0e10cSrcweir         int nCountMax = 10000;
362cdf0e10cSrcweir         for(nCount = 0;nCount < nCountMax; nCount ++)                  // run 100000000 through getBytes(...)
363cdf0e10cSrcweir         {
364cdf0e10cSrcweir             /* rtlRandomError aError = */ rtl_random_getBytes(aPool, pBuffer, nBufLen);
365cdf0e10cSrcweir             // CPPUNIT_ASSERT_MESSAGE("wrong parameter", aError == rtl_Random_E_None);
366cdf0e10cSrcweir 
367cdf0e10cSrcweir             for (sal_uInt32 i=0;i<nBufLen;i++)
368cdf0e10cSrcweir             {
369cdf0e10cSrcweir                 aStat.addValue(pBuffer[i], 1);
370cdf0e10cSrcweir             }
371cdf0e10cSrcweir         }
372cdf0e10cSrcweir 
373cdf0e10cSrcweir         aStat.build(nCountMax * nBufLen);
374cdf0e10cSrcweir         aStat.print();
375cdf0e10cSrcweir 
376cdf0e10cSrcweir         CPPUNIT_ASSERT_MESSAGE("deviation should be less average", aStat.getMaxDeviation() < aStat.getAverage());
377cdf0e10cSrcweir 
378cdf0e10cSrcweir         rtl_random_destroyPool(aPool);
379cdf0e10cSrcweir         delete [] pBuffer;
380cdf0e10cSrcweir     }
381cdf0e10cSrcweir 
382cdf0e10cSrcweir     // Change the following lines only, if you add, remove or rename
383cdf0e10cSrcweir     // member functions of the current class,
384cdf0e10cSrcweir     // because these macros are need by auto register mechanism.
385cdf0e10cSrcweir 
386cdf0e10cSrcweir     CPPUNIT_TEST_SUITE(getBytes);
387cdf0e10cSrcweir     CPPUNIT_TEST(getBytes_000);
388cdf0e10cSrcweir     CPPUNIT_TEST(getBytes_001);
389cdf0e10cSrcweir     CPPUNIT_TEST(getBytes_002);
390cdf0e10cSrcweir     CPPUNIT_TEST(getBytes_003);
391cdf0e10cSrcweir     CPPUNIT_TEST(getBytes_003_1);
392cdf0e10cSrcweir     CPPUNIT_TEST_SUITE_END();
393cdf0e10cSrcweir }; // class getBytes
394cdf0e10cSrcweir 
395cdf0e10cSrcweir // -----------------------------------------------------------------------------
396cdf0e10cSrcweir CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_random::createPool, "rtl_random");
397cdf0e10cSrcweir CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_random::destroyPool, "rtl_random");
398cdf0e10cSrcweir CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_random::addBytes, "rtl_random");
399cdf0e10cSrcweir CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_random::getBytes, "rtl_random");
400cdf0e10cSrcweir } // namespace rtl_random
401cdf0e10cSrcweir 
402cdf0e10cSrcweir 
403cdf0e10cSrcweir // -----------------------------------------------------------------------------
404cdf0e10cSrcweir 
405cdf0e10cSrcweir // this macro creates an empty function, which will called by the RegisterAllFunctions()
406cdf0e10cSrcweir // to let the user the possibility to also register some functions by hand.
407cdf0e10cSrcweir NOADDITIONAL;
408cdf0e10cSrcweir 
409