| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "boltenkov_s_max_in_matrix/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cmath> | ||
| 4 | #include <limits> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "boltenkov_s_max_in_matrix/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace boltenkov_s_max_in_matrix { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 | BoltenkovSMaxInMatrixkSEQ::BoltenkovSMaxInMatrixkSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 | GetInput() = in; | ||
| 14 | 24 | GetOutput() = -std::numeric_limits<double>::max(); | |
| 15 | 24 | } | |
| 16 | |||
| 17 | 24 | bool BoltenkovSMaxInMatrixkSEQ::ValidationImpl() { | |
| 18 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | return std::get<0>(GetInput()) > 0 && !std::get<1>(GetInput()).empty() && |
| 19 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | std::get<1>(GetInput()).size() % std::get<0>(GetInput()) == 0; |
| 20 | } | ||
| 21 | |||
| 22 | 24 | bool BoltenkovSMaxInMatrixkSEQ::PreProcessingImpl() { | |
| 23 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | return std::get<0>(GetInput()) > 0 && !std::get<1>(GetInput()).empty() && |
| 24 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | std::get<1>(GetInput()).size() % std::get<0>(GetInput()) == 0; |
| 25 | } | ||
| 26 | |||
| 27 | 24 | bool BoltenkovSMaxInMatrixkSEQ::RunImpl() { | |
| 28 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24 times.
✗ Branch 3 not taken.
|
24 | if (std::get<0>(GetInput()) <= 0 || std::get<1>(GetInput()).empty() || |
| 29 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | std::get<1>(GetInput()).size() % std::get<0>(GetInput()) != 0) { |
| 30 | return false; | ||
| 31 | } | ||
| 32 | |||
| 33 | OutType &mx = GetOutput(); | ||
| 34 | std::vector<double> &v = std::get<1>(GetInput()); | ||
| 35 | |||
| 36 | 24 | int n = static_cast<int>(v.size()); | |
| 37 | bool flag = false; | ||
| 38 | |||
| 39 |
2/2✓ Branch 0 taken 75505664 times.
✓ Branch 1 taken 24 times.
|
75505688 | for (int i = 0; i < n; ++i) { |
| 40 | 75505664 | flag = v[i] > mx; | |
| 41 | 75505664 | mx = (static_cast<double>(flag) * v[i]) + (static_cast<double>(!flag) * mx); | |
| 42 | } | ||
| 43 | |||
| 44 | return true; | ||
| 45 | } | ||
| 46 | |||
| 47 | 24 | bool BoltenkovSMaxInMatrixkSEQ::PostProcessingImpl() { | |
| 48 | 24 | return true; | |
| 49 | } | ||
| 50 | |||
| 51 | } // namespace boltenkov_s_max_in_matrix | ||
| 52 |