GCC Code Coverage Report


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

Line Branch Exec Source
1 #include "../include/ops_seq.hpp"
2
3 #include <cstddef>
4 #include <limits>
5 #include <vector>
6
7 #include "kondrashova_v_sum_col_mat/common/include/common.hpp"
8
9 namespace kondrashova_v_sum_col_mat {
10
11 KondrashovaVSumColMatSEQ::KondrashovaVSumColMatSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13 GetInput() = in;
14 GetOutput().clear();
15 }
16
17 bool KondrashovaVSumColMatSEQ::ValidationImpl() {
18 const auto &input = GetInput();
19
20 return (input.size() >= 2) && GetOutput().empty() && (input[0] > 0) && (input[1] > 0) &&
21 (input[0] <= std::numeric_limits<int>::max() / input[1]) &&
22 (input.size() == (2 + (static_cast<size_t>(input[0]) * static_cast<size_t>(input[1]))));
23 }
24
25 bool KondrashovaVSumColMatSEQ::PreProcessingImpl() {
26 GetOutput().clear();
27 return true;
28 }
29
30 bool KondrashovaVSumColMatSEQ::RunImpl() {
31 int rows = GetInput()[0];
32 int cols = GetInput()[1];
33
34 std::vector<int> col_sum_vec(cols, 0);
35
36 for (int j = 0; j < cols; j++) {
37 for (int i = 0; i < rows; i++) {
38 int ind = 2 + (i * cols) + j;
39 col_sum_vec[static_cast<std::size_t>(j)] += GetInput()[static_cast<std::size_t>(ind)];
40 }
41 }
42
43 GetOutput() = col_sum_vec;
44 return true;
45 }
46
47 bool KondrashovaVSumColMatSEQ::PostProcessingImpl() {
48 return !GetOutput().empty();
49 }
50
51 } // namespace kondrashova_v_sum_col_mat
52