From 09b648317f58b6d2dbf905207d5804c53f3b30f2 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Wed, 4 Mar 2015 02:58:52 +0100 Subject: [PATCH] DataBlockFixture create data that is independent from its size --- test/testutils/DataBlockFixture.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/testutils/DataBlockFixture.cpp b/test/testutils/DataBlockFixture.cpp index 5fdb3a0a..252015b2 100644 --- a/test/testutils/DataBlockFixture.cpp +++ b/test/testutils/DataBlockFixture.cpp @@ -1,4 +1,4 @@ -#include +#include "DataBlockFixture.h" #include #include @@ -20,11 +20,13 @@ void DataBlockFixture::fillFileWithRandomData(long long int IV) { val += 1442695040888963407; reinterpret_cast(_fileData)[i] = val; } + uint64_t alreadyWritten = (_size/sizeof(long long int))*sizeof(long long int); + val *= 6364136223846793005L; + val += 1442695040888963407; + char *remainingBytes = reinterpret_cast(&val); //Fill remaining bytes - for(size_t i=(_size/sizeof(long long int))*sizeof(long long int); i<_size; ++i) { - val *= 6364136223846793005L; - val += 1442695040888963407; - reinterpret_cast(_fileData)[i] = val; + for(size_t i=0; i<_size-alreadyWritten; ++i) { + reinterpret_cast(_fileData)[alreadyWritten + i] = remainingBytes[i]; } }