GCC Code Coverage Report


Directory: ./
File: tasks/nikitina_v_max_elem_matr/seq/src/ops_seq.cpp
Date: 2025-12-13 04:24:21
Exec Total Coverage
Lines: 23 23 100.0%
Functions: 5 5 100.0%
Branches: 20 28 71.4%

Line Branch Exec Source
1 #include "nikitina_v_max_elem_matr/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5 #include <iterator>
6 #include <limits>
7 #include <vector>
8
9 #include "nikitina_v_max_elem_matr/common/include/common.hpp"
10
11 namespace nikitina_v_max_elem_matr {
12
13
1/2
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
64 MaxElementMatrSEQ::MaxElementMatrSEQ(const InType &in) : BaseTask() {
14 SetTypeOfTask(GetStaticTypeOfTask());
15
1/2
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
64 GetInput() = in;
16 64 }
17
18
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
64 bool MaxElementMatrSEQ::ValidationImpl() {
19 const auto &in = GetInput();
20
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
64 if (in.size() < 2) {
21 return false;
22 }
23 64 rows_ = in[0];
24 64 cols_ = in[1];
25
3/6
✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 64 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 64 times.
64 return rows_ >= 0 && cols_ >= 0 && static_cast<size_t>(rows_) * cols_ == in.size() - 2;
26 }
27
28
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
64 bool MaxElementMatrSEQ::PreProcessingImpl() {
29 const auto &in = GetInput();
30 matrix_.clear();
31
4/4
✓ Branch 0 taken 48 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 40 times.
✓ Branch 3 taken 8 times.
64 if (rows_ > 0 && cols_ > 0) {
32 40 matrix_.reserve(static_cast<size_t>(rows_) * cols_);
33 std::copy(in.begin() + 2, in.end(), std::back_inserter(matrix_));
34 }
35 64 max_val_ = std::numeric_limits<int>::min();
36 64 return true;
37 }
38
39
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 40 times.
64 bool MaxElementMatrSEQ::RunImpl() {
40
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 40 times.
64 if (matrix_.empty()) {
41 24 max_val_ = std::numeric_limits<int>::min();
42 24 return true;
43 }
44 40 max_val_ = matrix_[0];
45
2/2
✓ Branch 0 taken 1848 times.
✓ Branch 1 taken 40 times.
1888 for (size_t i = 1; i < matrix_.size(); ++i) {
46
2/2
✓ Branch 0 taken 108 times.
✓ Branch 1 taken 1740 times.
1956 max_val_ = std::max(max_val_, matrix_[i]);
47 }
48 return true;
49 }
50
51 64 bool MaxElementMatrSEQ::PostProcessingImpl() {
52 64 GetOutput() = max_val_;
53 64 return true;
54 }
55
56 } // namespace nikitina_v_max_elem_matr
57