GCC Code Coverage Report


Directory: ./
File: tasks/krasnopevtseva_v_bubble_sort/seq/src/ops_seq.cpp
Date: 2026-01-09 01:27:18
Exec Total Coverage
Lines: 20 20 100.0%
Functions: 5 5 100.0%
Branches: 13 16 81.2%

Line Branch Exec Source
1 #include "krasnopevtseva_v_bubble_sort/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5 #include <vector>
6
7 #include "krasnopevtseva_v_bubble_sort/common/include/common.hpp"
8
9 namespace krasnopevtseva_v_bubble_sort {
10
11
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 KrasnopevtsevaVBubbleSortSEQ::KrasnopevtsevaVBubbleSortSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 GetInput() = in;
14 48 GetOutput() = std::vector<int>();
15 48 }
16
17 48 bool KrasnopevtsevaVBubbleSortSEQ::ValidationImpl() {
18 const auto &input = GetInput();
19 48 return (!input.empty());
20 }
21
22 48 bool KrasnopevtsevaVBubbleSortSEQ::PreProcessingImpl() {
23 48 GetOutput() = std::vector<int>();
24 48 return true;
25 }
26
27 48 bool KrasnopevtsevaVBubbleSortSEQ::RunImpl() {
28 const auto &input = GetInput();
29 size_t size = input.size();
30 48 std::vector<int> sort_v = input;
31 bool is_sort = false;
32
2/2
✓ Branch 0 taken 400 times.
✓ Branch 1 taken 48 times.
448 while (!is_sort) {
33 is_sort = true;
34
2/2
✓ Branch 0 taken 6680 times.
✓ Branch 1 taken 400 times.
7080 for (size_t i = 0; i < size - 1; i += 2) {
35
2/2
✓ Branch 0 taken 3544 times.
✓ Branch 1 taken 3136 times.
6680 if (sort_v[i] > sort_v[i + 1]) {
36 std::swap(sort_v[i], sort_v[i + 1]);
37 is_sort = false;
38 }
39 }
40
2/2
✓ Branch 0 taken 6488 times.
✓ Branch 1 taken 400 times.
6888 for (size_t i = 1; i < size - 1; i += 2) {
41
2/2
✓ Branch 0 taken 3392 times.
✓ Branch 1 taken 3096 times.
6488 if (sort_v[i] > sort_v[i + 1]) {
42 std::swap(sort_v[i], sort_v[i + 1]);
43 is_sort = false;
44 }
45 }
46 }
47
48
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 GetOutput() = sort_v;
49 48 return true;
50 }
51
52 48 bool KrasnopevtsevaVBubbleSortSEQ::PostProcessingImpl() {
53 48 return true;
54 }
55
56 } // namespace krasnopevtseva_v_bubble_sort
57