GCC Code Coverage Report


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

Line Branch Exec Source
1 #include "leonova_a_most_diff_neigh_vec_elems/seq/include/ops_seq.hpp"
2
3 #include <cstdint>
4 #include <cstdlib>
5 #include <tuple>
6 #include <vector>
7
8 #include "leonova_a_most_diff_neigh_vec_elems/common/include/common.hpp"
9
10 namespace leonova_a_most_diff_neigh_vec_elems {
11
12
1/2
✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
56 LeonovaAMostDiffNeighVecElemsSEQ::LeonovaAMostDiffNeighVecElemsSEQ(const InType &in) {
13 SetTypeOfTask(GetStaticTypeOfTask());
14
1/2
✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
56 GetInput() = in;
15 GetOutput() = std::tuple<int, int>(0, 0);
16 56 }
17
18 56 bool LeonovaAMostDiffNeighVecElemsSEQ::ValidationImpl() {
19 56 return !GetInput().empty();
20 }
21
22 56 bool LeonovaAMostDiffNeighVecElemsSEQ::PreProcessingImpl() {
23 56 return true;
24 }
25
26
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 48 times.
56 bool LeonovaAMostDiffNeighVecElemsSEQ::RunImpl() {
27
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 48 times.
56 if (GetInput().size() == 1) {
28 8 std::get<0>(GetOutput()) = GetInput()[0];
29 8 std::get<1>(GetOutput()) = GetInput()[0];
30 8 return true;
31 }
32
33 int64_t max_diff = -1;
34
2/2
✓ Branch 0 taken 160 times.
✓ Branch 1 taken 48 times.
208 for (std::vector<int>::size_type index = 0; index < GetInput().size() - 1; index++) {
35
2/2
✓ Branch 0 taken 56 times.
✓ Branch 1 taken 104 times.
160 std::tuple<int, int> curr_elems(GetInput()[index], GetInput()[index + 1]);
36
37 160 int64_t curr_diff = std::llabs(static_cast<int64_t>(std::get<0>(curr_elems)) -
38 160 static_cast<int64_t>(std::get<1>(curr_elems))); // safe abs
39
40
2/2
✓ Branch 0 taken 56 times.
✓ Branch 1 taken 104 times.
160 if (curr_diff > max_diff) {
41 max_diff = curr_diff;
42 GetOutput() = curr_elems;
43 }
44 }
45 return true;
46 }
47
48 56 bool LeonovaAMostDiffNeighVecElemsSEQ::PostProcessingImpl() {
49 56 return true;
50 }
51
52 } // namespace leonova_a_most_diff_neigh_vec_elems
53