summaryrefslogtreecommitdiff
path: root/tests/test_common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_common.cpp')
-rw-r--r--tests/test_common.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_common.cpp b/tests/test_common.cpp
index ec2b2425..d01b92ad 100644
--- a/tests/test_common.cpp
+++ b/tests/test_common.cpp
@@ -22,6 +22,8 @@
*/
#include <test_common.h>
#include <iostream>
+#include <cstdlib>
+#include <time.h>
using namespace CKM;
@@ -45,6 +47,17 @@ RawBuffer createBigBlob(std::size_t size)
return createPass(0, size);
}
+RawBuffer createRandom(std::size_t size)
+{
+ static unsigned int seed = ::time(nullptr);
+
+ RawBuffer buf(size, 0x00);
+ for (size_t i = 0; i < size; ++i)
+ buf[i] = static_cast<RawBuffer::value_type>(::rand_r(&seed) % 256);
+
+ return buf;
+}
+
//raw to hex string conversion from SqlConnection
std::string rawToHexString(const RawBuffer &raw)
{