| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "lazareva_a_max_val_matrix/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <limits> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "lazareva_a_max_val_matrix/common/include/common.hpp" | ||
| 9 | |||
| 10 | namespace lazareva_a_max_val_matrix { | ||
| 11 | |||
| 12 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | LazarevaAMaxValMatrixSEQ::LazarevaAMaxValMatrixSEQ(const InType &in) { |
| 13 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 14 |
1/2✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
|
40 | GetInput() = in; |
| 15 | GetOutput().clear(); | ||
| 16 | 40 | } | |
| 17 | |||
| 18 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | bool LazarevaAMaxValMatrixSEQ::ValidationImpl() { |
| 19 | const auto &input = GetInput(); | ||
| 20 | |||
| 21 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 40 times.
|
40 | return (input.size() >= 2) && GetOutput().empty() && (input[0] > 0) && (input[1] > 0) && |
| 22 |
2/4✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
|
80 | (input[0] <= std::numeric_limits<int>::max() / input[1]) && |
| 23 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | (input.size() == (2 + (static_cast<size_t>(input[0]) * static_cast<size_t>(input[1])))); |
| 24 | } | ||
| 25 | |||
| 26 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | bool LazarevaAMaxValMatrixSEQ::PreProcessingImpl() { |
| 27 | GetOutput().clear(); | ||
| 28 | 40 | int n = GetInput()[0]; | |
| 29 | 40 | GetOutput().reserve(n); | |
| 30 | |||
| 31 | 40 | return true; | |
| 32 | } | ||
| 33 | |||
| 34 | 40 | bool LazarevaAMaxValMatrixSEQ::RunImpl() { | |
| 35 | const auto &input = GetInput(); | ||
| 36 | 40 | int n = input[0]; | |
| 37 | 40 | int m = input[1]; | |
| 38 | 40 | const std::vector<int> matrix(input.begin() + 2, input.end()); | |
| 39 | |||
| 40 |
2/2✓ Branch 0 taken 176 times.
✓ Branch 1 taken 40 times.
|
216 | for (int i = 0; i < n; i++) { |
| 41 | 176 | int row_start = i * m; | |
| 42 |
1/2✓ Branch 0 taken 176 times.
✗ Branch 1 not taken.
|
176 | int row_end = row_start + m; |
| 43 | |||
| 44 |
1/2✓ Branch 0 taken 176 times.
✗ Branch 1 not taken.
|
176 | int max_val = *std::max_element(matrix.begin() + row_start, matrix.begin() + row_end); |
| 45 | GetOutput().push_back(max_val); | ||
| 46 | } | ||
| 47 | |||
| 48 | 40 | return true; | |
| 49 | } | ||
| 50 | |||
| 51 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | bool LazarevaAMaxValMatrixSEQ::PostProcessingImpl() { |
| 52 |
1/2✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
|
40 | int n = GetInput()[0]; |
| 53 |
2/4✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 40 times.
|
40 | return !GetOutput().empty() && (GetOutput().size() == static_cast<size_t>(n)); |
| 54 | } | ||
| 55 | |||
| 56 | } // namespace lazareva_a_max_val_matrix | ||
| 57 |