fixing signed/unsigned in test attributes

This commit is contained in:
Felix Heitmann 2024-10-08 09:37:28 +02:00 committed by M4rFri
parent 7394af7391
commit 7964f9ea9a

View File

@ -173,7 +173,7 @@ TEST_CASE("attribute test - nested scoped") {
} }
TEST_CASE("attribute test - multi threaded") { TEST_CASE("attribute test - multi threaded") {
const int n_tasks = std::thread::hardware_concurrency(); const unsigned int n_tasks = std::thread::hardware_concurrency();
constexpr auto n_values = 30; constexpr auto n_values = 30;
auto mt_sink = std::make_shared<spdlog::sinks::test_sink_mt>(); auto mt_sink = std::make_shared<spdlog::sinks::test_sink_mt>();
auto logger = spdlog::logger("logger", mt_sink); auto logger = spdlog::logger("logger", mt_sink);
@ -181,7 +181,7 @@ TEST_CASE("attribute test - multi threaded") {
// put attributes with multiple threads simultaneously // put attributes with multiple threads simultaneously
std::vector<std::future<void>> tasks; std::vector<std::future<void>> tasks;
for (auto i = 0; i < n_tasks; ++i) { for (unsigned int i = 0; i < n_tasks; ++i) {
auto task = std::async([&logger, i, n_values] { auto task = std::async([&logger, i, n_values] {
for (auto j = 0; j < n_values; ++j) for (auto j = 0; j < n_values; ++j)
logger.attrs().put(fmt_lib::format("log_{}_key_{}", i, j), fmt_lib::format("log_{}_value_{}", i, j)); logger.attrs().put(fmt_lib::format("log_{}_key_{}", i, j), fmt_lib::format("log_{}_value_{}", i, j));
@ -194,7 +194,7 @@ TEST_CASE("attribute test - multi threaded") {
logger.info(""); logger.info("");
REQUIRE(!mt_sink->lines().empty()); REQUIRE(!mt_sink->lines().empty());
auto log_line = mt_sink->lines().back(); auto log_line = mt_sink->lines().back();
for (auto i = 0; i < n_tasks; ++i) { for (unsigned int i = 0; i < n_tasks; ++i) {
for (auto j = 0; j < n_values; ++j) { for (auto j = 0; j < n_values; ++j) {
auto search_term = fmt_lib::format("log_{0}_key_{1}:log_{0}_value_{1}", i, j); auto search_term = fmt_lib::format("log_{0}_key_{1}:log_{0}_value_{1}", i, j);
REQUIRE(log_line.find(search_term) != std::string::npos); REQUIRE(log_line.find(search_term) != std::string::npos);