GCC Code Coverage Report


Directory: ./
File: tasks/buzulukskiy_d_max_value_matrix_elements/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 19 21 90.5%
Functions: 5 5 100.0%
Branches: 9 16 56.2%

Line Branch Exec Source
1 #include "buzulukskiy_d_max_value_matrix_elements/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5 #include <vector>
6
7 #include "buzulukskiy_d_max_value_matrix_elements/common/include/common.hpp"
8
9 namespace buzulukskiy_d_max_value_matrix_elements {
10
11
1/2
✓ Branch 1 taken 68 times.
✗ Branch 2 not taken.
68 BuzulukskiyDMaxValueMatrixElementsSEQ::BuzulukskiyDMaxValueMatrixElementsSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13 GetInput() = in;
14 68 GetOutput() = 0;
15 68 }
16
17 68 bool BuzulukskiyDMaxValueMatrixElementsSEQ::ValidationImpl() {
18 const Matrix &inputdata = GetInput();
19 68 const int rows = inputdata.rows;
20
1/2
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
68 const int columns = inputdata.columns;
21 const std::vector<int> &matrix = inputdata.data;
22
23
2/4
✓ Branch 0 taken 68 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 68 times.
68 return !matrix.empty() && rows > 0 && columns > 0 &&
24
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 68 times.
68 matrix.size() == static_cast<size_t>(rows) * static_cast<size_t>(columns);
25 }
26
27 68 bool BuzulukskiyDMaxValueMatrixElementsSEQ::PreProcessingImpl() {
28 68 return true;
29 }
30
31
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 68 times.
68 bool BuzulukskiyDMaxValueMatrixElementsSEQ::RunImpl() {
32 const Matrix &inputdata = GetInput();
33 const std::vector<int> &matrix = inputdata.data;
34
35 // Обязательная проверка на пустую матрицу
36
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 68 times.
68 if (matrix.empty()) {
37 GetOutput() = 0;
38 return true;
39 }
40
41 68 int max_value = matrix[0];
42
2/2
✓ Branch 0 taken 380 times.
✓ Branch 1 taken 68 times.
448 for (size_t index = 1; index < matrix.size(); ++index) {
43 380 max_value = std::max(max_value, matrix[index]);
44 }
45
46 68 GetOutput() = max_value;
47 68 return true;
48 }
49
50 68 bool BuzulukskiyDMaxValueMatrixElementsSEQ::PostProcessingImpl() {
51 68 return true;
52 }
53
54 } // namespace buzulukskiy_d_max_value_matrix_elements
55