File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -245,12 +245,16 @@ class Task {
245245 bool was_worked_ = false ;
246246
247247 bool IsFullPipelineStage () {
248+ if (functions_order_.size () < 4 ) {
249+ return false ;
250+ }
251+
248252 auto it = std::adjacent_find (functions_order_.begin () + 2 ,
249253 functions_order_.begin () + static_cast <long >(functions_order_.size () - 2 ),
250254 std::not_equal_to<>());
251255
252- return (functions_order_. size () >= 4 && functions_order_[0 ] == " Validation " &&
253- functions_order_[1 ] == " PreProcessing " && functions_order_[ 2 ] == " Run" &&
256+ return (functions_order_[ 0 ] == " Validation " && functions_order_[1 ] == " PreProcessing " &&
257+ functions_order_[2 ] == " Run" &&
254258 it == (functions_order_.begin () + static_cast <long >(functions_order_.size () - 2 )) &&
255259 functions_order_[functions_order_.size () - 1 ] == " PostProcessing" );
256260 }
Original file line number Diff line number Diff line change @@ -154,6 +154,25 @@ TEST_NOLINT(task_tests, check_empty_order_disabled_valgrind) {
154154 EXPECT_DEATH_IF_SUPPORTED (destroy_function (), " .*ORDER OF FUNCTIONS IS NOT RIGHT.*" );
155155}
156156
157+ TEST_NOLINT (task_tests, premature_postprocessing_no_steps) {
158+ auto destroy_function = [] {
159+ std::vector<float > in (20 , 1 );
160+ ppc::test::task::TestTask<std::vector<float >, float > test_task (in);
161+ ASSERT_NO_THROW (test_task.PostProcessing ());
162+ };
163+ EXPECT_DEATH_IF_SUPPORTED (destroy_function (), " .*ORDER OF FUNCTIONS IS NOT RIGHT.*" );
164+ }
165+
166+ TEST_NOLINT (task_tests, premature_postprocessing_after_preprocessing) {
167+ auto destroy_function = [] {
168+ std::vector<float > in (20 , 1 );
169+ ppc::test::task::TestTask<std::vector<float >, float > test_task (in);
170+ ASSERT_NO_THROW (test_task.PreProcessing ());
171+ ASSERT_NO_THROW (test_task.PostProcessing ());
172+ };
173+ EXPECT_DEATH_IF_SUPPORTED (destroy_function (), " .*ORDER OF FUNCTIONS IS NOT RIGHT.*" );
174+ }
175+
157176int main (int argc, char **argv) {
158177 testing::InitGoogleTest (&argc, argv);
159178 return RUN_ALL_TESTS ();
You can’t perform that action at this time.
0 commit comments