updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
@ -114,7 +114,7 @@ inline auto generate_random_between(data_t begin, data_t end) -> data_t {
|
|||||||
throw std::range_error("end must be greater than begin");
|
throw std::range_error("end must be greater than begin");
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::mt19937 gen(std::random_device{}());
|
std::mt19937 gen(std::random_device{}());
|
||||||
std::uniform_int_distribution<data_t> dis(begin, end);
|
std::uniform_int_distribution<data_t> dis(begin, end);
|
||||||
return dis(gen);
|
return dis(gen);
|
||||||
}
|
}
|
||||||
|
@ -37,10 +37,8 @@ using namespace ::testing;
|
|||||||
#include "utils/all.hpp"
|
#include "utils/all.hpp"
|
||||||
|
|
||||||
namespace repertory::test {
|
namespace repertory::test {
|
||||||
#if defined(PROJECT_ENABLE_LIBSODIUM)
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
create_random_file(std::size_t size) -> utils::file::i_file &;
|
create_random_file(std::size_t size) -> utils::file::i_file &;
|
||||||
#endif // defined(PROJECT_ENABLE_LIBSODIUM)
|
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
generate_test_file_name(std::string_view file_name_no_extension) -> std::string;
|
generate_test_file_name(std::string_view file_name_no_extension) -> std::string;
|
||||||
|
@ -53,7 +53,6 @@ static auto deleter{std::make_unique<file_deleter>()};
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace repertory::test {
|
namespace repertory::test {
|
||||||
#if defined(PROJECT_ENABLE_LIBSODIUM)
|
|
||||||
auto create_random_file(std::size_t size) -> utils::file::i_file & {
|
auto create_random_file(std::size_t size) -> utils::file::i_file & {
|
||||||
recur_mutex_lock lock{file_mtx};
|
recur_mutex_lock lock{file_mtx};
|
||||||
|
|
||||||
@ -62,7 +61,13 @@ auto create_random_file(std::size_t size) -> utils::file::i_file & {
|
|||||||
EXPECT_TRUE(*file);
|
EXPECT_TRUE(*file);
|
||||||
if (*file) {
|
if (*file) {
|
||||||
data_buffer buf(size);
|
data_buffer buf(size);
|
||||||
|
#if defined(PROJECT_ENABLE_LIBSODIUM)
|
||||||
randombytes_buf(buf.data(), buf.size());
|
randombytes_buf(buf.data(), buf.size());
|
||||||
|
#else // !defined(PROJECT_ENABLE_LIBSODIUM)
|
||||||
|
std::mt19937 gen(std::random_device{}());
|
||||||
|
std::uniform_int_distribution<std::uint8_t> dis(0U, 255U);
|
||||||
|
std::generate(buf.begin(), buf.end(), [&]() -> auto { return dis(gen); });
|
||||||
|
#endif // defined(PROJECT_ENABLE_LIBSODIUM)
|
||||||
|
|
||||||
std::size_t bytes_written{};
|
std::size_t bytes_written{};
|
||||||
EXPECT_TRUE(file->write(buf, 0U, &bytes_written));
|
EXPECT_TRUE(file->write(buf, 0U, &bytes_written));
|
||||||
@ -74,7 +79,6 @@ auto create_random_file(std::size_t size) -> utils::file::i_file & {
|
|||||||
generated_files.emplace_back(std::move(file));
|
generated_files.emplace_back(std::move(file));
|
||||||
return *dynamic_cast<utils::file::i_file *>(generated_files.back().get());
|
return *dynamic_cast<utils::file::i_file *>(generated_files.back().get());
|
||||||
}
|
}
|
||||||
#endif // defined(PROJECT_ENABLE_LIBSODIUM)
|
|
||||||
|
|
||||||
auto generate_test_directory() -> utils::file::i_directory & {
|
auto generate_test_directory() -> utils::file::i_directory & {
|
||||||
recur_mutex_lock lock{file_mtx};
|
recur_mutex_lock lock{file_mtx};
|
||||||
|
Reference in New Issue
Block a user