style(sonar): fix cpp:S6185 (#4133)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
#include "../tests_common.h"
|
||||
|
||||
#include <format>
|
||||
#include <src/config.h>
|
||||
#include <src/display_device.h>
|
||||
#include <src/rtsp.h>
|
||||
@@ -473,7 +474,7 @@ namespace {
|
||||
} else {
|
||||
const auto [manual_res] = std::get<manual_value_t<res_t>>(input_res);
|
||||
video_config.dd.resolution_option = manual;
|
||||
video_config.dd.manual_resolution = std::to_string(manual_res.m_width) + "x"s + std::to_string(manual_res.m_height);
|
||||
video_config.dd.manual_resolution = std::format("{}x{}", static_cast<int>(manual_res.m_width), static_cast<int>(manual_res.m_height));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
#include "../tests_common.h"
|
||||
|
||||
#include <format>
|
||||
#include <src/file_handler.h>
|
||||
|
||||
struct FileHandlerParentDirectoryTest: testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||||
@@ -79,13 +80,13 @@ Hey, hey, hey!
|
||||
|
||||
TEST_P(FileHandlerTests, WriteFileTest) {
|
||||
auto [fileNum, content] = GetParam();
|
||||
std::string fileName = "write_file_test_" + std::to_string(fileNum) + ".txt";
|
||||
const std::string fileName = std::format("write_file_test_{}.txt", fileNum);
|
||||
EXPECT_EQ(file_handler::write_file(fileName.c_str(), content), 0);
|
||||
}
|
||||
|
||||
TEST_P(FileHandlerTests, ReadFileTest) {
|
||||
auto [fileNum, content] = GetParam();
|
||||
std::string fileName = "write_file_test_" + std::to_string(fileNum) + ".txt";
|
||||
const std::string fileName = std::format("write_file_test_{}.txt", fileNum);
|
||||
EXPECT_EQ(file_handler::read_file(fileName.c_str()), content);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "../tests_common.h"
|
||||
#include "../tests_log_checker.h"
|
||||
|
||||
#include <format>
|
||||
#include <random>
|
||||
#include <src/logging.h>
|
||||
|
||||
@@ -39,7 +40,7 @@ TEST_P(LogLevelsTest, PutMessage) {
|
||||
|
||||
std::random_device rand_dev;
|
||||
std::mt19937_64 rand_gen(rand_dev());
|
||||
auto test_message = std::to_string(rand_gen()) + std::to_string(rand_gen());
|
||||
auto test_message = std::format("{}{}", rand_gen(), rand_gen());
|
||||
BOOST_LOG(logger) << test_message;
|
||||
|
||||
ASSERT_TRUE(log_checker::line_contains(log_file, test_message));
|
||||
|
||||
Reference in New Issue
Block a user