GCC Code Coverage Report


Directory: ./
File: tasks/nikolaev_d_most_dif_vec_neighbors/seq/src/ops_seq.cpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 15 15 100.0%
Functions: 5 5 100.0%
Branches: 10 14 71.4%

Line Branch Exec Source
1 #include "nikolaev_d_most_dif_vec_neighbors/seq/include/ops_seq.hpp"
2
3 #include <cmath>
4 #include <cstdint>
5 #include <cstdlib>
6 #include <utility>
7 #include <vector>
8
9 #include "nikolaev_d_most_dif_vec_neighbors/common/include/common.hpp"
10
11 namespace nikolaev_d_most_dif_vec_neighbors {
12
13
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 NikolaevDMostDifVecNeighborsSEQ::NikolaevDMostDifVecNeighborsSEQ(const InType &in) {
14 SetTypeOfTask(GetStaticTypeOfTask());
15
1/2
✓ Branch 1 taken 80 times.
✗ Branch 2 not taken.
80 GetInput() = in;
16 GetOutput() = OutType{};
17 80 }
18
19 80 bool NikolaevDMostDifVecNeighborsSEQ::ValidationImpl() {
20 80 return GetInput().size() >= 2;
21 }
22
23 80 bool NikolaevDMostDifVecNeighborsSEQ::PreProcessingImpl() {
24 80 return true;
25 }
26
27
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 bool NikolaevDMostDifVecNeighborsSEQ::RunImpl() {
28
1/2
✓ Branch 0 taken 80 times.
✗ Branch 1 not taken.
80 if (GetInput().size() < 2) {
29 return false;
30 }
31
32 const auto &vec = GetInput();
33 std::pair<int, int> result_elements;
34 int64_t max_diff = -1;
35
36
2/2
✓ Branch 0 taken 344 times.
✓ Branch 1 taken 80 times.
424 for (std::vector<int>::size_type i = 0; i < GetInput().size() - 1; i++) {
37
2/2
✓ Branch 0 taken 176 times.
✓ Branch 1 taken 168 times.
344 int64_t diff = std::llabs(static_cast<int64_t>(vec[i + 1]) - static_cast<int64_t>(vec[i]));
38
2/2
✓ Branch 0 taken 176 times.
✓ Branch 1 taken 168 times.
344 if (diff > max_diff) {
39 max_diff = diff;
40 result_elements = {vec[i], vec[i + 1]};
41 }
42 }
43
44 GetOutput() = result_elements;
45 80 return true;
46 }
47
48 80 bool NikolaevDMostDifVecNeighborsSEQ::PostProcessingImpl() {
49 80 return true;
50 }
51
52 } // namespace nikolaev_d_most_dif_vec_neighbors
53