GCC Code Coverage Report


Directory: ./
File: tasks/dergachev_a_max_elem_vec/seq/src/ops_seq.cpp
Date: 2026-01-27 01:59:34
Exec Total Coverage
Lines: 18 18 100.0%
Functions: 5 5 100.0%
Branches: 3 4 75.0%

Line Branch Exec Source
1 #include "dergachev_a_max_elem_vec/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <limits>
5
6 #include "dergachev_a_max_elem_vec/common/include/common.hpp"
7
8 namespace dergachev_a_max_elem_vec {
9
10 96 DergachevAMaxElemVecSEQ::DergachevAMaxElemVecSEQ(const InType &in) {
11 SetTypeOfTask(GetStaticTypeOfTask());
12 96 GetInput() = in;
13 96 GetOutput() = std::numeric_limits<InType>::min();
14 96 }
15
16 96 bool DergachevAMaxElemVecSEQ::ValidationImpl() {
17 96 return (GetInput() > 0);
18 }
19
20 96 bool DergachevAMaxElemVecSEQ::PreProcessingImpl() {
21 96 return GetInput() > 0;
22 }
23
24 96 bool DergachevAMaxElemVecSEQ::RunImpl() {
25
1/2
✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
96 if (GetInput() <= 0) {
26 return false;
27 }
28
29 const int vector_size = GetInput();
30 96 InType current_max = std::numeric_limits<InType>::min();
31
32
2/2
✓ Branch 0 taken 404904 times.
✓ Branch 1 taken 96 times.
405000 for (int idx = 0; idx < vector_size; ++idx) {
33 404904 const auto current_value = static_cast<InType>(((idx * 7) % 2000) - 1000);
34 404904 current_max = std::max(current_value, current_max);
35 }
36
37 96 GetOutput() = current_max;
38 96 return true;
39 }
40
41 96 bool DergachevAMaxElemVecSEQ::PostProcessingImpl() {
42 96 return GetOutput() >= std::numeric_limits<InType>::min();
43 }
44
45 } // namespace dergachev_a_max_elem_vec
46