diff --git a/data/DataFixture.cpp b/data/DataFixture.cpp new file mode 100644 index 00000000..b9918846 --- /dev/null +++ b/data/DataFixture.cpp @@ -0,0 +1,23 @@ +#include "DataFixture.h" + +namespace cpputils { + Data DataFixture::generate(size_t size, long long int seed) { + Data result(size); + long long int val = seed; + for(size_t i=0; i(result.data())[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=0; i(result.data())[alreadyWritten + i] = remainingBytes[i]; + } + return result; + } +} diff --git a/data/DataFixture.h b/data/DataFixture.h new file mode 100644 index 00000000..bab9bbc6 --- /dev/null +++ b/data/DataFixture.h @@ -0,0 +1,16 @@ +#pragma once +#ifndef MESSMER_CPP_UTILS_DATA_DATAFIXTURE_H_ +#define MESSMER_CPP_UTILS_DATA_DATAFIXTURE_H_ + +#include "Data.h" + +namespace cpputils { + +class DataFixture { +public: + static Data generate(size_t size, long long int seed = 1); +}; + +} + +#endif