v2.0.6-release (#50)
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
Reviewed-on: #50
This commit is contained in:
@@ -183,7 +183,7 @@ TEST(utils_common, divide_with_ceiling) {
|
||||
}
|
||||
|
||||
TEST(utils_common, generate_random_between_for_signed_integers) {
|
||||
static constexpr const auto max_iterations{1000000UL};
|
||||
static constexpr auto max_iterations{1000000UL};
|
||||
|
||||
for (std::size_t idx = 0U; idx < max_iterations; ++idx) {
|
||||
auto res = utils::generate_random_between(5, 12);
|
||||
@@ -205,7 +205,7 @@ TEST(utils_common, generate_random_between_for_signed_integers) {
|
||||
}
|
||||
|
||||
TEST(utils_common, generate_random_between_for_unsigned_integers) {
|
||||
static constexpr const auto max_iterations{1000000UL};
|
||||
static constexpr auto max_iterations{1000000UL};
|
||||
|
||||
for (std::size_t idx = 0U; idx < max_iterations; ++idx) {
|
||||
auto res = utils::generate_random_between(5U, 12U);
|
||||
@@ -239,7 +239,7 @@ TEST(utils_common, generate_random_between_throws_error_on_invalid_range) {
|
||||
}
|
||||
|
||||
TEST(utils_common, generate_random_string) {
|
||||
static constexpr const auto max_iterations{10000L};
|
||||
static constexpr auto max_iterations{10000L};
|
||||
|
||||
const auto test_string = [](auto str) {
|
||||
static std::vector<decltype(str)> list{};
|
||||
@@ -267,7 +267,7 @@ TEST(utils_common, generate_random_string_for_zero_length) {
|
||||
}
|
||||
|
||||
TEST(utils_common, get_environment_variable) {
|
||||
static constexpr const std::string path_env{"PATH"};
|
||||
static constexpr std::string path_env{"PATH"};
|
||||
std::string path;
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -28,8 +28,8 @@ const auto get_stop_requested = []() -> bool { return false; };
|
||||
} // namespace
|
||||
|
||||
namespace repertory {
|
||||
static constexpr const std::string_view token{"moose"};
|
||||
static constexpr const std::wstring_view token_w{L"moose"};
|
||||
static constexpr std::string_view token{"moose"};
|
||||
static constexpr std::wstring_view token_w{L"moose"};
|
||||
|
||||
TEST(utils_encryption, generate_key) {
|
||||
auto key1 =
|
||||
|
@@ -24,13 +24,13 @@
|
||||
namespace {
|
||||
#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
|
||||
#include "utils/file_enc_file.hpp"
|
||||
constexpr const auto file_type_count{3U};
|
||||
constexpr auto file_type_count{3U};
|
||||
#else
|
||||
constexpr const auto file_type_count{2U};
|
||||
constexpr auto file_type_count{2U};
|
||||
#endif
|
||||
|
||||
[[nodiscard]] auto create_file(auto idx, auto path,
|
||||
bool read_only = false) -> auto {
|
||||
[[nodiscard]] auto create_file(auto idx, auto path, bool read_only = false)
|
||||
-> auto {
|
||||
switch (idx) {
|
||||
case 0U:
|
||||
return repertory::utils::file::file::open_or_create_file(path, read_only);
|
||||
@@ -47,8 +47,8 @@ constexpr const auto file_type_count{2U};
|
||||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] auto open_file(auto idx, auto path,
|
||||
bool read_only = false) -> auto {
|
||||
[[nodiscard]] auto open_file(auto idx, auto path, bool read_only = false)
|
||||
-> auto {
|
||||
switch (idx) {
|
||||
case 0U:
|
||||
return repertory::utils::file::file::open_file(path, read_only);
|
||||
@@ -370,6 +370,41 @@ TEST(utils_file, directory_exists_in_path) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(utils_file, directory_can_get_empty_directory_count) {
|
||||
auto &test_dir = test::generate_test_directory();
|
||||
EXPECT_EQ(0U, test_dir.count());
|
||||
EXPECT_EQ(0U, test_dir.count(false));
|
||||
}
|
||||
|
||||
TEST(utils_file, directory_can_get_empty_directory_count_recursively) {
|
||||
auto &test_dir = test::generate_test_directory();
|
||||
EXPECT_EQ(0U, test_dir.count(true));
|
||||
}
|
||||
|
||||
TEST(utils_file, directory_can_get_non_empty_directory_count) {
|
||||
auto &test_dir = test::generate_test_directory();
|
||||
auto sub_dir = test_dir.create_directory("sub_dir");
|
||||
EXPECT_TRUE(sub_dir != nullptr);
|
||||
if (sub_dir) {
|
||||
sub_dir->create_directory("sub_dir");
|
||||
|
||||
EXPECT_EQ(1U, test_dir.count());
|
||||
EXPECT_EQ(1U, test_dir.count(false));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(utils_file, directory_can_get_non_empty_directory_count_recursively) {
|
||||
auto &test_dir = test::generate_test_directory();
|
||||
auto sub_dir = test_dir.create_directory("sub_dir");
|
||||
EXPECT_TRUE(sub_dir != nullptr);
|
||||
if (sub_dir) {
|
||||
sub_dir = sub_dir->create_directory("sub_dir");
|
||||
EXPECT_TRUE(sub_dir != nullptr);
|
||||
}
|
||||
|
||||
EXPECT_EQ(2U, test_dir.count(true));
|
||||
}
|
||||
|
||||
TEST(utils_file, file_exists_in_path) {
|
||||
auto &test_dir = test::generate_test_directory();
|
||||
EXPECT_FALSE(
|
||||
|
Reference in New Issue
Block a user