| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "konstantinov_s_elem_vec_sign_change_count/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | // #include <iostream> | ||
| 4 | // #include <numeric> | ||
| 5 | #include <cstddef> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "konstantinov_s_elem_vec_sign_change_count/common/include/common.hpp" | ||
| 9 | // #include "util/include/util.hpp" | ||
| 10 | |||
| 11 | namespace konstantinov_s_elem_vec_sign_change_count { | ||
| 12 | |||
| 13 |
1/2✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
|
80 | KonstantinovSElemVecSignChangeSEQ::KonstantinovSElemVecSignChangeSEQ(const InType &in) { |
| 14 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 15 |
1/2✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
|
80 | GetInput() = in; |
| 16 | 80 | GetOutput() = 0; | |
| 17 | 80 | } | |
| 18 | |||
| 19 | 80 | bool KonstantinovSElemVecSignChangeSEQ::ValidationImpl() { | |
| 20 | // std::cout << "\t\tValidation seq\n"; | ||
| 21 | 80 | return !GetInput().empty(); | |
| 22 | } | ||
| 23 | |||
| 24 | 80 | bool KonstantinovSElemVecSignChangeSEQ::PreProcessingImpl() { | |
| 25 | 80 | return true; | |
| 26 | } | ||
| 27 | |||
| 28 | 80 | bool KonstantinovSElemVecSignChangeSEQ::RunImpl() { | |
| 29 | 80 | const auto invec = GetInput(); | |
| 30 | int res = 0; | ||
| 31 | 80 | size_t iterations = invec.size() - 1; | |
| 32 | const EType *v = invec.data(); | ||
| 33 |
2/2✓ Branch 0 taken 20000496 times.
✓ Branch 1 taken 80 times.
|
20000576 | for (size_t i = 0; i < iterations; i++) { |
| 34 | 20000496 | res += static_cast<int>((v[i] > 0) != (v[i + 1] > 0)); // + 1 если занки разные | |
| 35 | } | ||
| 36 |
1/2✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
|
80 | GetOutput() = res; |
| 37 | 80 | return true; | |
| 38 | } | ||
| 39 | |||
| 40 | 80 | bool KonstantinovSElemVecSignChangeSEQ::PostProcessingImpl() { | |
| 41 | 80 | return true; | |
| 42 | } | ||
| 43 | |||
| 44 | } // namespace konstantinov_s_elem_vec_sign_change_count | ||
| 45 |