| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "shvetsova_k_max_diff_neig_vec/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cmath> | ||
| 4 | #include <utility> | ||
| 5 | |||
| 6 | #include "shvetsova_k_max_diff_neig_vec/common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace shvetsova_k_max_diff_neig_vec { | ||
| 9 | |||
| 10 |
1/2✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
|
80 | ShvetsovaKMaxDiffNeigVecSEQ::ShvetsovaKMaxDiffNeigVecSEQ(const InType &in) { |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 |
1/2✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
|
80 | GetInput() = in; |
| 13 | GetOutput() = std::pair<double, double>{0.0, 0.0}; | ||
| 14 | 80 | } | |
| 15 | |||
| 16 | 80 | bool ShvetsovaKMaxDiffNeigVecSEQ::ValidationImpl() { | |
| 17 | 80 | data_ = GetInput(); | |
| 18 | 80 | return true; | |
| 19 | } | ||
| 20 | |||
| 21 | 80 | bool ShvetsovaKMaxDiffNeigVecSEQ::PreProcessingImpl() { | |
| 22 | 80 | return true; | |
| 23 | } | ||
| 24 | |||
| 25 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 16 times.
|
80 | bool ShvetsovaKMaxDiffNeigVecSEQ::RunImpl() { |
| 26 | double max_dif = 0; | ||
| 27 | double first_elem = 0; | ||
| 28 | double second_elem = 0; | ||
| 29 | 80 | int sz = static_cast<int>(data_.size()); | |
| 30 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 16 times.
|
80 | if (sz < 2) { |
| 31 | GetOutput().first = 0.0; | ||
| 32 | GetOutput().second = 0.0; | ||
| 33 | } else { | ||
| 34 |
2/2✓ Branch 0 taken 205976 times.
✓ Branch 1 taken 64 times.
|
206040 | for (int i = 0; i < sz - 1; i++) { |
| 35 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 205976 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 205976 times.
✓ Branch 4 taken 488 times.
✓ Branch 5 taken 205488 times.
|
205976 | if (max_dif <= std::abs(data_.at(i) - data_.at(i + 1))) { |
| 36 | first_elem = data_.at(i); | ||
| 37 | second_elem = data_.at(i + 1); | ||
| 38 | max_dif = std::abs(data_.at(i) - data_.at(i + 1)); | ||
| 39 | } | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | 80 | GetOutput().first = first_elem; | |
| 44 | 80 | GetOutput().second = second_elem; | |
| 45 | 80 | return true; | |
| 46 | } | ||
| 47 | |||
| 48 | 80 | bool ShvetsovaKMaxDiffNeigVecSEQ::PostProcessingImpl() { | |
| 49 | 80 | return true; | |
| 50 | } | ||
| 51 | |||
| 52 | } // namespace shvetsova_k_max_diff_neig_vec | ||
| 53 |