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