-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[onedpl][ranges][test] Added std ranges to oneDPL Tested API #1571
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For other tested APIs we preferred to adjust libc++ tests, Have you looked at https://github.com/llvm/llvm-project/tree/main/libcxx/test/std/ranges? Does it make sense to use these for testing, and if not - why?
test/support/test_config.h
Outdated
@@ -117,6 +117,8 @@ | |||
#endif | |||
#endif //!defined(_ENABLE_RANGES_TESTING) | |||
|
|||
#define _ENABLE_STD_RANGES_TESTING (_ONEDPL___cplusplus >= 202002L) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_ONEDPL___cplusplus
is an implementation detail. Please use __cplusplus
and _MSVC_LANG
here. See also #1568 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probbaly, does it make sense to use the following definition in onedpl_config.h
??
#define _ONEDPL_CPP20_RANGES_PRESENT (__cplusplus >= 202002L || _MSVC_LANG >= 202002L) && __cpp_lib_ranges >= 201911L
?
(https://en.cppreference.com/w/cpp/feature_test)
No, I have not looked at ".../libcxx/test/std/ranges" before... |
|
as an example, I have adapted a test for "all_view" (as is with minimal changes). Ok, for "all_view" there is one (two but we can take juts one) test file (from LLVM).
|
From point of view of other our test implementations, it's good way to have one test for one function. |
2f60b40
to
905ca41
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, the PR looks good, but I've left some comments regarding the added test.
The PR covers only a portion of the c++20 ranges functionality and does not cover free range functions like ranges::size()
or more advanced adaptors like join_view
. Do you plan adding it in consequent PRs?
Functions such as std::ranges::size()
and more adaptors such as ranges::join_view
?
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; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also check prev()
, next()
and advance()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
due to within a kernel any range/view must be a random access view, testing of advance
doesn't have much sense, I guess...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It must work, practically (I do not expect an implementer to rely on recursion here, for example). I would check it anyway as it is easy, however I would not insist if you do not do it.
ffab2b2
to
f74c6dd
Compare
Co-authored-by: Dmitriy Sobolev <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[onedpl][ranges][test] Added std ranges to oneDPL Tested API (for parallel oneDPL algorithms):
C++ standard sized RA views (factories and adaptors), released with C++20: