GCC Code Coverage Report


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

Line Branch Exec Source
1 #include "kurpiakov_a_shellsort/seq/include/ops_seq.hpp"
2
3 #include <vector>
4
5 #include "kurpiakov_a_shellsort/common/include/common.hpp"
6
7 namespace kurpiakov_a_shellsort {
8
9
1/2
✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
56 KurpiakovAShellsortSEQ::KurpiakovAShellsortSEQ(const InType &in) {
10 SetTypeOfTask(GetStaticTypeOfTask());
11 GetInput() = in;
12 GetOutput() = {};
13 56 }
14
15 56 bool KurpiakovAShellsortSEQ::ValidationImpl() {
16 56 int input_size = std::get<0>(GetInput());
17 56 auto vector_size = static_cast<int>(std::get<1>(GetInput()).size());
18 56 return input_size == vector_size && input_size >= 0;
19 }
20
21 56 bool KurpiakovAShellsortSEQ::PreProcessingImpl() {
22 56 data_ = std::get<1>(GetInput());
23
24
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
56 int n = static_cast<int>(data_.size());
25 gaps_.clear();
26
2/2
✓ Branch 0 taken 168 times.
✓ Branch 1 taken 56 times.
224 for (int gap = n / 2; gap > 0; gap /= 2) {
27
2/2
✓ Branch 0 taken 32 times.
✓ Branch 1 taken 136 times.
168 gaps_.push_back(gap);
28 }
29
30 56 return true;
31 }
32
33 56 bool KurpiakovAShellsortSEQ::RunImpl() {
34 56 int n = static_cast<int>(data_.size());
35
36
2/2
✓ Branch 0 taken 168 times.
✓ Branch 1 taken 56 times.
224 for (int gap : gaps_) {
37
2/2
✓ Branch 0 taken 64752 times.
✓ Branch 1 taken 168 times.
64920 for (int i = gap; i < n; i++) {
38 64752 int temp = data_[i];
39 int j = i;
40
4/4
✓ Branch 0 taken 119464 times.
✓ Branch 1 taken 4016 times.
✓ Branch 2 taken 58728 times.
✓ Branch 3 taken 60736 times.
123480 while (j >= gap && data_[j - gap] > temp) {
41 58728 data_[j] = data_[j - gap];
42 j -= gap;
43 }
44 64752 data_[j] = temp;
45 }
46 }
47
48 56 return true;
49 }
50
51 56 bool KurpiakovAShellsortSEQ::PostProcessingImpl() {
52 56 GetOutput() = data_;
53 56 return true;
54 }
55
56 } // namespace kurpiakov_a_shellsort
57