22
33#include < chrono>
44#include < cstdint>
5+ #include < filesystem>
6+ #include < fstream>
57#include < memory>
8+ #include < stdexcept>
9+ #include < string_view>
10+ #include < thread>
611#include < vector>
712
813#include " core/performance/include/performance.hpp"
914#include " core/performance/tests/test_task.hpp"
15+ #include " core/task/include/task.hpp"
1016#include " core/util/include/util.hpp"
17+ #include " nlohmann/json.hpp"
1118
1219TEST (perf_tests, check_perf_pipeline) {
1320 std::vector<uint32_t > in (2000 , 1 );
@@ -103,8 +110,7 @@ TEST_P(GetStringParamNameParamTest, ReturnsExpectedString) {
103110INSTANTIATE_TEST_SUITE_P_NOLINT (ParamTests, GetStringParamNameParamTest,
104111 ::testing::Values (ParamTestCase{ppc::core::PerfResults::kTaskRun , " task_run" },
105112 ParamTestCase{ppc::core::PerfResults::kPipeline , " pipeline" },
106- ParamTestCase{static_cast <ppc::core::PerfResults::TypeOfRunning>(999 ),
107- " none" }));
113+ ParamTestCase{ppc::core::PerfResults::TypeOfRunning::kNone , " none" }));
108114
109115struct TaskTypeTestCase {
110116 ppc::core::TypeOfTask type;
@@ -154,7 +160,7 @@ TEST(GetStringTaskTypeStandaloneTest, ReturnsUnknownForInvalidEnum) {
154160 std::string path = std::filesystem::temp_directory_path () / " tmp_settings.json" ;
155161 std::ofstream (path) << R"( {"tasks":{"seq":"SEQ"}})" ;
156162
157- auto result = GetStringTaskType (static_cast < ppc::core::TypeOfTask>( 999 ) , path);
163+ auto result = GetStringTaskType (ppc::core::TypeOfTask:: kUnknown , path);
158164 EXPECT_EQ (result, " unknown" );
159165
160166 std::filesystem::remove (path);
@@ -172,7 +178,7 @@ TEST_NOLINT(GetStringTaskTypeEdgeCases, ThrowsIfJsonIsMalformed) {
172178 std::filesystem::remove (path);
173179}
174180
175- TEST (GetStringTaskTypeEdgeCases, ThrowsIfJsonValueIsNull) {
181+ TEST_NOLINT (GetStringTaskTypeEdgeCases, ThrowsIfJsonValueIsNull) {
176182 std::string path = std::filesystem::temp_directory_path () / " null_value.json" ;
177183 std::ofstream (path) << R"( {"tasks": { "seq": null }})" ;
178184
@@ -184,7 +190,7 @@ TEST(GetStringTaskTypeEdgeCases, ThrowsIfJsonValueIsNull) {
184190TEST (GetStringTaskTypeEdgeCases, ReturnsUnknownIfEnumOutOfRange) {
185191 std::string path = std::filesystem::temp_directory_path () / " ok.json" ;
186192 std::ofstream (path) << R"( {"tasks":{"seq":"SEQ"}})" ;
187- auto result = GetStringTaskType (static_cast < ppc::core::TypeOfTask>( 255 ) , path);
193+ auto result = GetStringTaskType (ppc::core::TypeOfTask:: kUnknown , path);
188194 EXPECT_EQ (result, " unknown" );
189195 std::filesystem::remove (path);
190196}
0 commit comments