Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions modules/core/performance/tests/perf_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ TEST_NOLINT(GetStringTaskTypeStandaloneTest, ThrowsIfFileMissing) {
EXPECT_THROW_NOLINT(GetStringTaskType(ppc::core::TypeOfTask::kSEQ, missing_path), std::runtime_error);
}

TEST_NOLINT(GetStringTaskTypeStandaloneTest, ExceptionMessageContainsPath) {
const std::string missing_path = "non_existent_settings.json";
EXPECT_THROW_NOLINT(
try { GetStringTaskType(ppc::core::TypeOfTask::kSEQ, missing_path); } catch (const std::runtime_error& e) {
EXPECT_NE(std::string(e.what()).find(missing_path), std::string::npos);
throw;
},
std::runtime_error);
}

TEST(GetStringTaskTypeStandaloneTest, ReturnsUnknownForInvalidEnum) {
std::string path = (std::filesystem::temp_directory_path() / "tmp_settings.json").string();
std::ofstream(path) << R"({"tasks":{"seq":"SEQ"}})";
Expand Down
2 changes: 1 addition & 1 deletion modules/core/task/include/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ inline std::string GetStringTaskStatus(StatusOfTask status_of_task) {
inline std::string GetStringTaskType(TypeOfTask type_of_task, const std::string &settings_file_path) {
std::ifstream file(settings_file_path);
if (!file.is_open()) {
throw std::runtime_error("Failed to open file settings.json");
throw std::runtime_error("Failed to open " + settings_file_path);
}

auto list_settings = ppc::util::InitJSONPtr();
Expand Down
Loading