GCC Code Coverage Report


Directory: ./
File: tasks/mityaeva_d_min_v_rows_matrix/seq/src/ops_seq.cpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 30 34 88.2%
Functions: 5 5 100.0%
Branches: 22 42 52.4%

Line Branch Exec Source
1 #include "mityaeva_d_min_v_rows_matrix/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5 #include <vector>
6
7 #include "mityaeva_d_min_v_rows_matrix/common/include/common.hpp"
8
9 namespace mityaeva_d_min_v_rows_matrix {
10
11
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 MinValuesInRowsSEQ::MinValuesInRowsSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 GetInput() = in;
14
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 GetOutput() = std::vector<int>{0};
15 48 }
16
17
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 bool MinValuesInRowsSEQ::ValidationImpl() {
18 const auto &input = GetInput();
19
20
2/4
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
✗ Branch 3 not taken.
48 if (input.empty() || input.size() < 2) {
21 return false;
22 }
23
24 48 int rows = input[0];
25 48 int cols = input[1];
26
27
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 if (rows <= 0 || cols <= 0) {
28 return false;
29 }
30
31 48 size_t expected_size = 2 + (static_cast<size_t>(rows) * static_cast<size_t>(cols));
32 48 return input.size() == expected_size;
33 }
34
35 48 bool MinValuesInRowsSEQ::PreProcessingImpl() {
36 48 return true;
37 }
38
39
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 bool MinValuesInRowsSEQ::RunImpl() {
40 const auto &input = GetInput();
41
42 try {
43 48 int rows = input[0];
44 48 int cols = input[1];
45
46 48 std::vector<int> result;
47
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 result.reserve(rows);
48
49 size_t data_index = 2;
50
51
2/2
✓ Branch 0 taken 112 times.
✓ Branch 1 taken 48 times.
160 for (int i = 0; i < rows; ++i) {
52
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
112 if (cols == 0) {
53 result.push_back(0);
54 continue;
55 }
56
57 112 int min_val = input[data_index];
58
59
2/2
✓ Branch 0 taken 200 times.
✓ Branch 1 taken 112 times.
312 for (int j = 1; j < cols; ++j) {
60 200 int current_val = input[data_index + j];
61 200 min_val = std::min(current_val, min_val);
62 }
63
64 result.push_back(min_val);
65 112 data_index += cols;
66 }
67
68 auto &output = GetOutput();
69 output.clear();
70
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 output.reserve(rows + 1);
71
1/4
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
48 output.push_back(static_cast<int>(result.size()));
72
73
3/4
✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 112 times.
✓ Branch 3 taken 48 times.
160 for (int val : result) {
74 output.push_back(val);
75 }
76
77 return true;
78
79 } catch (...) {
80 return false;
81 }
82 }
83
84
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 bool MinValuesInRowsSEQ::PostProcessingImpl() {
85 const auto &output = GetOutput();
86
2/4
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 48 times.
48 return !output.empty() && output[0] > 0;
87 }
88
89 } // namespace mityaeva_d_min_v_rows_matrix
90