diff options
Diffstat (limited to 'src/tests/TestCryptographicRandom/TestCryptographicRandom.cpp')
-rw-r--r-- | src/tests/TestCryptographicRandom/TestCryptographicRandom.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/tests/TestCryptographicRandom/TestCryptographicRandom.cpp b/src/tests/TestCryptographicRandom/TestCryptographicRandom.cpp index ee1a2edd7..1c6dcd1d7 100644 --- a/src/tests/TestCryptographicRandom/TestCryptographicRandom.cpp +++ b/src/tests/TestCryptographicRandom/TestCryptographicRandom.cpp @@ -10,18 +10,18 @@ #include "crypto/CryptographicRandom.h" +#include <limits> #include <stdint.h> #include <stdlib.h> -#include <limits> class TestCryptographicRandom : public QObject { - Q_OBJECT - private slots: - void initTestCase(); - void cleanupTestCase(); - void fillBuffer(); - void uint32(); - void uniform(); + Q_OBJECT +private slots: + void initTestCase(); + void cleanupTestCase(); + void fillBuffer(); + void uint32(); + void uniform(); }; void TestCryptographicRandom::initTestCase() { @@ -48,7 +48,7 @@ void TestCryptographicRandom::fillBuffer() { const int buflen = 1000000; for (int i = 0; i < 10; i++) { - unsigned char *buf = reinterpret_cast<unsigned char *>(calloc(buflen, 1)); + unsigned char *buf = reinterpret_cast< unsigned char * >(calloc(buflen, 1)); CryptographicRandom::fillBuffer(buf, buflen); QVERIFY(verifyEntropy(buf, buflen)); free(buf); @@ -59,15 +59,15 @@ void TestCryptographicRandom::uint32() { const int buflen = 1000000; for (int i = 0; i < 10; i++) { - unsigned char *buf = reinterpret_cast<unsigned char *>(calloc(buflen, 1)); - int niter = buflen / sizeof(uint32_t); + unsigned char *buf = reinterpret_cast< unsigned char * >(calloc(buflen, 1)); + int niter = buflen / sizeof(uint32_t); for (int j = 0; j < niter; j++) { - int off = j * sizeof(uint32_t); + int off = j * sizeof(uint32_t); uint32_t val = CryptographicRandom::uint32(); - buf[off] = val & 0xff; - buf[off+1] = (val >> 8) & 0xff; - buf[off+2] = (val >> 16) & 0xff; - buf[off+3] = (val >> 24) & 0xff; + buf[off] = val & 0xff; + buf[off + 1] = (val >> 8) & 0xff; + buf[off + 2] = (val >> 16) & 0xff; + buf[off + 3] = (val >> 24) & 0xff; } QVERIFY(verifyEntropy(buf, buflen)); free(buf); |