GCC Code Coverage Report


Directory: ./
File: tasks/petrov_e_find_max_in_columns_matrix/seq/src/ops_seq.cpp
Date: 2026-01-09 01:27:18
Exec Total Coverage
Lines: 17 17 100.0%
Functions: 5 5 100.0%
Branches: 10 14 71.4%

Line Branch Exec Source
1 #include "petrov_e_find_max_in_columns_matrix/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cmath>
5 #include <type_traits>
6 #include <vector>
7
8 #include "petrov_e_find_max_in_columns_matrix/common/include/common.hpp"
9
10 namespace petrov_e_find_max_in_columns_matrix {
11
12
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 PetrovEFindMaxInColumnsMatrixSEQ::PetrovEFindMaxInColumnsMatrixSEQ(const InType &in) {
13 SetTypeOfTask(GetStaticTypeOfTask());
14 GetInput() = in;
15 GetOutput() = {};
16 80 }
17
18 80 bool PetrovEFindMaxInColumnsMatrixSEQ::ValidationImpl() {
19
2/4
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 80 times.
80 return (std::get<0>(GetInput()) * std::get<1>(GetInput()) == static_cast<int>(std::get<2>(GetInput()).size())) &&
20 80 (GetOutput().empty());
21 }
22
23 80 bool PetrovEFindMaxInColumnsMatrixSEQ::PreProcessingImpl() {
24 80 return (std::get<0>(GetInput()) * std::get<1>(GetInput()) == static_cast<int>(std::get<2>(GetInput()).size()));
25 }
26
27 80 bool PetrovEFindMaxInColumnsMatrixSEQ::RunImpl() {
28
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 if ((std::get<0>(GetInput()) * std::get<1>(GetInput()) != static_cast<int>(std::get<2>(GetInput()).size()))) {
29 return false;
30 }
31
32 auto &n = std::get<0>(GetInput());
33 auto &m = std::get<1>(GetInput());
34 auto &matrix = std::get<2>(GetInput());
35 OutType &res = GetOutput();
36
37 using MatrixElemType = std::remove_reference_t<decltype(matrix[0])>;
38
39 int i = 0;
40 int j = 0;
41
42 80 res.resize(m);
43 MatrixElemType max = NAN;
44
45
2/2
✓ Branch 0 taken 224 times.
✓ Branch 1 taken 80 times.
304 for (i = 0; i < m; i++) {
46 224 max = matrix[static_cast<int>(i * n)];
47
2/2
✓ Branch 0 taken 488 times.
✓ Branch 1 taken 224 times.
712 for (j = 1; j < n; j++) {
48
2/2
✓ Branch 0 taken 112 times.
✓ Branch 1 taken 376 times.
600 max = std::max(matrix[(i * n) + j], max);
49 }
50 224 res[i] = max;
51 }
52
53 return true;
54 }
55
56 80 bool PetrovEFindMaxInColumnsMatrixSEQ::PostProcessingImpl() {
57 80 return true;
58 }
59
60 } // namespace petrov_e_find_max_in_columns_matrix
61