Skip to content

Commit

Permalink
[oneDPL][dpcpp][tested API][ranges] + test coverage enhanced
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDvorskiy committed Dec 16, 2024
1 parent 1b0955f commit ffab2b2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion test/xpu_api/ranges/xpu_std_drop_view.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.base()[1] == 1 && res.size() == 2 && res[0] == 2 && res[1] == 3 && *res.begin() == 2
&& res.end() - res.begin() == 2;
};
const bool res = kernel_test<class std_drop_test>(test);
EXPECT_TRUE(res, "Wrong result of drop_view check within a kernel");
Expand Down
3 changes: 2 additions & 1 deletion test/xpu_api/ranges/xpu_std_iota_view.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<class std_iota_test>(test);
EXPECT_TRUE(res, "Wrong result of iota_view check within a kernel");
Expand Down
2 changes: 1 addition & 1 deletion test/xpu_api/ranges/xpu_std_single_view.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<class std_single_test>(test);
EXPECT_TRUE(res, "Wrong result of single_view check within a kernel");
Expand Down
5 changes: 3 additions & 2 deletions test/xpu_api/ranges/xpu_std_subrange.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<class std_reverse_test>(test);
EXPECT_TRUE(res, "Wrong result of subrange check within a kernel");
Expand Down

0 comments on commit ffab2b2

Please sign in to comment.