GCC Code Coverage Report


Directory: ./
File: tasks/trofimov_n_max_val_matrix/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 0 20 0.0%
Functions: 0 5 0.0%
Branches: 0 16 0.0%

Line Branch Exec Source
1 #include "trofimov_n_max_val_matrix/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5 #include <vector>
6
7 #include "trofimov_n_max_val_matrix/common/include/common.hpp"
8
9 namespace trofimov_n_max_val_matrix {
10
11 TrofimovNMaxValMatrixSEQ::TrofimovNMaxValMatrixSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13 GetInput() = InType(in.begin(), in.end());
14 GetOutput() = OutType();
15 }
16
17 bool TrofimovNMaxValMatrixSEQ::ValidationImpl() {
18 if (GetInput().empty()) {
19 return false;
20 }
21
22 const std::size_t cols = GetInput()[0].size();
23 for (const auto &row : GetInput()) {
24 if (row.size() != cols) {
25 return false;
26 }
27 }
28
29 return GetOutput().empty();
30 }
31
32 bool TrofimovNMaxValMatrixSEQ::PreProcessingImpl() {
33 GetOutput().resize(GetInput().size());
34 return true;
35 }
36
37 bool TrofimovNMaxValMatrixSEQ::RunImpl() {
38 const auto &input = GetInput();
39 auto &output = GetOutput();
40
41 for (std::size_t i = 0; i < input.size(); ++i) {
42 if (!input[i].empty()) {
43 output[i] = *std::ranges::max_element(input[i]);
44 } else {
45 output[i] = 0;
46 }
47 }
48
49 return true;
50 }
51
52 bool TrofimovNMaxValMatrixSEQ::PostProcessingImpl() {
53 return !GetOutput().empty();
54 }
55
56 } // namespace trofimov_n_max_val_matrix
57