-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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 unit tests for HashingContext #43459
Add unit tests for HashingContext #43459
Conversation
You can surround the "invalid" code path with |
Oh, ok. That's good to know, thanks! |
8fe3925
to
b7cb1a0
Compare
I have added more tests that should cover the invalid use of |
b7cb1a0
to
38d022c
Compare
Made an update to current master to solve conflicts. |
38d022c
to
573f106
Compare
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.
Cannot comment on the topic, but tests look good to me!
Needs another rebase...
573f106
to
04ce187
Compare
Need to bump year to 2021 in headers: https://github.com/godotengine/godot/pull/43459/checks?check_run_id=1993702277. |
04ce187
to
fc8e460
Compare
Yeah just recognized it, thx! Should be fine now. |
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.
This looks good 🏅 .
It would be nice to also add comparison to the actual known hashes.
I see the String
hash functions are tested separately in tests/test_string.h
so it feels like testing the same thing 2 times, but this specific test feels a bit incomplete without it.
That said, I don't have a strong opinion about it, so I'm going to approve anyway.
I'm with you. |
fc8e460
to
f12d205
Compare
The actual hashes are now used for comparison instead of the Hope this makes more sense now :) |
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.
Great work, thanks!
This is part of issue #43440.
The unit tests should cover the basic use cases of
HashingContext
.I thought about making tests for invalid input as well (e.g. call to
update
with an emptyPackedByteArray
), but all these cases are already handled with proper asserts, so I omitted them (as they would pollute the output withERROR
messages).Ps.: This is my first contribution. So any feedback/critic is very welcome!