From 3cc9fd842f0fea43a03e34bf88e2b6de29b86ad4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 8 Apr 2022 20:01:21 +0100 Subject: Modern random --- netfs/unittests/testEdgeCases.cpp | 11 ++++++++--- 1 file 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 #include +#include 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 someData {}; - for (auto & d : someData) { - d = rand(); - } + std::generate(begin(someData), end(someData), + [dist = std::uniform_int_distribution( + std::numeric_limits::min(), std::numeric_limits::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)); -- cgit v1.2.3