Skip to content
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

byte_stream_reader::skip #660

Closed
tzijnge opened this issue Jan 14, 2023 · 2 comments
Closed

byte_stream_reader::skip #660

tzijnge opened this issue Jan 14, 2023 · 2 comments
Assignees
Labels

Comments

@tzijnge
Copy link

tzijnge commented Jan 14, 2023

I noticed that it's not possible to skip to the end of a byte_stream_reader. I have made this unit test (googletest) to show the problem. In the example I would expect read and skip to leave the byte_stream_reader in the same, valid state. But actually read works and skip does not work (it asserts/returns false). Am I missing the point of skip or is this a bug where < should be replaced with <= here

TEST(TestByteStreamReader, skip)
{
    etl::array<uint8_t, 4> data;
    etl::byte_stream_reader r(data.begin(), data.size(), etl::endian::little);
    r.skip<uint8_t>(4); // This fails
    r.read<uint8_t>(4); // This works
    EXPECT_TRUE(r.empty());
}
@jwellbelove jwellbelove self-assigned this Jan 19, 2023
jwellbelove added a commit that referenced this issue Jan 20, 2023
#660 byte_stream_reader::skip error
@jwellbelove
Copy link
Contributor

Fixed 20.35.11

@tzijnge
Copy link
Author

tzijnge commented Jan 20, 2023

Awesome. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

2 participants