Skip to content

Commit 7cbb1f6

Browse files
committed
add test case for GetStringTaskType to handle unknown type with valid file creation
1 parent a7329e5 commit 7cbb1f6

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

modules/core/task/tests/task_tests.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <cstddef>
44
#include <cstdint>
5+
#include <fstream>
56
#include <vector>
67

78
#include "core/task/tests/test_task.hpp"
@@ -188,8 +189,12 @@ TEST(TaskTest, GetStringTaskType_InvalidFileThrows) {
188189
}
189190

190191
// Test unknown type case
191-
TEST(TaskTest, GetStringTaskType_UnknownType) {
192-
std::string path = "settings.json"; // Provide valid settings file
192+
TEST(TaskTest, GetStringTaskType_UnknownType_WithValidFile) {
193+
std::string path = "settings_valid.json";
194+
std::ofstream file(path);
195+
file
196+
<< R"({"tasks": {"all": "enabled", "stl": "enabled", "omp": "enabled", "mpi": "enabled", "tbb": "enabled", "seq": "enabled"}})";
197+
file.close();
193198
EXPECT_NO_THROW({ GetStringTaskType(ppc::core::TypeOfTask::kUnknown, path); });
194199
}
195200

0 commit comments

Comments
 (0)