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
8 changes: 6 additions & 2 deletions modules/core/task/include/task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,16 @@ class Task {
bool was_worked_ = false;

bool IsFullPipelineStage() {
if (functions_order_.size() < 4) {
return false;
}

auto it = std::adjacent_find(functions_order_.begin() + 2,
functions_order_.begin() + static_cast<long>(functions_order_.size() - 2),
std::not_equal_to<>());

return (functions_order_.size() >= 4 && functions_order_[0] == "Validation" &&
functions_order_[1] == "PreProcessing" && functions_order_[2] == "Run" &&
return (functions_order_[0] == "Validation" && functions_order_[1] == "PreProcessing" &&
functions_order_[2] == "Run" &&
it == (functions_order_.begin() + static_cast<long>(functions_order_.size() - 2)) &&
functions_order_[functions_order_.size() - 1] == "PostProcessing");
}
Expand Down
2 changes: 1 addition & 1 deletion modules/core/task/tests/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Checks: >

CheckOptions:
- key: readability-function-cognitive-complexity.Threshold
value: 50 # default: 25
value: 100 # default: 25
19 changes: 19 additions & 0 deletions modules/core/task/tests/task_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,25 @@ TEST(task_tests, check_empty_order_disabled_valgrind) {
EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*");
}

TEST(task_tests, premature_postprocessing_no_steps) {
auto destroy_function = [] {
std::vector<float> in(20, 1);
ppc::test::task::TestTask<std::vector<float>, float> test_task(in);
ASSERT_NO_THROW(test_task.PostProcessing());
};
EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*");
}

TEST(task_tests, premature_postprocessing_after_preprocessing) {
auto destroy_function = [] {
std::vector<float> in(20, 1);
ppc::test::task::TestTask<std::vector<float>, float> test_task(in);
ASSERT_NO_THROW(test_task.PreProcessing());
ASSERT_NO_THROW(test_task.PostProcessing());
};
EXPECT_DEATH_IF_SUPPORTED(destroy_function(), ".*ORDER OF FUNCTIONS IS NOT RIGHT.*");
}

int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
Expand Down
Loading