\#10 Address compiler warnings
All checks were successful
BlockStorage/repertory_osx/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good

This commit is contained in:
2023-10-30 11:07:42 -05:00
parent bc3005a6a4
commit e9b202f5c8
7 changed files with 48 additions and 48 deletions

View File

@ -162,8 +162,8 @@ TEST_F(directory_db_test, get_file) {
api_file file{};
EXPECT_EQ(api_error::success,
db_->get_file("/cow.txt", file, [](api_file &file) {
EXPECT_STREQ("/cow.txt", file.api_path.c_str());
db_->get_file("/cow.txt", file, [](api_file &cur_file) {
EXPECT_STREQ("/cow.txt", cur_file.api_path.c_str());
}));
EXPECT_STREQ("/cow.txt", file.api_path.c_str());
}

View File

@ -89,9 +89,9 @@ TEST(open_file, properly_initializes_state_based_on_chunk_size) {
EXPECT_CALL(um, remove_resume)
.WillOnce(
[&fsi](const std::string &api_path, const std::string &source_path) {
[&fsi](const std::string &api_path, const std::string &source_path2) {
EXPECT_EQ(fsi.api_path, api_path);
EXPECT_EQ(fsi.source_path, source_path);
EXPECT_EQ(fsi.source_path, source_path2);
});
file_manager::open_file o(1u, 0U, fsi, mp, um);
@ -143,15 +143,15 @@ TEST(open_file, will_change_source_path_if_file_size_is_greater_than_0) {
EXPECT_CALL(um, remove_resume)
.WillOnce(
[&fsi](const std::string &api_path, const std::string &source_path) {
[&fsi](const std::string &api_path, const std::string &source_path2) {
EXPECT_EQ(fsi.api_path, api_path);
EXPECT_EQ(fsi.source_path, source_path);
EXPECT_EQ(fsi.source_path, source_path2);
});
EXPECT_CALL(mp, set_item_meta(fsi.api_path, META_SOURCE, _))
.WillOnce([&fsi](const std::string &, const std::string &,
const std::string &source_path) -> api_error {
EXPECT_STRNE(fsi.source_path.c_str(), source_path.c_str());
const std::string &source_path2) -> api_error {
EXPECT_STRNE(fsi.source_path.c_str(), source_path2.c_str());
return api_error::success;
});
@ -248,9 +248,9 @@ TEST(open_file, write_with_incomplete_download) {
EXPECT_CALL(um, store_resume)
.Times(2)
.WillRepeatedly([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
.WillRepeatedly([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
data_buffer data = {10, 9, 8};
@ -325,9 +325,9 @@ TEST(open_file, write_new_file) {
EXPECT_EQ(fsi.api_path, api_path);
});
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
std::size_t bytes_written{};
@ -414,9 +414,9 @@ TEST(open_file, write_new_file_multiple_chunks) {
EXPECT_EQ(fsi.api_path, api_path);
});
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
std::size_t bytes_written{};
@ -478,13 +478,13 @@ TEST(open_file, resize_file_to_0_bytes) {
EXPECT_EQ(fsi.api_path, api_path);
});
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
EXPECT_CALL(um, store_resume).WillOnce([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
EXPECT_CALL(um, store_resume).WillOnce([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
EXPECT_EQ(api_error::success, o.resize(0u));
@ -532,9 +532,9 @@ TEST(open_file, resize_file_by_full_chunk) {
EXPECT_EQ(fsi.api_path, api_path);
});
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) {
EXPECT_EQ(fsi.api_path, o.get_api_path());
EXPECT_EQ(fsi.source_path, o.get_source_path());
EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) {
EXPECT_EQ(fsi.api_path, cur_file.get_api_path());
EXPECT_EQ(fsi.source_path, cur_file.get_source_path());
});
EXPECT_EQ(api_error::success, o.resize(test_chunk_size * 3u));
@ -583,9 +583,9 @@ TEST(open_file, can_add_handle) {
.WillOnce(Return(api_error::success));
EXPECT_CALL(um, remove_resume)
.WillOnce(
[&fsi](const std::string &api_path, const std::string &source_path) {
[&fsi](const std::string &api_path, const std::string &source_path2) {
EXPECT_EQ(fsi.api_path, api_path);
EXPECT_EQ(fsi.source_path, source_path);
EXPECT_EQ(fsi.source_path, source_path2);
});
event_capture capture(
@ -642,9 +642,9 @@ TEST(open_file, can_remove_handle) {
EXPECT_CALL(um, remove_resume)
.WillOnce(
[&fsi](const std::string &api_path, const std::string &source_path) {
[&fsi](const std::string &api_path, const std::string &source_path2) {
EXPECT_EQ(fsi.api_path, api_path);
EXPECT_EQ(fsi.source_path, source_path);
EXPECT_EQ(fsi.source_path, source_path2);
});
EXPECT_CALL(mp, set_item_meta(fsi.api_path, META_SOURCE, _))
.WillOnce(Return(api_error::success));

View File

@ -461,10 +461,10 @@ TEST(file_manager, download_is_stored_after_write_if_partially_downloaded) {
});
EXPECT_CALL(mp, set_item_meta("/test_write_partial_download.txt", _))
.WillOnce(
[](const std::string &, const api_meta_map &meta) -> api_error {
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_CHANGED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_MODIFIED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_WRITTEN).empty()));
[](const std::string &, const api_meta_map &meta2) -> api_error {
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_CHANGED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_MODIFIED).empty()));
EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_WRITTEN).empty()));
return api_error::success;
});
EXPECT_CALL(mp, upload_file).Times(0u);

View File

@ -113,8 +113,8 @@ public:
const get_name_callback &get_name,
const get_token_callback &get_token, api_file &file) {
auto f = std::find_if(list.begin(), list.end(),
[&api_path](const auto &file) -> bool {
return file.api_path == api_path;
[&api_path](const auto &cur_file) -> bool {
return cur_file.api_path == api_path;
});
if (f == list.end()) {
return api_error::item_not_found;

View File

@ -30,8 +30,8 @@ TEST(lock_data, lock_and_unlock) {
EXPECT_EQ(lock_result::success, l.grab_lock());
std::thread([]() {
lock_data l(provider_type::sia, "1");
EXPECT_EQ(lock_result::locked, l.grab_lock(10));
lock_data l2(provider_type::sia, "1");
EXPECT_EQ(lock_result::locked, l2.grab_lock(10));
}).join();
}

View File

@ -25,16 +25,16 @@
namespace repertory {
TEST(packet, encrypt_and_decrypt) {
packet packet;
packet.encode("test");
packet.encrypt("moose");
packet test_packet;
test_packet.encode("test");
test_packet.encrypt("moose");
std::uint32_t size{};
EXPECT_EQ(0, packet.decode(size));
EXPECT_EQ(0, packet.decrypt("moose"));
EXPECT_EQ(0, test_packet.decode(size));
EXPECT_EQ(0, test_packet.decrypt("moose"));
std::string data;
EXPECT_EQ(0, packet.decode(data));
EXPECT_EQ(0, test_packet.decode(data));
EXPECT_STREQ("test", data.c_str());
}