GCC Code Coverage Report


Directory: ./
File: tasks/egorova_l_find_max_val_col_matrix/seq/src/ops_seq.cpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 20 20 100.0%
Functions: 5 5 100.0%
Branches: 19 22 86.4%

Line Branch Exec Source
1 #include "egorova_l_find_max_val_col_matrix/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5 #include <limits>
6 #include <vector>
7
8 #include "egorova_l_find_max_val_col_matrix/common/include/common.hpp"
9
10 namespace egorova_l_find_max_val_col_matrix {
11
12 #ifdef __GNUC__
13 # pragma GCC diagnostic push
14 # pragma GCC diagnostic ignored "-Wnull-dereference"
15 #endif
16
17
1/2
✓ Branch 1 taken 144 times.
✗ Branch 2 not taken.
144 EgorovaLFindMaxValColMatrixSEQ::EgorovaLFindMaxValColMatrixSEQ(const InType &in) {
18 SetTypeOfTask(GetStaticTypeOfTask());
19
1/2
✓ Branch 1 taken 144 times.
✗ Branch 2 not taken.
144 GetInput() = in;
20 144 GetOutput() = std::vector<int>(0);
21 144 }
22
23 #ifdef __GNUC__
24 # pragma GCC diagnostic pop
25 #endif
26
27
2/2
✓ Branch 0 taken 136 times.
✓ Branch 1 taken 8 times.
144 bool EgorovaLFindMaxValColMatrixSEQ::ValidationImpl() {
28 const auto &matrix = GetInput();
29
30
2/2
✓ Branch 0 taken 136 times.
✓ Branch 1 taken 8 times.
144 if (matrix.empty()) {
31 return true;
32 }
33
34
2/2
✓ Branch 0 taken 128 times.
✓ Branch 1 taken 8 times.
136 if (matrix[0].empty()) {
35 return true;
36 }
37
38 const std::size_t cols = matrix[0].size();
39 return std::ranges::all_of(matrix, [cols](const auto &row) { return row.size() == cols; });
40 }
41
42 144 bool EgorovaLFindMaxValColMatrixSEQ::PreProcessingImpl() {
43 144 return true;
44 }
45
46
2/2
✓ Branch 0 taken 136 times.
✓ Branch 1 taken 8 times.
144 bool EgorovaLFindMaxValColMatrixSEQ::RunImpl() {
47 const auto &matrix = GetInput();
48
49 // Оставляем только проверку на пустоту
50
4/4
✓ Branch 0 taken 136 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 128 times.
144 if (matrix.empty() || matrix[0].empty()) {
51 16 GetOutput() = std::vector<int>();
52 16 return true;
53 }
54
55 const std::size_t rows = matrix.size();
56 const std::size_t cols = matrix[0].size();
57 128 std::vector<int> result(cols, std::numeric_limits<int>::min());
58
59
2/2
✓ Branch 0 taken 448 times.
✓ Branch 1 taken 128 times.
576 for (std::size_t jj = 0; jj < cols; ++jj) {
60
2/2
✓ Branch 0 taken 1200 times.
✓ Branch 1 taken 448 times.
1648 for (std::size_t ii = 0; ii < rows; ++ii) {
61 1200 result[jj] = std::max(matrix[ii][jj], result[jj]);
62 }
63 }
64
65
1/2
✓ Branch 1 taken 128 times.
✗ Branch 2 not taken.
128 GetOutput() = result;
66 return true;
67 }
68
69 144 bool EgorovaLFindMaxValColMatrixSEQ::PostProcessingImpl() {
70 144 return true;
71 }
72
73 } // namespace egorova_l_find_max_val_col_matrix
74