| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "ilin_a_alternations_signs_of_val_vec/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstddef> | ||
| 4 | #include <vector> | ||
| 5 | |||
| 6 | #include "ilin_a_alternations_signs_of_val_vec/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace ilin_a_alternations_signs_of_val_vec { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
|
140 | IlinAAlternationsSignsOfValVecSEQ::IlinAAlternationsSignsOfValVecSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 |
1/2✓ Branch 1 taken 140 times.
✗ Branch 2 not taken.
|
140 | GetInput() = in; |
| 13 | 140 | GetOutput() = 0; | |
| 14 | 140 | } | |
| 15 | |||
| 16 | 140 | bool IlinAAlternationsSignsOfValVecSEQ::ValidationImpl() { | |
| 17 | 140 | return GetOutput() == 0; | |
| 18 | } | ||
| 19 | |||
| 20 | 140 | bool IlinAAlternationsSignsOfValVecSEQ::PreProcessingImpl() { | |
| 21 | 140 | return true; | |
| 22 | } | ||
| 23 | |||
| 24 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 114 times.
|
140 | bool IlinAAlternationsSignsOfValVecSEQ::RunImpl() { |
| 25 | const std::vector<int> &vec = GetInput(); | ||
| 26 | int alternation_count = 0; | ||
| 27 | |||
| 28 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 114 times.
|
140 | if (vec.size() < 2) { |
| 29 | 26 | GetOutput() = 0; | |
| 30 | 26 | return true; | |
| 31 | } | ||
| 32 |
2/2✓ Branch 0 taken 15524 times.
✓ Branch 1 taken 114 times.
|
15638 | for (size_t i = 0; i < vec.size() - 1; ++i) { |
| 33 |
8/8✓ Branch 0 taken 7702 times.
✓ Branch 1 taken 7822 times.
✓ Branch 2 taken 2176 times.
✓ Branch 3 taken 5526 times.
✓ Branch 4 taken 7822 times.
✓ Branch 5 taken 2176 times.
✓ Branch 6 taken 5567 times.
✓ Branch 7 taken 2255 times.
|
15524 | if ((vec[i] < 0 && vec[i + 1] >= 0) || (vec[i] >= 0 && vec[i + 1] < 0)) { |
| 34 | 11093 | alternation_count++; | |
| 35 | } | ||
| 36 | } | ||
| 37 | 114 | GetOutput() = alternation_count; | |
| 38 | 114 | return true; | |
| 39 | } | ||
| 40 | |||
| 41 | 140 | bool IlinAAlternationsSignsOfValVecSEQ::PostProcessingImpl() { | |
| 42 | 140 | return true; | |
| 43 | } | ||
| 44 | |||
| 45 | } // namespace ilin_a_alternations_signs_of_val_vec | ||
| 46 |