Skip to content

Commit

Permalink
[oneDPL][hetero][ranges][test] + xpu test for std::ranges::subrange
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDvorskiy committed May 22, 2024
1 parent 95007bf commit 2f60b40
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/xpu_api/ranges/xpu_std_subrange.pass.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// -*- 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 "support/test_config.h"
#include "support/test_macros.h"
#include "support/utils.h"

#if _ENABLE_STD_RANGES_TESTING
#include <ranges>
#include "xpu_std_ranges_test.h"
#endif //_ENABLE_STD_RANGES_TESTING

int
main()
{
#if _ENABLE_STD_RANGES_TESTING
auto test = [](){
auto v = std::ranges::views::iota(0, 4);
auto res = std::ranges::subrange(v.begin() + 1, v.end());
return res.size() == 3 && res[0] == 0 && res[1] == 1 && res[2] == 2 &&
(*res.begin() + 2) == 2 && res.end() - res.begin() == 3;
};
const bool res = kernel_test<class std_reverse_test>(test);
EXPECT_TRUE(res, "Wrong result of subrange check within a kernel");
#endif //_ENABLE_STD_RANGES_TESTING

return TestUtils::done(_ENABLE_STD_RANGES_TESTING);
}

0 comments on commit 2f60b40

Please sign in to comment.