From f74c6dd1052b182867edf4dc294a11efd24b9d4b Mon Sep 17 00:00:00 2001 From: MikeDvorskiy Date: Mon, 16 Dec 2024 13:56:18 +0100 Subject: [PATCH] [oneDPL][dpcpp][tested API][ranges] + test coverage enhanced --- test/xpu_api/ranges/xpu_std_drop_view.pass.cpp | 3 ++- test/xpu_api/ranges/xpu_std_iota_view.pass.cpp | 3 ++- test/xpu_api/ranges/xpu_std_single_view.pass.cpp | 2 +- test/xpu_api/ranges/xpu_std_subrange.pass.cpp | 5 +++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/xpu_api/ranges/xpu_std_drop_view.pass.cpp b/test/xpu_api/ranges/xpu_std_drop_view.pass.cpp index 7057f4b3e57..060ca7999d4 100644 --- a/test/xpu_api/ranges/xpu_std_drop_view.pass.cpp +++ b/test/xpu_api/ranges/xpu_std_drop_view.pass.cpp @@ -28,7 +28,8 @@ main() #if _ENABLE_STD_RANGES_TESTING auto test = [](){ auto res = std::ranges::views::iota(0, 4) | std::ranges::views::drop(2); - return res.size() == 2 && res[0] == 2 && res[1] == 3 && *res.begin() == 2 && res.end() - res.begin() == 2; + return res.size() == 2 && res[0] == 2 && res[1] == 3 && *res.begin() == 2 + && res.end() - res.begin() == 2; }; const bool res = kernel_test(test); EXPECT_TRUE(res, "Wrong result of drop_view check within a kernel"); diff --git a/test/xpu_api/ranges/xpu_std_iota_view.pass.cpp b/test/xpu_api/ranges/xpu_std_iota_view.pass.cpp index d47b671bc24..50ab60f8608 100644 --- a/test/xpu_api/ranges/xpu_std_iota_view.pass.cpp +++ b/test/xpu_api/ranges/xpu_std_iota_view.pass.cpp @@ -29,7 +29,8 @@ main() auto test = [](){ auto res = std::ranges::views::iota(0, 4); return res.size() == 4 && res[0] == 0 && res[1] == 1 && res[2] == 2 && res[3] == 3 && - *(res.begin() + 2) == 2 && (res.end() - res.begin()) == 4; + *(res.begin() + 2) == 2 && (res.end() - res.begin()) == 4 && !res.empty() && + res.front() == 0 && res.back() == 3; }; const bool res = kernel_test(test); EXPECT_TRUE(res, "Wrong result of iota_view check within a kernel"); diff --git a/test/xpu_api/ranges/xpu_std_single_view.pass.cpp b/test/xpu_api/ranges/xpu_std_single_view.pass.cpp index 4ed59374078..5824635b7bc 100644 --- a/test/xpu_api/ranges/xpu_std_single_view.pass.cpp +++ b/test/xpu_api/ranges/xpu_std_single_view.pass.cpp @@ -28,7 +28,7 @@ main() #if _ENABLE_STD_RANGES_TESTING auto test = [](){ auto res = std::ranges::views::single(1); - return res.size() == 1 && res[0] == 1 && *res.begin() == 1 && res.end() - res.begin() == 1; + return res.size() == 1 && res[0] == 1 && *res.begin() == 1 && res.end() - res.begin() == 1 && *res.data() == 1; }; const bool res = kernel_test(test); EXPECT_TRUE(res, "Wrong result of single_view check within a kernel"); diff --git a/test/xpu_api/ranges/xpu_std_subrange.pass.cpp b/test/xpu_api/ranges/xpu_std_subrange.pass.cpp index 4f081dfb765..bc6df95f8d9 100644 --- a/test/xpu_api/ranges/xpu_std_subrange.pass.cpp +++ b/test/xpu_api/ranges/xpu_std_subrange.pass.cpp @@ -29,8 +29,9 @@ main() 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; + + return res.size() == 3 && res[0] == 1 && res[1] == 2 && res[2] == 3 && (*res.begin() + 2) == 3 && + res.end() - res.begin() == 3 && *std::ranges::next(res.begin()) == 2 && *std::ranges::prev(res.end()) == 3; }; const bool res = kernel_test(test); EXPECT_TRUE(res, "Wrong result of subrange check within a kernel");