| 10 | int hi); |
| 11 | |
| 12 | int main() { |
| 13 | std::cout << "Starting parallel quick sort test" << std::endl; |
| 14 | |
| 15 | concurrencpp::runtime_options opts; |
| 16 | opts.max_cpu_threads = std::thread::hardware_concurrency() * 8; |
| 17 | concurrencpp::runtime runtime(opts); |
| 18 | |
| 19 | ::srand(::time(nullptr)); |
| 20 | |
| 21 | std::vector<int> array(8'000'000); |
| 22 | for (auto& i : array) { |
| 23 | i = ::rand() % 100'000; |
| 24 | } |
| 25 | |
| 26 | quick_sort({}, runtime.thread_pool_executor(), array.data(), 0, array.size() - 1).get(); |
| 27 | |
| 28 | const auto is_sorted = std::is_sorted(array.begin(), array.end()); |
| 29 | if (!is_sorted) { |
| 30 | std::cerr << "Quick sort test failed: array is not sorted." << std::endl; |
| 31 | std::abort(); |
| 32 | } |
| 33 | |
| 34 | std::cout << "================================" << std::endl; |
| 35 | } |
| 36 | |
| 37 | using namespace concurrencpp; |
| 38 |
nothing calls this directly
no test coverage detected