GCC Code Coverage Report


Directory: ./
File: tasks/ivanova_p_max_matrix/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 21 21 100.0%
Functions: 5 5 100.0%
Branches: 9 14 64.3%

Line Branch Exec Source
1 #include "ivanova_p_max_matrix/seq/include/ops_seq.hpp"
2
3 #include <algorithm> // для std::max
4 #include <cstddef> // для size_t
5 #include <limits>
6 #include <vector>
7
8 #include "ivanova_p_max_matrix/common/include/common.hpp"
9
10 namespace ivanova_p_max_matrix {
11
12
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 IvanovaPMaxMatrixSEQ::IvanovaPMaxMatrixSEQ(const InType &in) {
13 SetTypeOfTask(GetStaticTypeOfTask());
14
15 // Безопасная инициализация
16 GetInput().clear();
17
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 if (!in.empty()) {
18
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 GetInput() = in;
19 }
20
21 48 GetOutput() = std::numeric_limits<int>::min();
22 48 }
23
24
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 bool IvanovaPMaxMatrixSEQ::ValidationImpl() {
25 // Базовая проверка на пустоту
26
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 if (GetInput().empty()) {
27 return false;
28 }
29
30 const size_t cols = GetInput()[0].size();
31 48 return std::all_of(GetInput().begin(), GetInput().end(),
32 48 [cols](const std::vector<int> &row) { return row.size() == cols; });
33 }
34
35 48 bool IvanovaPMaxMatrixSEQ::PreProcessingImpl() {
36 // Инициализируем выход минимальным значением
37 48 GetOutput() = std::numeric_limits<int>::min();
38 48 return true;
39 }
40
41 48 bool IvanovaPMaxMatrixSEQ::RunImpl() {
42 48 int max_val = std::numeric_limits<int>::min();
43
44
2/2
✓ Branch 0 taken 14304 times.
✓ Branch 1 taken 48 times.
14352 for (const auto &row : GetInput()) {
45
2/2
✓ Branch 0 taken 10231872 times.
✓ Branch 1 taken 14304 times.
10246176 for (int val : row) {
46 10231872 max_val = std::max(val, max_val);
47 }
48 }
49
50 48 GetOutput() = max_val;
51 48 return true;
52 }
53
54 48 bool IvanovaPMaxMatrixSEQ::PostProcessingImpl() {
55 48 return true;
56 }
57
58 } // namespace ivanova_p_max_matrix
59