-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add {Async}Enumerable.{Infinite}Sequence #116538
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
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.
Pull Request Overview
This PR introduces new overloads for Enumerable.Sequence and Enumerable.InfiniteSequence, along with their asynchronous counterparts in AsyncEnumerable, to generate sequences based on a start, end (or infinite), and step value.
- Implements new APIs in both System.Linq and System.Linq.AsyncEnumerable.
- Adds comprehensive tests for various numeric types and edge cases.
- Updates project files and ref files to include the new sequence functionality.
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Linq/tests/SequenceTests.cs | Adds tests validating correct behavior of Sequence for various numeric types. |
| src/libraries/System.Linq/tests/InfiniteSequenceTests.cs | Introduces tests to verify infinite sequence generation and uniqueness of enumerators. |
| src/libraries/System.Linq/src/System/Linq/Sequence.cs | Implements the new Sequence API with logic for incrementing and decrementing sequences. |
| src/libraries/System.Linq/src/System/Linq/InfiniteSequence.cs | Adds InfiniteSequence API for generating unbounded sequences. |
| src/libraries/System.Linq.AsyncEnumerable/* | Provides asynchronous versions of Sequence and InfiniteSequence along with corresponding tests and project file updates. |
src/libraries/System.Linq.AsyncEnumerable/src/System/Linq/InfiniteSequence.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Linq.AsyncEnumerable/tests/InfiniteSequenceTests.cs
Show resolved
Hide resolved
72daed5 to
7327b9b
Compare
|
/ba-g wasm crashes in unrelated test suites |
|
|
||
| for (int i = 1; i < 3; i++) | ||
| { | ||
| Assert.NotNull(Enumerable.Sequence(T.CreateTruncating(123), T.CreateTruncating(122), T.CreateTruncating(-i))); |
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.
Is this NotNull assertion working as expected?
It seems always pass tests because Enumerable.Sequence always returns non null value.
I though It seems Assert.Empty is expected to be used here.
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.
Yeah, these can be Assert.Empty instead of Assert.NotNull.
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.
My comment above was incorrect.,
These assertions seems expected Assert.NotEmpty not Assert.Empty
Closes #97689