File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -246,12 +246,16 @@ class Task {
246246 bool was_worked_ = false ;
247247
248248 bool IsFullPipelineStage () {
249+ if (functions_order_.size () < 4 ) {
250+ return false ;
251+ }
252+
249253 auto it = std::adjacent_find (functions_order_.begin () + 2 ,
250254 functions_order_.begin () + static_cast <long >(functions_order_.size () - 2 ),
251255 std::not_equal_to<>());
252256
253- return (functions_order_. size () >= 4 && functions_order_[0 ] == " Validation " &&
254- functions_order_[1 ] == " PreProcessing " && functions_order_[ 2 ] == " Run" &&
257+ return (functions_order_[ 0 ] == " Validation " && functions_order_[1 ] == " PreProcessing " &&
258+ functions_order_[2 ] == " Run" &&
255259 it == (functions_order_.begin () + static_cast <long >(functions_order_.size () - 2 )) &&
256260 functions_order_[functions_order_.size () - 1 ] == " PostProcessing" );
257261 }
Original file line number Diff line number Diff line change @@ -38,4 +38,4 @@ Checks: >
3838
3939CheckOptions :
4040 - key : readability-function-cognitive-complexity.Threshold
41- value : 50 # default: 25
41+ value : 100 # default: 25
Original file line number Diff line number Diff line change @@ -153,6 +153,25 @@ TEST(task_tests, check_empty_order_disabled_valgrind) {
153153 EXPECT_DEATH_IF_SUPPORTED (destroy_function (), " .*ORDER OF FUNCTIONS IS NOT RIGHT.*" );
154154}
155155
156+ TEST (task_tests, premature_postprocessing_no_steps) {
157+ auto destroy_function = [] {
158+ std::vector<float > in (20 , 1 );
159+ ppc::test::task::TestTask<std::vector<float >, float > test_task (in);
160+ ASSERT_NO_THROW (test_task.PostProcessing ());
161+ };
162+ EXPECT_DEATH_IF_SUPPORTED (destroy_function (), " .*ORDER OF FUNCTIONS IS NOT RIGHT.*" );
163+ }
164+
165+ TEST (task_tests, premature_postprocessing_after_preprocessing) {
166+ auto destroy_function = [] {
167+ std::vector<float > in (20 , 1 );
168+ ppc::test::task::TestTask<std::vector<float >, float > test_task (in);
169+ ASSERT_NO_THROW (test_task.PreProcessing ());
170+ ASSERT_NO_THROW (test_task.PostProcessing ());
171+ };
172+ EXPECT_DEATH_IF_SUPPORTED (destroy_function (), " .*ORDER OF FUNCTIONS IS NOT RIGHT.*" );
173+ }
174+
156175int main (int argc, char **argv) {
157176 testing::InitGoogleTest (&argc, argv);
158177 return RUN_ALL_TESTS ();
You can’t perform that action at this time.
0 commit comments