Revert "[lldb][test] Remove compiler version check and use regex" (#124101)
[llvm-project.git] / libc / test / src / stdlib / quick_sort_test.cpp
blob2832c855370bcb5fad9b48caa5d681fd0bdd5e79
1 //===-- Unittests for qsort -----------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "SortingTest.h"
10 #include "src/stdlib/qsort_util.h"
12 void quick_sort(void *array, size_t array_size, size_t elem_size,
13 int (*compare)(const void *, const void *)) {
14 constexpr bool USE_QUICKSORT = true;
16 const auto is_less = [compare](const void *a,
17 const void *b) noexcept -> bool {
18 return compare(a, b) < 0;
21 LIBC_NAMESPACE::internal::unstable_sort_impl<USE_QUICKSORT>(
22 array, array_size, elem_size, is_less);
25 LIST_SORTING_TESTS(Qsort, quick_sort);