-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[oneDPL][ranges][test] + checking std views (which are supported) wit…
…h algorithms
- Loading branch information
1 parent
b654c87
commit 47a1dcc
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// -*- C++ -*- | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Copyright (C) Intel Corporation | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
// This file incorporates work covered by the following copyright and permission | ||
// notice: | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "std_ranges_test.h" | ||
|
||
std::int32_t | ||
main() | ||
{ | ||
#if _ENABLE_STD_RANGES_TESTING | ||
using namespace test_std_ranges; | ||
namespace dpl_ranges = oneapi::dpl::ranges; | ||
|
||
const int n = 1<<25; //32M | ||
|
||
//transform view | ||
test_range_algo<0>{n}.test_view(std::views::transform([](const auto a) { return a*2; }), | ||
dpl_ranges::find_if, std::ranges::find_if, pred, proj); | ||
|
||
//reverse view | ||
test_range_algo<1>{n}.test_view(std::views::reverse, dpl_ranges::sort, std::ranges::sort, std::less{}); | ||
|
||
//take view | ||
test_range_algo<2>{n}.test_view(std::views::take(n/2), dpl_ranges::count_if, std::ranges::count_if, pred, proj); | ||
|
||
//drop_view | ||
test_range_algo<3>{n}.test_view(std::views::drop(n/2), dpl_ranges::count_if, std::ranges::count_if, pred, proj); | ||
|
||
//NOTICE: std::ranges::views::all, std::ranges::subrange, std::span are tested implicitly within the 'test_range_algo' test engine. | ||
#endif //_ENABLE_STD_RANGES_TESTING | ||
|
||
return TestUtils::done(_ENABLE_STD_RANGES_TESTING); | ||
} |