| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "perepelkin_i_qsort_batcher_oddeven_merge/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <cstdlib> | ||
| 4 | #include <utility> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "perepelkin_i_qsort_batcher_oddeven_merge/common/include/common.hpp" | ||
| 8 | |||
| 9 | namespace perepelkin_i_qsort_batcher_oddeven_merge { | ||
| 10 | |||
| 11 |
1/2✓ Branch 1 taken 96 times.
✗ Branch 2 not taken.
|
96 | PerepelkinIQsortBatcherOddEvenMergeSEQ::PerepelkinIQsortBatcherOddEvenMergeSEQ(const InType &in) { |
| 12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 13 |
1/2✓ Branch 1 taken 96 times.
✗ Branch 2 not taken.
|
96 | GetInput() = in; |
| 14 | 96 | GetOutput() = std::vector<double>(); | |
| 15 | 96 | } | |
| 16 | |||
| 17 | 96 | bool PerepelkinIQsortBatcherOddEvenMergeSEQ::ValidationImpl() { | |
| 18 | 96 | return GetOutput().empty(); | |
| 19 | } | ||
| 20 | |||
| 21 | 96 | bool PerepelkinIQsortBatcherOddEvenMergeSEQ::PreProcessingImpl() { | |
| 22 | 96 | return true; | |
| 23 | } | ||
| 24 | |||
| 25 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 8 times.
|
96 | bool PerepelkinIQsortBatcherOddEvenMergeSEQ::RunImpl() { |
| 26 | const auto &data = GetInput(); | ||
| 27 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 8 times.
|
96 | if (data.empty()) { |
| 28 | return true; | ||
| 29 | } | ||
| 30 | |||
| 31 | 88 | std::vector<double> buffer = data; | |
| 32 |
1/2✓ Branch 1 taken 88 times.
✗ Branch 2 not taken.
|
88 | std::qsort(buffer.data(), buffer.size(), sizeof(double), [](const void *a, const void *b) { |
| 33 | double arg1 = *static_cast<const double *>(a); | ||
| 34 | double arg2 = *static_cast<const double *>(b); | ||
| 35 | if (arg1 < arg2) { | ||
| 36 | return -1; | ||
| 37 | } | ||
| 38 | if (arg1 > arg2) { | ||
| 39 | return 1; | ||
| 40 | } | ||
| 41 | return 0; | ||
| 42 | }); | ||
| 43 | |||
| 44 | GetOutput() = std::move(buffer); | ||
| 45 | return true; | ||
| 46 | } | ||
| 47 | |||
| 48 | 96 | bool PerepelkinIQsortBatcherOddEvenMergeSEQ::PostProcessingImpl() { | |
| 49 | 96 | return true; | |
| 50 | } | ||
| 51 | |||
| 52 | } // namespace perepelkin_i_qsort_batcher_oddeven_merge | ||
| 53 |