diff options
author | Jonathan White <support@dmapps.us> | 2018-01-01 21:20:31 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2018-01-13 22:23:29 +0300 |
commit | 9140893cd3e7658cd5ecda2fed4207fda6893f81 (patch) | |
tree | 01484b0740c303a53b6d3eb40d2975e72ac95a27 | |
parent | 2866bc626a02f7d0f2943dad3725200f318850cf (diff) |
Correct Endian function use in Random tests
-rw-r--r-- | tests/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tests/TestRandom.cpp | 16 |
2 files changed, 8 insertions, 11 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bdf0e6f86..91c6b2e2e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -181,9 +181,6 @@ add_unit_test(NAME testrandom SOURCES TestRandom.cpp add_unit_test(NAME testentrysearcher SOURCES TestEntrySearcher.cpp LIBS ${TEST_LIBRARIES}) -add_unit_test(NAME testexporter SOURCES TestExporter.cpp - LIBS ${TEST_LIBRARIES}) - add_unit_test(NAME testcsvexporter SOURCES TestCsvExporter.cpp LIBS ${TEST_LIBRARIES}) diff --git a/tests/TestRandom.cpp b/tests/TestRandom.cpp index 6c5b1f724..69f0fcb7c 100644 --- a/tests/TestRandom.cpp +++ b/tests/TestRandom.cpp @@ -35,29 +35,29 @@ void TestRandom::testUInt() { QByteArray nextBytes; - nextBytes = Endian::int32ToBytes(42, QSysInfo::ByteOrder); + nextBytes = Endian::sizedIntToBytes(42, QSysInfo::ByteOrder); m_backend->setNextBytes(nextBytes); QCOMPARE(randomGen()->randomUInt(100), 42U); - nextBytes = Endian::int32ToBytes(117, QSysInfo::ByteOrder); + nextBytes = Endian::sizedIntToBytes(117, QSysInfo::ByteOrder); m_backend->setNextBytes(nextBytes); QCOMPARE(randomGen()->randomUInt(100), 17U); - nextBytes = Endian::int32ToBytes(1001, QSysInfo::ByteOrder); + nextBytes = Endian::sizedIntToBytes(1001, QSysInfo::ByteOrder); m_backend->setNextBytes(nextBytes); QCOMPARE(randomGen()->randomUInt(1), 0U); nextBytes.clear(); - nextBytes.append(Endian::int32ToBytes(QUINT32_MAX, QSysInfo::ByteOrder)); - nextBytes.append(Endian::int32ToBytes(QUINT32_MAX - 70000U, QSysInfo::ByteOrder)); + nextBytes.append(Endian::sizedIntToBytes(QUINT32_MAX, QSysInfo::ByteOrder)); + nextBytes.append(Endian::sizedIntToBytes(QUINT32_MAX - 70000U, QSysInfo::ByteOrder)); m_backend->setNextBytes(nextBytes); QCOMPARE(randomGen()->randomUInt(100000U), (QUINT32_MAX - 70000U) % 100000U); nextBytes.clear(); for (int i = 0; i < 10000; i++) { - nextBytes.append(Endian::int32ToBytes((QUINT32_MAX / 2U) + 1U + i, QSysInfo::ByteOrder)); + nextBytes.append(Endian::sizedIntToBytes((QUINT32_MAX / 2U) + 1U + i, QSysInfo::ByteOrder)); } - nextBytes.append(Endian::int32ToBytes(QUINT32_MAX / 2U, QSysInfo::ByteOrder)); + nextBytes.append(Endian::sizedIntToBytes(QUINT32_MAX / 2U, QSysInfo::ByteOrder)); m_backend->setNextBytes(nextBytes); QCOMPARE(randomGen()->randomUInt((QUINT32_MAX / 2U) + 1U), QUINT32_MAX / 2U); } @@ -66,7 +66,7 @@ void TestRandom::testUIntRange() { QByteArray nextBytes; - nextBytes = Endian::int32ToBytes(42, QSysInfo::ByteOrder); + nextBytes = Endian::sizedIntToBytes(42, QSysInfo::ByteOrder); m_backend->setNextBytes(nextBytes); QCOMPARE(randomGen()->randomUIntRange(100, 200), 142U); } |