| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "bortsova_a_max_elem_vector/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <limits> | ||
| 6 | |||
| 7 | #include "bortsova_a_max_elem_vector/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace bortsova_a_max_elem_vector { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 340 times.
✗ Branch 2 not taken.
|
340 | BortsovaAMaxElemVectorSeq::BortsovaAMaxElemVectorSeq(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 | GetInput() = in; | ||
| 14 | 340 | GetOutput() = std::numeric_limits<int>::min(); | |
| 15 | 340 | } | |
| 16 | |||
| 17 | 340 | bool BortsovaAMaxElemVectorSeq::ValidationImpl() { | |
| 18 | 340 | return !GetInput().data.empty(); | |
| 19 | } | ||
| 20 | |||
| 21 | 340 | bool BortsovaAMaxElemVectorSeq::PreProcessingImpl() { | |
| 22 | 340 | GetOutput() = std::numeric_limits<int>::min(); | |
| 23 | 340 | return true; | |
| 24 | } | ||
| 25 | |||
| 26 |
1/2✓ Branch 0 taken 340 times.
✗ Branch 1 not taken.
|
340 | bool BortsovaAMaxElemVectorSeq::RunImpl() { |
| 27 | const auto &vec = GetInput().data; | ||
| 28 | |||
| 29 |
1/2✓ Branch 0 taken 340 times.
✗ Branch 1 not taken.
|
340 | if (vec.empty()) { |
| 30 | return false; | ||
| 31 | } | ||
| 32 | |||
| 33 | 340 | int max_elem = vec[0]; | |
| 34 |
2/2✓ Branch 0 taken 18005204 times.
✓ Branch 1 taken 340 times.
|
18005544 | for (size_t i = 1; i < vec.size(); i++) { |
| 35 | 18005204 | max_elem = std::max(vec[i], max_elem); | |
| 36 | } | ||
| 37 | |||
| 38 | 340 | GetOutput() = max_elem; | |
| 39 | 340 | return true; | |
| 40 | } | ||
| 41 | |||
| 42 | 340 | bool BortsovaAMaxElemVectorSeq::PostProcessingImpl() { | |
| 43 | 340 | return true; | |
| 44 | } | ||
| 45 | |||
| 46 | } // namespace bortsova_a_max_elem_vector | ||
| 47 |