GCC Code Coverage Report


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

Line Branch Exec Source
1 #include "lifanov_k_adj_inv_count_restore/seq/include/ops_seq.hpp"
2
3 #include <cstddef>
4 #include <vector>
5
6 #include "lifanov_k_adj_inv_count_restore/common/include/common.hpp"
7
8 namespace lifanov_k_adj_inv_count_restore {
9
10
1/2
✓ Branch 1 taken 232 times.
✗ Branch 2 not taken.
232 LifanovKAdjacentInversionCountSEQ::LifanovKAdjacentInversionCountSEQ(const InType &in) {
11 SetTypeOfTask(GetStaticTypeOfTask());
12
1/2
✓ Branch 1 taken 232 times.
✗ Branch 2 not taken.
232 GetInput() = in;
13 232 GetOutput() = 0;
14 232 }
15
16
1/2
✓ Branch 0 taken 232 times.
✗ Branch 1 not taken.
232 bool LifanovKAdjacentInversionCountSEQ::ValidationImpl() {
17
2/4
✓ Branch 0 taken 232 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 232 times.
232 return !GetInput().empty() && (GetOutput() == 0);
18 }
19
20 232 bool LifanovKAdjacentInversionCountSEQ::PreProcessingImpl() {
21 232 return true;
22 }
23
24 232 bool LifanovKAdjacentInversionCountSEQ::RunImpl() {
25 const auto &data = GetInput();
26 std::size_t n = data.size();
27 int result = 0;
28
29
2/2
✓ Branch 0 taken 1040 times.
✓ Branch 1 taken 232 times.
1272 for (std::size_t i = 0; i < n - 1; i++) {
30
2/2
✓ Branch 0 taken 368 times.
✓ Branch 1 taken 672 times.
1040 if (data[i] > data[i + 1]) {
31 368 result++;
32 }
33 }
34
35 232 GetOutput() = result;
36 232 return true;
37 }
38
39 232 bool LifanovKAdjacentInversionCountSEQ::PostProcessingImpl() {
40 232 return true;
41 }
42
43 } // namespace lifanov_k_adj_inv_count_restore
44