GCC Code Coverage Report


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

Line Branch Exec Source
1 #include "batushin_i_max_val_rows_matrix/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5 #include <vector>
6
7 #include "batushin_i_max_val_rows_matrix/common/include/common.hpp"
8
9 namespace batushin_i_max_val_rows_matrix {
10
11
1/2
✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
120 BatushinIMaxValRowsMatrixSEQ::BatushinIMaxValRowsMatrixSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13 GetInput() = in;
14 120 }
15
16 120 bool BatushinIMaxValRowsMatrixSEQ::ValidationImpl() {
17 const auto &input = GetInput();
18 120 const size_t rows = std::get<0>(input);
19 120 const size_t columns = std::get<1>(input);
20 const auto &matrix = std::get<2>(input);
21
22
1/2
✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
120 if (rows == 0 || columns == 0) {
23 return false;
24 }
25
26
1/2
✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
120 if (matrix.size() != rows * columns) {
27 return false;
28 }
29
30 120 return GetOutput().empty();
31 }
32
33 120 bool BatushinIMaxValRowsMatrixSEQ::PreProcessingImpl() {
34 const auto &input = GetInput();
35 120 const size_t rows = std::get<0>(input);
36 120 const size_t columns = std::get<1>(input);
37 const auto &matrix = std::get<2>(input);
38
39
2/4
✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 120 times.
120 return (rows > 0) && (columns > 0) && (matrix.size() == rows * columns);
40 }
41
42 120 bool BatushinIMaxValRowsMatrixSEQ::RunImpl() {
43 const auto &input = GetInput();
44 120 const size_t rows = std::get<0>(input);
45 120 const size_t columns = std::get<1>(input);
46 const auto &matrix = std::get<2>(input);
47 auto &res = GetOutput();
48
49 120 res.resize(rows);
50
51
2/2
✓ Branch 0 taken 1176 times.
✓ Branch 1 taken 120 times.
1296 for (size_t i = 0; i < rows; i++) {
52 1176 double max_val = matrix[i * columns];
53
54
2/2
✓ Branch 0 taken 79752 times.
✓ Branch 1 taken 1176 times.
80928 for (size_t j = 1; j < columns; j++) {
55 79752 const double curr_val = matrix[(i * columns) + j];
56 79752 max_val = std::max(curr_val, max_val);
57 }
58
59 1176 res[i] = max_val;
60 }
61
62 120 return true;
63 }
64
65 120 bool BatushinIMaxValRowsMatrixSEQ::PostProcessingImpl() {
66 120 return !GetOutput().empty();
67 }
68
69 } // namespace batushin_i_max_val_rows_matrix
70