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

C# conformance tests #689

Merged
merged 6 commits into from Aug 5, 2015
Merged

C# conformance tests #689

merged 6 commits into from Aug 5, 2015

Conversation

jskeet
Copy link
Contributor

@jskeet jskeet commented Aug 4, 2015

I had this in two separate branches, but I fail at git, so I've introduced the tests and fixed them in the same PR.

In short:

  • Added conformance tests
  • Notice when we don't have enough data to read an embedded message
  • Consume unknown fields (instead of ignoring the tag and then reading the data as another tag!)

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@googlebot googlebot added cla: no and removed cla: yes labels Aug 4, 2015
@jskeet jskeet force-pushed the fix-eof branch 3 times, most recently from eb0a204 to be9c18a Compare August 4, 2015 13:44
@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Aug 4, 2015
@jskeet jskeet changed the title Fix C# conformance failures C# conformance tests Aug 4, 2015

private static bool RunTest(BinaryReader input, BinaryWriter output)
{
int? size = ReadInt32(input);
Copy link
Member

Choose a reason for hiding this comment

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

Can't use input.ReadUInt32()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope - that would throw if we reached the end of the input. If we could detect whether we were at the end of the stream, we could test for that and then call ReadInt32 or ReadUInt32, but we can't do so easily :(

@haberman
Copy link
Member

haberman commented Aug 4, 2015

Looks great, thanks for doing this!

@jskeet
Copy link
Contributor Author

jskeet commented Aug 4, 2015

I'm very glad I did - it found two significant bugs!

@jtattermusch
Copy link
Contributor

LGTM after addressing the one small comment. Thanks for implementing this and good job catching the bugs.

Completely untested so far - easier to get started in VS and then transfer to Linux for tweaking...
The tests are run from Travis in the same way as on other
platforms. Currently some expected failures - but only expected
in that they're what we got to start with. Will try to fix them in
other pull requests.
This is expected to be the cause of the conformance test failures.
Generated code in next commit.
…s we expected to.

We should now have no conformance failures.
@jskeet
Copy link
Contributor Author

jskeet commented Aug 5, 2015

Merging as only change since last "green" was in AssemblyInfo which wouldn't affect other builds, and the C# build is green.

jskeet added a commit that referenced this pull request Aug 5, 2015
@jskeet jskeet merged commit 6079403 into protocolbuffers:master Aug 5, 2015
@jskeet jskeet deleted the fix-eof branch August 5, 2015 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants