summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--netfs/unittests/testEdgeCases.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/netfs/unittests/testEdgeCases.cpp b/netfs/unittests/testEdgeCases.cpp
index 17dd706..2553a7f 100644
--- a/netfs/unittests/testEdgeCases.cpp
+++ b/netfs/unittests/testEdgeCases.cpp
@@ -3,6 +3,7 @@
#include "mockFuse.h"
#include <boost/test/unit_test.hpp>
#include <definedDirs.h>
+#include <random>
const std::string testEndpoint("tcp -h localhost -p 12014");
@@ -34,9 +35,13 @@ BOOST_AUTO_TEST_CASE(createAndDaemonRestart)
BOOST_TEST_CHECKPOINT("Write some data");
std::array<char, 890> someData {};
- for (auto & d : someData) {
- d = rand();
- }
+ std::generate(begin(someData), end(someData),
+ [dist = std::uniform_int_distribution<char>(
+ std::numeric_limits<char>::min(), std::numeric_limits<char>::max()),
+ mersenne_engine = std::mt19937(std::random_device()())]() mutable {
+ return dist(mersenne_engine);
+ });
+
BOOST_REQUIRE_EQUAL(sizeof(someData), fuse.fuse->write(fileName, someData.data(), someData.size(), 0, &fh));
BOOST_REQUIRE_EQUAL(0, fuse.fuse->getattr(fileName, &st, &fh));