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

Add description for test vectors #69

Merged
merged 3 commits into from
Jun 10, 2020
Merged

Add description for test vectors #69

merged 3 commits into from
Jun 10, 2020

Conversation

vmx
Copy link
Member

@vmx vmx commented Jun 4, 2020

I was looking at the test vectors (in order to add them to the Rust implementation). I think test vectors should always serve a purpose, hence I documented them in this README.

Though I couldn't make sense for all of them. Some seem to test exactly the same thing. Hence I propose removing some. I propose removing test2.csv, test3.csv, test4.csv as I don't see how they add value.

Copy link
Contributor

@ribasushi ribasushi left a comment

Choose a reason for hiding this comment

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

PR LGTM as is, but regarding the other question:

  • I'd say Keeping tests 2/4/5 as-is is somewhat critical: the multitude of ways to implement leading zero preservation means this combination of testvectors is needed to weed out bugs. That is it doesn't matter what the string is, what is important is to have string \x00string \x00\x00string as a test vector.

  • 3 is likely there to support 6, I am in favor of removing it.

TLDR: we could get by with only keeping 4 tests:

  • string \x00string \x00\x00string requiring full roundtrip by a compliant implementation
  • mangled-case-encoding requiring valid decode by a compliant implementation

@vmx
Copy link
Member Author

vmx commented Jun 4, 2020

Thanks @ribasushi, that's the reply I was looking for. I'm not deep enough into base encoding to understand why a different number of leading zeros makes a difference.

I'll create a separate PR tackling the removal.

@vmx
Copy link
Member Author

vmx commented Jun 4, 2020

I changed my mind. I updated the descriptions and removed some test vectors. As files numbered with gaps is weird, I also renamed them. Please note that I didn't change the vectors themselves, so implementations (like js-multibase) don't need to update them, they can just remove some (if they want to, but don't have to).

@vmx vmx requested review from hugomrdias and ribasushi June 4, 2020 14:43
@Stebalien
Copy link
Member

Why not just leave them? I believe they're just testing different strings and different lengths.

Copy link
Contributor

@ribasushi ribasushi left a comment

Choose a reason for hiding this comment

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

@vmx once you merge #70 - LGTM

@ribasushi
Copy link
Contributor

Why not just leave them? I believe they're just testing different strings and different lengths.

@Stebalien both @hugomrdias during implementation and @vmx just now had to raise a question "why are these things here, what do they accomplish?". I think reducing the amount of vectors and clearly naming them is an improvement.

@Stebalien
Copy link
Member

I guess it does: #71

@vmx
Copy link
Member Author

vmx commented Jun 9, 2020

I've rebased on master, I think it's ready to be merged, please review again.

@vmx vmx merged commit ae81809 into master Jun 10, 2020
@vmx vmx deleted the test-description branch June 10, 2020 13:27
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.

4 participants