diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-04-08 20:01:21 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2022-04-08 20:01:21 +0100 |
commit | 3cc9fd842f0fea43a03e34bf88e2b6de29b86ad4 (patch) | |
tree | 8d4d554f9ed80bc99a5537c819b7b66c70c747fe | |
parent | Mark constructor explicit (diff) | |
download | netfs-3cc9fd842f0fea43a03e34bf88e2b6de29b86ad4.tar.bz2 netfs-3cc9fd842f0fea43a03e34bf88e2b6de29b86ad4.tar.xz netfs-3cc9fd842f0fea43a03e34bf88e2b6de29b86ad4.zip |
Modern random
-rw-r--r-- | netfs/unittests/testEdgeCases.cpp | 11 |
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)); |