|
| 1 | +// -*- C++ -*- |
| 2 | +//===----------------------------------------------------------------------===// |
| 3 | +// |
| 4 | +// Copyright (C) Intel Corporation |
| 5 | +// |
| 6 | +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 | +// |
| 8 | +// This file incorporates work covered by the following copyright and permission |
| 9 | +// notice: |
| 10 | +// |
| 11 | +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 12 | +// See https://llvm.org/LICENSE.txt for license information. |
| 13 | +// |
| 14 | +//===----------------------------------------------------------------------===// |
| 15 | + |
| 16 | +#include "std_ranges_test.h" |
| 17 | + |
| 18 | +std::int32_t |
| 19 | +main() |
| 20 | +{ |
| 21 | +#if _ENABLE_STD_RANGES_TESTING |
| 22 | + using namespace test_std_ranges; |
| 23 | + namespace dpl_ranges = oneapi::dpl::ranges; |
| 24 | + |
| 25 | + auto unique_copy_checker = [](std::ranges::random_access_range auto&& r_in, |
| 26 | + std::ranges::random_access_range auto&& r_out, auto&&... args) |
| 27 | + { |
| 28 | + auto res = std::ranges::unique_copy(std::forward<decltype(r_in)>(r_in), std::ranges::begin(r_out), |
| 29 | + std::forward<decltype(args)>(args)...); |
| 30 | + |
| 31 | + using ret_type = std::ranges::unique_copy_result<std::ranges::borrowed_iterator_t<decltype(r_in)>, |
| 32 | + std::ranges::borrowed_iterator_t<decltype(r_out)>>; |
| 33 | + return ret_type{res.in, res.out}; |
| 34 | + }; |
| 35 | + |
| 36 | + test_range_algo<0, int, data_in_out>{big_sz}(dpl_ranges::unique_copy, unique_copy_checker, std::ranges::equal_to{}); |
| 37 | + test_range_algo<1, int, data_in_out>{}(dpl_ranges::unique_copy, unique_copy_checker, std::not_equal_to{}, proj); |
| 38 | + test_range_algo<2, int, data_in_out>{}(dpl_ranges::unique_copy, unique_copy_checker, std::ranges::equal_to{}, proj); |
| 39 | + test_range_algo<3, P2, data_in_out>{}(dpl_ranges::unique_copy, unique_copy_checker, std::ranges::equal_to{}, &P2::x); |
| 40 | + test_range_algo<4, P2, data_in_out>{}(dpl_ranges::unique_copy, unique_copy_checker, std::ranges::equal_to{}, &P2::proj); |
| 41 | +#endif //_ENABLE_STD_RANGES_TESTING |
| 42 | + |
| 43 | + return TestUtils::done(_ENABLE_STD_RANGES_TESTING); |
| 44 | +} |
0 commit comments