Skip to content

Commit cc19fde

Browse files
committed
Wrap std::filesystem::path with .string() in tests to ensure consistent string handling.
1 parent aedafb7 commit cc19fde

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

modules/core/performance/tests/perf_tests.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class GetStringTaskTypeTest : public ::testing::TestWithParam<TaskTypeTestCase>
122122
std::string temp_path;
123123

124124
void SetUp() override {
125-
temp_path = std::filesystem::temp_directory_path() / "test_settings.json";
125+
temp_path = (std::filesystem::temp_directory_path() / "test_settings.json").string();
126126
auto j = ppc::util::InitJSONPtr();
127127
(*j)["tasks"]["all"] = "ALL";
128128
(*j)["tasks"]["stl"] = "STL";
@@ -156,7 +156,7 @@ TEST_NOLINT(GetStringTaskTypeStandaloneTest, ThrowsIfFileMissing) {
156156
}
157157

158158
TEST(GetStringTaskTypeStandaloneTest, ReturnsUnknownForInvalidEnum) {
159-
std::string path = std::filesystem::temp_directory_path() / "tmp_settings.json";
159+
std::string path = (std::filesystem::temp_directory_path() / "tmp_settings.json").string();
160160
std::ofstream(path) << R"({"tasks":{"seq":"SEQ"}})";
161161

162162
auto result = GetStringTaskType(ppc::core::TypeOfTask::kUnknown, path);
@@ -171,14 +171,14 @@ TEST_NOLINT(GetStringTaskTypeEdgeCases, ThrowsIfFileCannotBeOpened) {
171171
}
172172

173173
TEST_NOLINT(GetStringTaskTypeEdgeCases, ThrowsIfJsonIsMalformed) {
174-
std::string path = std::filesystem::temp_directory_path() / "bad_json.json";
174+
std::string path = (std::filesystem::temp_directory_path() / "bad_json.json").string();
175175
std::ofstream(path) << "{ this is not valid json ";
176176
EXPECT_THROW_NOLINT(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, path), nlohmann::json::parse_error);
177177
std::filesystem::remove(path);
178178
}
179179

180180
TEST_NOLINT(GetStringTaskTypeEdgeCases, ThrowsIfJsonValueIsNull) {
181-
std::string path = std::filesystem::temp_directory_path() / "null_value.json";
181+
std::string path = (std::filesystem::temp_directory_path() / "null_value.json").string();
182182
std::ofstream(path) << R"({"tasks": { "seq": null }})";
183183

184184
EXPECT_THROW_NOLINT(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, path), nlohmann::json::type_error);
@@ -187,7 +187,7 @@ TEST_NOLINT(GetStringTaskTypeEdgeCases, ThrowsIfJsonValueIsNull) {
187187
}
188188

189189
TEST(GetStringTaskTypeEdgeCases, ReturnsUnknownIfEnumOutOfRange) {
190-
std::string path = std::filesystem::temp_directory_path() / "ok.json";
190+
std::string path = (std::filesystem::temp_directory_path() / "ok.json").string();
191191
std::ofstream(path) << R"({"tasks":{"seq":"SEQ"}})";
192192
auto result = GetStringTaskType(ppc::core::TypeOfTask::kUnknown, path);
193193
EXPECT_EQ(result, "unknown");

0 commit comments

Comments
 (0)