Skip to content

Add stream position check to reader unit tests #541

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

Merged
merged 1 commit into from
Feb 13, 2016

Conversation

jschobben
Copy link
Contributor

Added some checks to the reader unit tests, to make sure the amount of characters read from the input stream is as expected.

I've simply used the current amount of read characters, to make the tests pass.

streamPos = 6; // 0xF0 - 0xF4
else
streamPos = 3; // 0xF5 - 0xFF
TEST_STRING_ERROR(kParseErrorStringInvalidEncoding, e, 2, streamPos);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The values for streamPos assigned above look a bit odd, they do not exactly match to section 3.2 of http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It matches https://en.wikipedia.org/wiki/UTF-8#Codepage_layout though. If it's on Wikipedia it must be true :)

miloyip added a commit that referenced this pull request Feb 13, 2016
Add stream position check to reader unit tests
@miloyip miloyip merged commit c974997 into Tencent:master Feb 13, 2016
@miloyip
Copy link
Collaborator

miloyip commented Feb 13, 2016

Thanks

@jschobben jschobben deleted the issue507 branch February 13, 2016 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants