| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "alekseev_a_min_dist_neigh_elem_vec/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstdlib> | ||
| 4 | #include <limits> | ||
| 5 | #include <tuple> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "alekseev_a_min_dist_neigh_elem_vec/common/include/common.hpp" | ||
| 9 | |||
| 10 | namespace alekseev_a_min_dist_neigh_elem_vec { | ||
| 11 | |||
| 12 |
1/2✓ Branch 1 taken 170 times.
✗ Branch 2 not taken.
|
170 | AlekseevAMinDistNeighElemVecSEQ::AlekseevAMinDistNeighElemVecSEQ(const InType &in) { |
| 13 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 14 |
1/2✓ Branch 1 taken 170 times.
✗ Branch 2 not taken.
|
170 | GetInput() = in; |
| 15 | GetOutput() = std::make_tuple(-1, -1); | ||
| 16 | 170 | } | |
| 17 | |||
| 18 | 170 | bool AlekseevAMinDistNeighElemVecSEQ::ValidationImpl() { | |
| 19 | 170 | return true; | |
| 20 | } | ||
| 21 | |||
| 22 | 170 | bool AlekseevAMinDistNeighElemVecSEQ::PreProcessingImpl() { | |
| 23 | 170 | return true; | |
| 24 | } | ||
| 25 | |||
| 26 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 154 times.
|
170 | bool AlekseevAMinDistNeighElemVecSEQ::RunImpl() { |
| 27 | const auto &vec = GetInput(); | ||
| 28 | |||
| 29 | 170 | int total_size = static_cast<int>(vec.size()); | |
| 30 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 154 times.
|
170 | if (total_size < 2) { |
| 31 | GetOutput() = std::make_tuple(-1, -1); | ||
| 32 | 16 | return true; | |
| 33 | } | ||
| 34 | int index = -1; | ||
| 35 | int index_value = std::numeric_limits<int>::max(); | ||
| 36 |
2/2✓ Branch 0 taken 686 times.
✓ Branch 1 taken 154 times.
|
840 | for (int i = 0; i < static_cast<int>(vec.size()) - 1; i++) { |
| 37 |
2/2✓ Branch 0 taken 346 times.
✓ Branch 1 taken 340 times.
|
686 | int value = std::abs(vec[i] - vec[i + 1]); |
| 38 |
2/2✓ Branch 0 taken 346 times.
✓ Branch 1 taken 340 times.
|
686 | if (value < index_value) { |
| 39 | index = i; | ||
| 40 | index_value = value; | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | 154 | GetOutput() = std::make_tuple(index, index + 1); | |
| 45 | 154 | return true; | |
| 46 | } | ||
| 47 | |||
| 48 | 170 | bool AlekseevAMinDistNeighElemVecSEQ::PostProcessingImpl() { | |
| 49 | 170 | return true; | |
| 50 | } | ||
| 51 | |||
| 52 | } // namespace alekseev_a_min_dist_neigh_elem_vec | ||
| 53 |