| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "barkalova_m_min_val_matr/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <climits> | ||
| 5 | #include <cstddef> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | #include "barkalova_m_min_val_matr/common/include/common.hpp" | ||
| 9 | |||
| 10 | namespace barkalova_m_min_val_matr { | ||
| 11 | |||
| 12 |
1/2✓ Branch 1 taken 256 times.
✗ Branch 2 not taken.
|
256 | BarkalovaMMinValMatrSEQ::BarkalovaMMinValMatrSEQ(const InType &in) { |
| 13 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 14 |
1/2✓ Branch 1 taken 256 times.
✗ Branch 2 not taken.
|
256 | GetInput().resize(in.size()); |
| 15 |
2/2✓ Branch 0 taken 864 times.
✓ Branch 1 taken 256 times.
|
1120 | for (size_t i = 0; i < in.size(); ++i) { |
| 16 |
1/2✓ Branch 1 taken 864 times.
✗ Branch 2 not taken.
|
864 | GetInput()[i] = in[i]; |
| 17 | } | ||
| 18 | GetOutput().clear(); | ||
| 19 | 256 | } | |
| 20 | |||
| 21 |
2/2✓ Branch 0 taken 240 times.
✓ Branch 1 taken 16 times.
|
256 | bool BarkalovaMMinValMatrSEQ::ValidationImpl() { |
| 22 | const auto &matrix = GetInput(); | ||
| 23 |
2/2✓ Branch 0 taken 240 times.
✓ Branch 1 taken 16 times.
|
256 | if (matrix.empty()) { |
| 24 | return true; | ||
| 25 | } | ||
| 26 | size_t stolb = matrix[0].size(); | ||
| 27 | // все строки должны иметь одинак разм | ||
| 28 | return std::ranges::all_of(matrix, [stolb](const auto &row) { return row.size() == stolb; }); | ||
| 29 | } | ||
| 30 | |||
| 31 |
2/2✓ Branch 0 taken 240 times.
✓ Branch 1 taken 16 times.
|
256 | bool BarkalovaMMinValMatrSEQ::PreProcessingImpl() { |
| 32 |
2/2✓ Branch 0 taken 240 times.
✓ Branch 1 taken 16 times.
|
256 | if (!GetInput().empty()) { |
| 33 | size_t stolb = GetInput()[0].size(); | ||
| 34 | 240 | GetOutput().resize(stolb, INT_MAX); | |
| 35 | } else { | ||
| 36 | GetOutput().clear(); | ||
| 37 | } | ||
| 38 | 256 | return true; | |
| 39 | } | ||
| 40 | |||
| 41 |
2/2✓ Branch 0 taken 240 times.
✓ Branch 1 taken 16 times.
|
256 | bool BarkalovaMMinValMatrSEQ::RunImpl() { |
| 42 | const auto &matrix = GetInput(); | ||
| 43 | auto &res = GetOutput(); | ||
| 44 |
2/2✓ Branch 0 taken 240 times.
✓ Branch 1 taken 16 times.
|
256 | if (matrix.empty()) { |
| 45 | return true; | ||
| 46 | } | ||
| 47 |
2/2✓ Branch 0 taken 1008 times.
✓ Branch 1 taken 240 times.
|
1248 | for (size_t j = 0; j < res.size(); ++j) { |
| 48 | 1008 | int min_val = INT_MAX; | |
| 49 |
2/2✓ Branch 0 taken 3168 times.
✓ Branch 1 taken 1008 times.
|
4176 | for (const auto &row : matrix) { |
| 50 | 3168 | min_val = std::min(row[j], min_val); | |
| 51 | } | ||
| 52 | 1008 | res[j] = min_val; | |
| 53 | } | ||
| 54 | |||
| 55 | return true; | ||
| 56 | } | ||
| 57 | |||
| 58 |
2/2✓ Branch 0 taken 240 times.
✓ Branch 1 taken 16 times.
|
256 | bool BarkalovaMMinValMatrSEQ::PostProcessingImpl() { |
| 59 |
3/4✓ Branch 0 taken 240 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 240 times.
✗ Branch 3 not taken.
|
256 | return GetInput().empty() || !GetOutput().empty(); |
| 60 | } | ||
| 61 | } // namespace barkalova_m_min_val_matr | ||
| 62 |