| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "fatehov_k_matrix_max_elem/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <algorithm> | ||
| 4 | #include <cstddef> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "fatehov_k_matrix_max_elem/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace fatehov_k_matrix_max_elem { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 | FatehovKMatrixMaxElemSEQ::FatehovKMatrixMaxElemSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 | GetInput() = in; | ||
| 14 | 24 | GetOutput() = 0; | |
| 15 | 24 | } | |
| 16 | |||
| 17 | 24 | bool FatehovKMatrixMaxElemSEQ::ValidationImpl() { | |
| 18 | auto &data = GetInput(); | ||
| 19 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | return (std::get<0>(data) > 0 && std::get<0>(data) <= kMaxRows) && |
| 20 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | (std::get<1>(data) > 0 && std::get<1>(data) <= kMaxCols) && |
| 21 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | (std::get<0>(data) * std::get<1>(data) <= kMaxMatrixSize) && |
| 22 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | (std::get<2>(data).size() <= kMaxMatrixSize && |
| 23 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
48 | std::get<2>(data).size() == std::get<0>(data) * std::get<1>(data)) && |
| 24 | 24 | (!std::get<2>(data).empty()); | |
| 25 | } | ||
| 26 | |||
| 27 | 24 | bool FatehovKMatrixMaxElemSEQ::PreProcessingImpl() { | |
| 28 | 24 | return true; | |
| 29 | } | ||
| 30 | |||
| 31 | 24 | bool FatehovKMatrixMaxElemSEQ::RunImpl() { | |
| 32 | auto &data = GetInput(); | ||
| 33 | 24 | size_t rows = std::get<0>(data); | |
| 34 | 24 | size_t columns = std::get<1>(data); | |
| 35 | std::vector<double> &matrix = std::get<2>(data); | ||
| 36 | 24 | double max = matrix[0]; | |
| 37 |
2/2✓ Branch 0 taken 368 times.
✓ Branch 1 taken 24 times.
|
392 | for (size_t i = 0; i < rows * columns; i++) { |
| 38 | 368 | max = std::max(matrix[i], max); | |
| 39 | } | ||
| 40 | 24 | GetOutput() = max; | |
| 41 | 24 | return true; | |
| 42 | } | ||
| 43 | |||
| 44 | 24 | bool FatehovKMatrixMaxElemSEQ::PostProcessingImpl() { | |
| 45 | 24 | return true; | |
| 46 | } | ||
| 47 | |||
| 48 | } // namespace fatehov_k_matrix_max_elem | ||
| 49 |